Your code is horrible.

if (event_type =EVENT_SCAN) --> is always true.
if (event_type ==EVENT_SCAN) --> and set this in a event function.

In your action enemy_act you have a switch (my.state), if it is 2 you call the function state_attack() and here you check my.status again? And also the while(1) is not the best solution.

In your action you call state_attack always if my.state = 2 and the while(1) loop never ends, so every frame starts one more of your function state_attack.