Files
Anphillia_PRC8/_module/nss/ee_ent_onperc.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

46 lines
1.6 KiB
Plaintext

/************************************************************************
* script name : eE_ent_OnSpawn
* created by : eyesolated
* date : 2011/6/1
*
* description : OnPerceived script for entities (creatures/placeables) spawned
* using eyesolated Encounters.
*
* changes : 2011/6/1 - eyesolated - Initial creation
************************************************************************/
#include "ee_inc"
void main()
{
// Retrieve necessary eE Variables for this creature
object oEncounter = eE_GetEntityEncounter(OBJECT_SELF);
object oPerceived = GetLastPerceived();
// if the encounter object is invalid or
// if the perceived object is not a PC able to activate the encounter,
// execute the default script and exit immediately
if (
!GetIsObjectValid(oEncounter) ||
!GetIsPC(oPerceived) ||
GetIsDM(oPerceived)
)
{
if (eE_SCRIPT_CREATURE_ONPERCEPTION != "")
ExecuteScript(eE_SCRIPT_CREATURE_ONPERCEPTION, OBJECT_SELF);
else
ExecuteScript(GetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONPERCEPTION), OBJECT_SELF);
return;
}
// Activate the encounter if it is Initialized
if (eE_GetEncounterStatus(oEncounter) == eE_ENCOUNTER_STATUS_INITIALIZED)
{
ExecuteScript(eE_SCRIPT_ENCOUNTER_START, oEncounter);
}
// Now execute the standard NWN thingie if this is a creature
if (GetObjectType(OBJECT_SELF) == OBJECT_TYPE_CREATURE)
{
ExecuteScript(GetLocalString(OBJECT_SELF, eE_VAR_ENTITY_AI_ONPERCEPTION), OBJECT_SELF);
}
}