Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Please help me fix my alarm bot script.

Author
Message
Runihadacow
12
Years of Service
User Offline
Joined: 17th May 2012
Location:
Posted: 4th Jun 2012 01:12
:This is to be palced inside a creature that patrols the area looking for the player. When he find the player he is supposed to use activated such as spawning people ect. This person is also supposed to be using waypoints as well. Please not that this bot does not attack the player himself.:


;Artificial Intelligence Script

;Header

desc = Alarm Bot

;Triggers
:waypointstate=0:animate=2,waypointstart
:waypointstate=3:animate=2,waypointnext
:waypointstate=4:animate=2,waypointrandom
:waypointstate=5:animate=2,waypointreverse
:nearactivatable=0:settarget,activatetarget=2

:state=0:state=1
:state=1,plrcanbeseen:settarget,state=3
:state=1,random=20:rotateheadrandom=65
:state=1,random=60:rotatetoplr
:state=1,shotdamage=10:settarget,waypointstop,animate=1,rotatetotarget,resethead,state=4
:state=1,noiseheard=5:rotateheadrandom=85

:state=2:waypointstop,rotatetoplr,state=3,activateifused=1
:state=3:animate=1,waypointstart,state=0

:state=4,plrcanbeseen=46:settarget,state=2
:state=4,random=20:animate=2,waypointstart,state=1


;End of Script
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 4th Jun 2012 06:24
What exactly is not working with it? In other words you have told us what is expected but what is happening that you did not expect?

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 4th Jun 2012 10:47
you have to add a ",state=0" into the waypointstate-actions so he can check state=0 to go on to state=1 and check for player near. if not, he will continue walking waypoints without doing anything else (i think thats your prob, right?).

in addition he will only activate its target when shot, not when player is near, but i think thats the intention.

Runihadacow
12
Years of Service
User Offline
Joined: 17th May 2012
Location:
Posted: 4th Jun 2012 20:03
yes the issue is he just follows the waypoint but I am also looking for when eh sees the player to activate the ifused
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 5th Jun 2012 10:24
then

Quote: ":state=1,plrcanbeseen:settarget,state="


leads to

Quote: ":state=3:animate=1,waypointstart,state=0"


but should lead to

Quote: ":state=4,plrcanbeseen:settarget,state=2"




Runihadacow
12
Years of Service
User Offline
Joined: 17th May 2012
Location:
Posted: 5th Jun 2012 14:40
SO far what I have is below. For some reason after he hits his first waypoint he just wiggles back and forth where should I be placing in the waypoints for him to check state 0 and should I got back to the waypoints after checking for 0? Sorry I am a bit new about this and i have done other scripts just have not messed with the waypoint scripts yet. Thank you for your time and help.


maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 6th Jun 2012 10:54 Edited at: 9th Jun 2012 11:19
lets see if we can get this.

first, you have to think about
Quote: "a creature that patrols the area looking for the player"
, good first step to write down what you want to do. this means the bot uses waypoints (see follow.fpi in people-folder) while "doing something ALL THE TIME" (state=0 to point on this). results in this:

:waypointstate=0:state=0,animate=2,waypointstart
:waypointstate=3:state=0,animate=2,waypointnext
:waypointstate=4:state=0,animate=2,waypointrandom
:waypointstate=5:state=0,animate=2,waypointreverse

:nearactivatable=0:settarget,activatetarget=2


(the last line is for opening doors automatically)

waypoints have to be on top of the script-triggers, so thats the start of the script. state=0 in every line at start because you want it first to scan the area ALL THE TIME.

so lets see the program/behavior while patroling - starting with state=0.

:state=0:state=1

what you want it to do?

- alarm when shot
- alarm when player in sight and in 500 range (big prefab room)

alarm (=state=10): stop,rotate to player, play alarm-sound, activate 2 guards (state=11 because you have to change state so sound will work and to add gimmicks)).

:shotdamage=1:state=10

:state=1,plrcanbeseen,plrdistwithin=500:state=10

:state=10:waypointstop,animate=1,rotatetoplr,sound=audiobank\...\alarm.wav,state=11

:state=11:settarget=guard1,activatetarget
:state=11:settarget=guard2,activatetarget,state=12


(2 lines because you can only setup 1 target per line)

now you have to think of what happens when it triggers the alarm, you havent said that, so it will stand there and do nothing for this time.

:state=12:state=13

put this together:



doesnt look that bad and should work. now you just have to setup what happens when alarm is triggered (state=13...) and add some gimmicks around this (rotatehead random, sounds, animations etc.).

also you have to setup 2 guards named guard1 & guard2 to get triggered and look for the filepath for the alarmsound.

hope it works.

gz

Runihadacow
12
Years of Service
User Offline
Joined: 17th May 2012
Location:
Posted: 9th Jun 2012 02:08
So lets see I added the end result to it and it should work as follows.

Gaurd walks along waypoints until it spots the player or gets shot at. Once this happens it then Activates the used script. (set to turn on light and spawn things) In other words it is a walking version of a trigger zone.




Look about right?
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 9th Jun 2012 11:23
Quote: "In other words it is a walking version of a trigger zone."


socalled alarmbot, right.

Quote: "Look about right?"


right. activatetarget=guard1&2 activates the troops, your ":state=13:activateifused=1" may trigger another guard, light, door, whatever.

you can also build in a routine to follow the player constantly, or waiting 10 seconds and then return to waypointfollow etc., using state=13 and up.

have you test it?

Runihadacow
12
Years of Service
User Offline
Joined: 17th May 2012
Location:
Posted: 9th Jun 2012 16:36
Yes and in turn I plan on releasing them once I have all the kinks out. I will produce a pack with a waypoint bot, Bot that turns angle of view, Stationary, Gun (shoots at you), And a grenade one. Is there anything else that you think might help some people out? (P.s. I plan on adding the sound files as well)
Dark_Scorpion
12
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 13th Jun 2012 17:38
Where do you place this script? In a trigger zone or in the AI for the NPC? I tried using this script and it isn't working for me. This is what I did:

I created two rooms that are connected via a door. In one room, I placed the "Adam character." In his AI main, I gave him the alarmbot.fpi script. I also placed a waypoint for Adam to follow. In the adjoining room, I created a Swat character, and I set the "if used" for the Adamn AI to spawn the Swat character if the player is seen. The swat character is set to "no" for spawn at start and is set to spawn after a delay.

However, when I run a test, Adam just stands there. He doesn't follow his waypoint at all, and when you stand in front of him, and then go into the adjoining room, the Swat character is not spawning. What am I doing wrong?

Login to post a reply

Server time is: 2024-11-24 00:59:10
Your offset time is: 2024-11-24 00:59:10