Technical / Scripting Items

BETA, not complete. If anyone needs more event types or hooks than are present here in order to script something, please let Ronan know in this thread: http://www.alandfaraway.org/phpBB2/viewtopic.php?t=33246

Naming All item scripts take the following form: i_<ITEM TAG>_<SCRIPT_TYPE> Where <ITEM TAG> is of course the tag of the item. If the tag exceeds 27 characters in length, the end of it will be truncated for the purposes of running an item script. This naming convention is identical to the one used by OE in NWN2, and is the standard naming convention for NWN2 item scripts.

Scripting The ACR extends the base item scripts that shipped with NWN2, and adds a few more. Both OE's and the ACR's are listed here.

  • OnClientLeave: The event that fires when a PC leaves the module carrying the item.
  • Script called: i_<ITEM_TAG>_cl
  • Called from event: Module On Client Leave
  • OBJECT_SELF: The module
  • OnActivated: The event that fires when an item's unique power is activated.
  • Script called: i_<ITEM_TAG>_ac
  • Called from event: Module On Item Activated.
  • OBJECT_SELF: The module
  • OnPlayerEquip: The event that fires when an item is equiped by a PC, or when a PC enters a module with the item equiped. It also fires when a creature is spawned with the item equiped.
  • Script called: i_<ITEM_TAG>_eq
  • Called from event: Module On Equiped.
  • OBJECT_SELF: The module
  • OnPlayerUnequip: The event that fires when an item is unequiped by a PC.
  • Script called: i_<ITEM_TAG>_ue
  • Called from event: Module On Unequiped.
  • OBJECT_SELF: The module
  • OnSpellCastAt: The event fired when a spell is cast at an item.
  • Script called: i_<ITEM_TAG>_ca
  • Called from event: Module spellhook (in other words, a spell cast script).
  • OBJECT_SELF: The spell caster
  • OnSpellCastFrom: The event fired when a spell is cast from an item.
  • Script called: i_<ITEM_TAG>_cf
  • Called from event: Module spellhook (in other words, a spell cast script).
  • OBJECT_SELF: The spell caster
  • OnAcquired: The event fired when a PC or NPC gains an item. This event is also called on each item in a PC's inventory when that PC enters the module.
  • Script called: i_<ITEM_TAG>_aq
  • Called from event: OnItemAcquired
  • OBJECT_SELF: The module
  • OnUnacquired: The event fired when a PC or NPC loses an item.
  • Script called: i_<ITEM_TAG>_ua
  • Called from event: OnItemUnacquired
  • OBJECT_SELF: The module

(Many more to come...)