Hi,
I've been trying to get the following DAI script to work for an enemy within a level of mine:
;Generic Enemy AI modified from DAI shoot and melee for Smash FPS
desc = Generic Enemy DAI
;debug-----------
:state=0:fpgcrawtextsize=22,fpgcrawtextfont=verdana,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80
:state=0:state=1
;state=1:fpgcrawtext=Where are you?
:state=10:fpgcrawtext=I see you!
:state=20:fpgcrawtext=Come closer.
:state=30:fpgcrawtext=Gotyer!
;//Start
;//Dark AI Animations----------------------------------------------------------------------------------------------------
;Walking animations
:ducking=0,strafingleft=1:animationnormal,animate=3
:ducking=0,strafingright=1:animationnormal,animate=4
:ducking=0,movingforwards=1:animationnormal,animate=2
:ducking=0,runningforwards=1:animationnormal,animate=5
:ducking=0,movingbackwards=1:animationreverse,animate=2
:ducking=0,idle=1:animate=1
;Crouching Animations
:ducking=1,movingforwards=1:animate=32
:ducking=1,movingbackwards=1:animationreverse
:ducking=1,strafingleft=1:animate=32
:ducking=1,movingbackwards=1:animate=32
:ducking=1,idle=1:animate=31
;fighting animations
:aiaction=7:animationnormal,animate=6
;//Common behavior triggers---------------------------------------------------------------------------------
;always face player
;if player can be seen move to player
;if player within 70 units hit player
:state=1,aihastarget=1:airotatetotarget
:state=1,aihastarget=0,plrcanbeseen=45:aisettarget
:state=1,plrcanbeseen=45:state=10,aiattackawareness=1
:state=1,plrcannotbeseen=45:rotatetoplr,aimoverandom
; Player in view
:state=10,aitargetdistfurther=25:state=20
:state=10,aitargetdistwithin=50:state=30
;Player too far away to hit - move closer
:state=20:aimovetotarget,state=1,aifollowplr=1
;Player close enough to hit - hit them!
:state=30:setaiactive=0,state=31,setframe=8,aiaction=7
:state=31:incframe=8,airotatetotarget
:state=31,framebeyond=8 60,aitargetdistwithin=51:aisetmeleedamage=10,aiusemelee=1,state=32,sound=audiobank\misc\melee.wav
:state=32,frameatend=8:animate=1,state=1,setaiactive=1,airotatetotarget
;//End
The script is attached to an unarmed enemy. The enemy is spawned by a trigger zone and once spawned creates 15 copies of itself to attack the player.
However, the enemy, once spawned, never moves and looking at the debug data never gets passed state=1 even when I stand right up close to it.
I can't figure out why? Is DAI limited to work only with individual enemies?
Interestingly I can get the enemy to move and attack if I use non-DAI script commands:
;Generic Enemy AI for Smash FPS
desc = Generic Enemy AI
;debug-----------
:state=0:fpgcrawtextsize=22,fpgcrawtextfont=verdana,fpgcrawtextr=255,fpgcrawtextg=0,fpgcrawtextb=0,fpgcrawtextx=50,fpgcrawtexty=80
:state=0:state=1
;state=1:fpgcrawtext=Where are you?
;state=10:fpgcrawtext=Move to middle.
;state=20:fpgcrawtext=Move to player.
;state=30:fpgcrawtext=Hit player.
;//Start
;set target as middle of arena
:state=1,varequal=ActiveZone 1:settargetname=Arena01,state=10,etimerstart
;move to middle of room
:state=10:rotatetotarget,runfore=10,animate=5
:state=10,plrcanbeseen:settarget,state=20,etimerstart
:state=10,reachtarget:state=20,etimerstart
:state=10,etimergreater=3000:state=20,etimerstart
;face player and move towards
:state=20:rotatetoplr
:state=20,plrdistfurther=200,plrcanbeseen:runfore=10,animate=5
:state=20,plrdistwithin=201,plrcanbeseen:movefore=5,animate=2
:state=20,plrdistwithin=50,plrcanbeseen:freeze,state=30
:state=20,plrcannotbeseen,etimergreater=5000:state=1
;Player close enough to hit - hit them!
:state=30:freeze,state=31,setframe=8
:state=31:incframe=8,rotatetoplr
:state=31,framebeyond=8 60,plrdistwithin=50:state=32,sound=audiobank\misc\melee.wav
:state=32,frameatend=8:animate=1,state=20,plrsubhealth=10,rotatetoplr
;//End
The non-DAI code work fine for what I want, but I like DAI and I'd like to understand why its not working.
For info - I'm running v118 B9 (no mods)
[url="http://raptr.com/No_Turn_Right?src=em_forum"]
[/url]