Hello,
A while back Corno_1 and I began to collaborate on an AI script that had characters follow waypoints and attack one another, similar to how bots in games like Battlefield do.
Corno was generous enough to write up most of the script and I touched a bit of it up, but it still has some problems. Here's the script:
;Artificial Intelligence Script
;Header
desc = Pace Waypoints, If See Player, meele or shoot
;Triggers
;waypoints
:state=1,aicanshoot=0,waypointstate=0:animate=5,aisetspeed=200,waypointstart
:state=1,aicanshoot=0,waypointstate=3:animate=5,aisetspeed=200,waypointnext
:state=1,aicanshoot=0,waypointstate=4:animate=5,aisetspeed=200,waypointrandom
:state=1,aicanshoot=0,waypointstate=5:animate=5,aisetspeed=200,waypointreverse
:nearactivatable=0:settarget,activatetarget=2,animate=1,state=0
;see player and set target
:state=0:animate=1,state=1
:state=1,aicanshoot=1:aisetspeed=100,aisettarget,state=2
:state=1,shotdamage=1:aisetspeed=100,aisettarget,state=2
:state=1,aiheardsound=200:aisettarget,rotatetotarget
:state=1,random=20:rotateheadrandom=65
;meele or shoot script activate
:state=2,aihastarget=1,aitargetdistwithin=100:state=5
:state=2,aihastarget=1,aitargetdistfurther=100:state=3
:state=3:waypointstop,rotatetotarget,state=4
:state=4:animate=1,state=10
;meele animation
:state=5:aisettarget,airotatetotarget
:state=5,aitargetdistwithin=70,aicanshoot=1:state=6,aistop
:state=5,aitargetdistfurther=70:state=1
:state=5,aicanshoot=0:state=1
:state=6:setaiactive=0,state=7,setframe=8
:state=7:incframe=8,airotatetotarget
:state=7,framebeyond=8 60,aitargetdistwithin=70:aisetmeleedamage=10,aiusemelee=1,state=8,sound=audiobank\misc\melee.wav
:state=7,frameatend=8:animate=1,state=1,setaiactive=1,airotatetotarget
:state=8,frameatend=8:animate=1,state=1,setaiactive=1,airotatetotarget
;shoot
:state=10,aicanshoot=1:state=11,aisettarget
:state=11,aitargetdistwithin=100:state=1
:state=11:rotatetotarget
:state=11,ifweapon=1,aicanshoot=1:aisettarget,useweapon,rundecal=6,state=11
:state=11,ifweapon=0:state=12,setframe=6
:state=11,aicanshoot=0:state=1
:state=12:incframe=6
:state=12,frameatend=6:state=10,reloadweapon,sound=audiobank\guns\reload.wav
;End of Script
The problem is that the characters like to slide around a lot and they don't seem to follow their waypoints again after attacking/being attacked.
Here's a video showcasing the problem:
https://www.youtube.com/watch?v=XbBbOylYkbM
If anyone could lend a hand, that'd be greatly appreciated! I'm not a great scripter myself and Corno_1 was out of ideas.
Many thanks!!
-Winner of the X10 Revival Competition, Susysyay
"I'm havin' too good a time today, I ain't even thinkin' bout tomorrow."