Here is my first script. I edited the script now. It should attack you now.
;Artificial Intelligence Script
;Header
desc =My first script. It is supposed to see and hit the player when it is quite far.
:state=0,plrcanbeseen:state=1
:state=1:rotatetoplr,waypointstop,animate=51,shootplr,state=2
:state=1:PLRDISTFURTHER=40,rotatetoplr,waypointstop, animate=51, shootplr, state= 1,
:state=0 reloadweapon, waypointstop, animate=6
:nearactivatable=0:settarget,activatetarget=2
:random=20:rotateheadrandom=65
:shotdamage=1:settarget,state=2
:state=2:rotatetotarget,rotatey=180,resethead,waypointstop,animate=5,state=3
:state=3:runfore=10
:state=3,random=5:rotateheadrandom=85
:state=3,losetarget=10:state=10
:state=3,plrcanbeseen:settarget,state=2
:state=10:timerstart,state=11,rotatey=180,animate=31
:state=11,timergreater=5000:state=0,animate=2,waypointstart
:state=11,random=5:rotateheadrandom=35
:state=0,plrdistwithin=300:state=1
:state=1,plrdistfurther=40:rotatetoplr,movefore=2,animate=2
:state=1,plrdistfurther=300:animate=1,state=0
:state=1,plrdistwithin=40,rateoffire:rotateplr,animate=92,plraddhealth=-10
;End of Script
I enjoy making games but I like searching for artifacts more.