EN4_PRC8/_module/nss/rp1_fleetrig.nss
Jaysyn904 b464d8da05 Initial Commit
Initial Commit [v1.32PRC8]
2025-04-03 13:38:45 -04:00

40 lines
1.1 KiB
Plaintext

#include "prc_inc_racial"
void main()
{
object oCreature;
object oGuard;
location lLoc;
string sTag;
int iRace;
int iFlag;
oCreature = GetEnteringObject();
//Use GetIsEnemy to tell them to flee
if (!GetIsPC(oCreature) && !GetIsPC(GetMaster(oCreature)) && GetLocalInt(oCreature,"Flee") == 0)
{
SetLocalInt(oCreature,"Flee",1);
iFlag = 0;
iRace = MyPRCGetRacialType(oCreature);
if (iRace == RACIAL_TYPE_ANIMAL || iRace == RACIAL_TYPE_BEAST || iRace == RACIAL_TYPE_UNDEAD || iRace == RACIAL_TYPE_VERMIN || iRace == RACIAL_TYPE_OOZE || iRace ==RACIAL_TYPE_CONSTRUCT)
iFlag = 1;
oGuard = GetObjectByTag("RP1_cguard1_S");
if (!GetIsObjectValid(oGuard))
oGuard = GetObjectByTag("RP1_cguard2_S");
if (!GetIsEnemy(oGuard,oCreature))
iFlag = 1;
if (iFlag == 0)
{
sTag = "RP1_FleeTo" + IntToString(Random(4)+1);
lLoc = GetLocation(GetObjectByTag(sTag));
DelayCommand(0.1f,AssignCommand(oCreature,ClearAllActions()));
DelayCommand(0.3f,AssignCommand(oCreature,ActionMoveToLocation(lLoc,TRUE)));
}
}
}