I programmed an attack behavior for an enemy but for some reason I couldn't find yet, he goes through the intended loop a couple times and then stops working.
Each instance has a "timer" value, that is added to the actual timer once they enter in neutral state. Then, after the timer reaches zero, they attack. after finishing the spit animation, they enter in neutral state again, the timer is replenished and the loop starts over.
Or so I planned, as I said in the beginning, it successfully loops just one or two times before it stops working.
Here is the code.:
If anyone can help me with this, thanks in advance.