Amon_PRC8/_removed/hench/x0_ch_hen_percep.nss

52 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 19:00:46 -04:00
//:://////////////////////////////////////////////////
//:: X0_CH_HEN_PERCEP
/*
OnPerception event handler for henchmen/associates.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 01/05/2003
//:://////////////////////////////////////////////////
#include "X0_INC_HENAI"
void main()
{
// Don't do anything if we have have been recently commanded
if (GetLocalInt(OBJECT_SELF, "bmc_active"))
{
return;
}
// * if henchman is dying and Player disappears
// * then force a respawn of the henchman
if (GetIsHenchmanDying(OBJECT_SELF) == TRUE)
{ //SpawnScriptDebugger();
// * the henchman must be removed otherwise their corpse will follow
// * the player
object oOldMaster = GetMaster();
object oPC = GetLastPerceived();
int bVanish = GetLastPerceptionVanished();
if (GetIsObjectValid(oPC) && bVanish == TRUE)
{
if (oPC == oOldMaster)
{
RemoveHenchman(oPC, OBJECT_SELF);
// * only in chapter 1
if (GetTag(GetModule()) == "x0_module1")
{
SetCommandable(TRUE);
DoRespawn(oPC, OBJECT_SELF); // * should teleport henchman back
}
}
}
}
ExecuteScript("nw_ch_ac2", OBJECT_SELF);
}