NOTICE: I am NOT a scripting genius, but I'm learning - and I wrote a script a while back which did exactly what you're wanting your script to do, so here's my advice...
I think your problem may be the fact that you're using the "shootplr" command, which calls the entity's shooting script. It might be easier for you to break this up into 2 scripts - one for the main AI, and the other for the shooting AI.
Here's a script that I wrote a while ago -- the entity follows a waypoint until it sees the player in its field of vision. Then, it calls the entity's shooting script with "shootplr".
; AI Script by MandoAndy
desc = Follows waypoint until entity sees player
:waypointstate=0:waypointstart,animate=52
:waypointstate=3:waypointnext,animate=52
:waypointstate=4:waypointrandom,animate=52
:waypointstate=5:waypointreverse,animate=52
:state=0,plrcanbeseen:state=1
:state=1:rotatetoplr,waypointstop,animate=51,shootplr,state=2
;end
This code worked fine for me. Let me know if it works for you! Remember to keep the default script separate from your shooting script, and you should be fine.