From NWN Lexicon
Revision as of 06:18, 24 June 2019 by Shadguy (talk | contribs) (Spelling fix(es))
Jump to: navigation, search


The script attached to this event fires when a certain area boundary has been violated allowing you to throw a custom event, update the PC's journal, or a variety of other things. Area of effects also can have On Enter events defined when they are created, for example an Acid Fog cloud in a spell.


Something has entered the area, encounter, trigger or area of effect (not necessarily a PC).


GetEnteringObject() returns the object that has entered the area, encounter, or trigger.


Area of effects can have a On Enter script to apply effects while in the effect. When the Area of Effect is removed, or runs out, it does fire its OnExit event for all creatures currently in it.


// notifies a monster tagged "HUNTER" that a PC has entered
// the area this script is attached to; also set a local variable
// that can be checked later to see if the PC went into an area
// to prevent an event from occurring again to the same PC
// (until another PC comes along and triggers this event that is).
// "HUNTER" can also use the object (oEntering) stored on the
// event to help track down the trespassing PC.
void main()
     object oEntering = GetEnteringObject();
     // make sure its a PC
     if (GetIsPC(oEntering))
          // prevent "HUNTER" from coming again
          if (!(GetLocalObject(OBJECT_SELF, "PC_Entered") == oEntering))
               object oMonster = GetObjectByTag("HUNTER");
               // set a local variable on the Area
               SetLocalObject(OBJECT_SELF, "PC_Entered", oEntering);
               // tell "HUNTER" to come and eat
               SignalEvent(oMonster, EventUserDefined(100));

See Also