Sleepping golems do not awake

Relevant script:
func void B_GolemRise()
{
if((Npc_GetDistToNpc(self,hero) <= 700) && (Mob_HasItems("NW_GOLEMCHEST",ItSe_Golemchest_Mis) == 0))
{
AI_PlayAni(self,"T_RISE");
self.noFocus = FALSE;
self.name[0] = "Steingolem";
self.flags = 0;
AI_StartState(self,ZS_MM_Attack,0,"");
self.bodyStateInterruptableOverride = FALSE;
self.start_aistate = ZS_MM_AllScheduler;
self.aivar[AIV_MM_RestStart] = OnlyRoutine;
};
};
The animation "T_RISE" has "S_DEAD" as followup what is quite confusing.
I used clearAiQueue in startState and set hnpc.senses=1 which made it work except the one frame dead animation. Interestingly AI_StartState(self,ZS_MM_Attack,0,""); doesn't do anything. Golem goes to normal state later and is then triggered by enemy perc. Vanilla has same behavior.
Another case where clearAiQueue helps is attacking wandering npc's in G1. Script wants to attack but it's blocked by some goto command.
partially fixed by fccda5bec4afede9d31d90889eec4c99e80fc2d6
now golem eventually wakes up, but 'T_RISE` plays several times instead of one
I used clearAiQueue in startState
Tested today on the golem - yes it works, ai-queue is no longer throttle. Still need to test much of the game, as change will affect all ai-scheduling :(
Tested - works well; committed at 11cb3d8c