HoS_PRC8/_mod/_module/nss/prison_attack_oe.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

41 lines
1.5 KiB
Plaintext

void fnCheckForDepart()
{
object oEnemy=GetNearestCreature(CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY,OBJECT_SELF,1,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN,CREATURE_TYPE_IS_ALIVE,TRUE);
if (GetIsObjectValid(oEnemy)) DelayCommand(30.0,fnCheckForDepart());
else { DestroyObject(OBJECT_SELF); }
}
void fnReserve(location lLoc,object oPC)
{
AssignCommand(OBJECT_SELF,ClearAllActions(TRUE));
AssignCommand(OBJECT_SELF,ActionMoveToLocation(lLoc,TRUE));
SetIsTemporaryEnemy(oPC,OBJECT_SELF,TRUE,240.0);
DelayCommand(90.0,fnCheckForDepart());
}
void main()
{
object oPC=GetEnteringObject();
object oMe=GetNearestObjectByTag("MUNICIPALPG",oPC,1);
object oAlly=GetNearestCreature(CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND,oMe,1,CREATURE_TYPE_IS_ALIVE,TRUE);
string sGuardRes="municipalguardre";
object oWP=GetNearestObjectByTag("BACKUP_GUARDS");
object oGuard;
int nN;
if (GetIsPC(oPC))
{ // PC
AssignCommand(oMe,SpeakString("GUARDS! SOMEONE IS ATTEMPTING TO FREE THE PRISONERS!!"));
SetIsTemporaryEnemy(oPC,oMe,TRUE,240.0);
if (GetIsObjectValid(oAlly)&&GetDistanceBetween(oMe,oAlly)<10.0) AssignCommand(oAlly,SetIsTemporaryEnemy(oPC,oAlly,TRUE,240.0));
nN=1;
while(nN<7&&GetIsObjectValid(oWP))
{ // create backup guards
oGuard=CreateObject(OBJECT_TYPE_CREATURE,sGuardRes,GetLocation(oWP));
DelayCommand(1.0,AssignCommand(oGuard,fnReserve(GetLocation(oMe),oPC)));
nN++;
} // create backup guards
} // PC
}