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:
;Artificial Intelligence Script
;Script Created by maho
;Header
desc = Alarmbot (basic)
;Triggers
: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
:shotdamage=1:state=10
:state=0:state=1
: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
:state=12:state=13
;End of Script
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