This one is effective:-
Character follows a waypoint, if player seen, the character will shoot back. If the character has it's back to player and you shoot and hit it, the character will turn and shoot at the player.
If you move out of sight and also a small distance away, the character will follow the nearest waypoint. maybe add waypoints that link with each other to create a random movement for the character. I am sure it could have been done in less script commands but it works ok!
Add this as the main script:-
;Artificial Intelligence Script
;Header
desc = Pace Waypoints, If See Player, Rotate And Shoot. Otherwise, carry on
with waypoint.
;Triggers
:waypointstate=0:animate=2,waypointstart
:waypointstate=3:animate=2,waypointnext
:waypointstate=4:animate=2,waypointrandom
:waypointstate=5:animate=2,waypointreverse
:state=0:state=1
:state=1,plrcanbeseen:settarget,state=2
:state=1,shotdamage=1:settarget,animate=1,rotatetotarget,resethead,state=2
:state=2:rotatetoplr,state=3,shootplr
:state=3:animate=1,state=1
;End of Script
Add this as the shoot script:-
;Artificial Intelligence Script
;Header
desc = Look and Shoot Close To Player
;Triggers
:state=0,plrcanbeseen:state=1,settarget
:state=0:runfpidefault=1
:state=0,waypointstate=0:animate=2,waypointstart
:state=0,waypointstate=3:animate=2,waypointnext
:state=0,waypointstate=4:animate=2,waypointrandom
:state=0,waypointstate=5:animate=2,waypointreverse
:plrcannotbeseen,plrdistfurther=200:state=0,waypointstart,animate=2
:state=1:rotatetoplr
:state=1,plrcanbeseen:settarget
:state=1,ifweapon=1,plrdistfurther=100,plrelevwithin=10:movetotarget=1,animate=5
:state=1,plrdistwithin=101:rotatetoplr
:state=1,ifweapon=1,plrdistwithin=101,plrcanbeseen=46,rateoffire:animate=1,rotatetoplr,freeze,useweapon,rundecal=6
:state=1,ifweapon=0:animate=1,freeze,state=2,setframe=6
:state=1,plrdistwithin=200,random=50:state=5
:state=1,plrdistwithin=50:state=10
:state=1,losetarget=100:state=5
:state=2:incframe=6
:state=2,frameatend=6:state=1,reloadweapon,sound=audiobank\guns\reload.wav
:state=5,random=1:state=6,setframe=4
:state=5:state=7,setframe=3
:state=6:incframe=4,strafe=90,rotatetoplr
:state=6,frameatend=4:state=1,animate=1
:state=7:incframe=3,strafe=-90,rotatetoplr
:state=7,frameatend=3:state=1,animate=1
:state=10:state=11,setframe=5
:state=11:incframe=5,strafe=180,rotatetoplr
:state=11,frameatend=5:state=1,animate=1
:shotdamage=1:plrsound=audiobank\voices\hurt1.wav
;End of Script