Hey everyone. Im fairly new to scripting and i was trying to make a script where when you attach it to an entity, if you are within such a distance it will play the sound file(0) but if you arent it wont. I know i did something wrong with this script. Well what do you guys think is wrong with it? Any help will be very much appreciated.
;Artifical Intelligence Script
;Header
desc = Within distance sound looping
;Triggers
:state=0,plrdistwithin=600:state=4
:state=1,frameatend=0:state=2
:state=2,plrdistfurther=600:state=3
:state=3,frameatstart=0:state=0
:state=4,plrcanbeseen:state=1,sound=$0
:state=4,plrcannotbeseen:state=0
;End of Script