I haven't looked yet at your second script, but I looked at the first one. And there were ISSUES with it:
1. You have to pay attention to when things happen in your script. For example, in state=1 you are first checking for plrdistwithin=380, and then the next line is plrdistwithin=90. When the engine runs through the code, it is going to hit the first line (plrdistwithin=380) first, and execute that code. It will NEVER get to executing plrdistwithin=90 as 90 is within 380. These 2 lines need to be swapped so that 90 is first.
2. Although the engine won't tell you this, you really shouldn't have comments at the end of a line. Ply pointed this out, but it is not only good scripting. It makes it easier for you (or anyone else) to read the code.
3. Some of your code makes no sense as to why you have it that way. For example, the first line checks the state, and then sets animate=2, and then moves to state 1. Why? Just use ::animate=2. Then you don't have to worry about moving to state 1 right away, and the engine will always make sure that you are starting in animate=2.
4. Not necessarily an engine issue, but you really should increment your state numbers 1 at a time. Why do you go from state 1 to state 5 to state 8? Why not 0, 1, 2, etc.?
Here is what I came up with for your code for # 1. I expect to be paid handsomely in models for this.
;Artifical Intelligence
desc = Goblin3
;Triggers
::animate=2
:state=0,plrdistfurther=380:rotatetoplr,animate=1
:state=0,plrdistwithin=90:animate=95,setframe=95,state=1
:state=0,plrdistwithin=380:rotatetoplr,movefore=10
;Attack Sequence
:state=1:incframe=95,rotatetoplr
:state=1,framebeyond=95 16:plraddhealth=-9,state=2,sound=gamecore\guns\cartoonpack\punch\punch.wav
:state=1,plrdistfurther=90:rotatetoplr,setframe=2,animate=2
:state=1,frameatend=95:state=2
:state=2:incframe=95,rotatetoplr
:state=2,frameatend=95:state=1
:state=2:setframe=2,animate=2,state=1