#include "hal_wolf_inc" void main() { int bIsWerewolf = GetLocalInt(OBJECT_SELF, "is_werewolf"); int nWerewolfCycleCount = GetLocalInt(OBJECT_SELF, "werewolf_cycle"); if(!bIsWerewolf) { AssignCommand (OBJECT_SELF, SetCommandable(TRUE)); AssignCommand (OBJECT_SELF, ClearAllActions(TRUE)); RemoveWolf(OBJECT_SELF); return; } int bNearest = 1; object oThing = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, OBJECT_SELF, bNearest); while(oThing != OBJECT_INVALID) { if(GetPlotFlag(oThing) == TRUE) { oThing = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, OBJECT_SELF, ++bNearest); } else { AssignCommand (OBJECT_SELF, SetCommandable(TRUE)); AssignCommand (OBJECT_SELF, ClearAllActions(TRUE)); AssignCommand (OBJECT_SELF, ActionAttack(oThing)); AssignCommand (OBJECT_SELF, SetCommandable(FALSE)); break; } } if( nWerewolfCycleCount > 12 ) { SetLocalInt(OBJECT_SELF, "werewolf_cycle", 0); SetLocalInt(OBJECT_SELF, "is_werewolf", FALSE); } else { SetLocalInt(OBJECT_SELF, "werewolf_cycle", ++nWerewolfCycleCount); } DelayCommand(7.0f, ExecuteScript("hal_attacknearpc", OBJECT_SELF)); }