LoD_PRC8/_module/nss/hal_attacknearpc.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

48 lines
1.3 KiB
Plaintext

#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));
}