OnDisarm

From NWN Lexicon
Jump to: navigation, search

OnDisarm

The script attached to this event fires when a trap has been successfully disarmed. This could be used to award experience points or make it easier to discover other traps of similiar design.


Trigger

When a trap has been disarmed, always when it is disarmed and sometimes when you recover a trap (see Remarks, below).


Function(s)

GetLastDisarmed() returns the creature or PC object who disarmed the trap.


Known Bugs

When used with a trap placed on a door, the OnDisarm event fires both when you disable the trap, and when you recover the trap (in this case the OnDisarm event fires before player acquire the trap item). A standard trap (trigger on the floor) only fires when you disarm, not recover the trap.


Example

// awards the disarming creature/PC 1000 XP for successfully
// disarming a trap when this script it placed in the trap's 
// OnDisarm event
void main()
{
     object oPC = GetLastDisarmed();
     if (GetIsPC(oPC))
     {
          GiveXPToCreature(oPC, 1000);
     }
}

See Also

functions: 

GetLastDisarmed()