Talk:GetIsInSubArea
From NWN Lexicon
[edit] Description Section Misleading
the Description section of this function is misleading. it does indeed appear to return TRUE if oCreature in in the area of a trigger and FALSE when the PC has exited. I tested this with some triggers each containing onEnter and onExit scripts. Try it for yourself.
ENTER SCRIPT:
void main() { object oPC = GetEnteringObject(); string sLastArea = GetLocalString(oPC, "TEST_TRIGGER_LAST"); int bLast = GetIsInSubArea(oPC, GetObjectByTag(sLastArea)); SendMessageToPC(oPC, "ENTER("+GetTag(OBJECT_SELF)+") LAST("+sLastArea+") IN_LAST("+IntToString(bLast)+")"); }
EXIT SCRIPT:
void main() { object oPC = GetExitingObject(); string sLastArea = GetTag(OBJECT_SELF); SetLocalString(oPC, "TEST_TRIGGER_LAST", sLastArea); int bLast = GetIsInSubArea(oPC, OBJECT_SELF); SendMessageToPC(oPC, "EXIT("+sLastArea+") IN_SUBAREA("+IntToString(bLast)+")"); }