hope this helps, in the first script i have the enemy come within 301 units and then start shooting, and semi randomly strafes around... i would use this type of AI in a small room
;Artificial Intelligence Script
;Header
desc = small room enemy script
;Triggers
:state=0:state=1
:losetarget=10:runfpidefault=1
:state=0:runfpidefault=1
:state=1,plringunsight:settarget
:state=1,plrdistfurther=300:movetotarget,animate=5
:state=1,plrdistfurther=300,shotdamage=1:freez,animate=1
:state=1,plrdistwithin=301:rotatetoplr
:state=1,ifweapon=1,plrdistwithin=301,plrcanbeseen=46,rateoffire:animate=1,rotatetoplr,freeze,useweapon,rundecal=6
:state=1,ifweapon=0:animate=1,freeze,state=7,setframe=6
:state=7:incframe=6
:state=7,frameatend=6:state=1,reloadweapon,sound=audiobankgunsreload.wav
:state=1,plrdistwithin=301,random=20:state=2
:state=1,plrdistwithin=301,random=40:state=4
:state=2:strafe=90,animate=4,rotatetoplr,state=3
:state=3:strafe=90,animate=4,rotatetoplr,useweapon,rundecal=6,state=1
:state=4:strafe=-90,animate=3,rotatetoplr,state=5
:state=5:strafe=-90,animate=3,rotatetoplr,state=6
:state=6:strafe=-90,animate=3,rotatetoplr,state=1
now in this next bit of code the enemy will try to get within the default range of 101 and then do some kinda random strafes and stuff
;Artificial Intelligence Script
;Header
desc = small hall enemy script
;Triggers
:state=0:state=1
:losetarget=10:runfpidefault=1
:state=0:runfpidefault=1
:state=1,plringunsight:settarget
:state=1,plrdistfurther=100:followplr,animate=5
:state=1,plrdistfurther=100,shotdamage=1:freez,animate=1
:state=1,plrdistwithin=101:rotatetoplr
:state=1,ifweapon=1,plrdistwithin=301,plrcanbeseen=46,rateoffire:animate=1,rotatetoplr,freeze,useweapon,rundecal=6
:state=1,ifweapon=0:animate=1,freeze,state=7,setframe=6
:state=7:incframe=6
:state=7,frameatend=6:state=1,reloadweapon,sound=audiobankgunsreload.wav
:state=1,plrdistwithin=101,random=20:state=2
:state=1,plrdistwithin=101,random=40:state=4
:state=2:strafe=-180,animate=4,rotatetoplr,state=3
:state=3:strafe=90,animate=4,rotatetoplr,useweapon,rundecal=6,state=1
:state=4:strafe=180,animate=3,rotatetoplr,state=5
:state=5:strafe=-90,animate=3,rotatetoplr,state=6
:state=6:strafe=-180,animate=3,rotatetoplr,state=1