OnPlayerEquipItem
The script attached to this event fires whenever a PC equips an item. It can be useful in restricting the use of an item in certain areas, for example.
Trigger
PC equips an item (after the item has been successfully equipped).
Function(s)
- GetPCItemLastEquipped() returns the item being equipped.
- GetPCItemLastEquippedBy() returns the PC equipping the item.
- GetPCItemLastEquippedSlot() returns the slot the PC equipped the item to.
Remarks
With Hordes of the Underdark, BioWare has introduced a generic tag based system covering all of the module related item events. View the scripts x2_mod_def_equ, x2_mod_def_unequ, x2_mod_def_unaqu, x2_mod_def_aqu, x2_mod_def_act, and IN PARTICULAR, x2_it_example for more information if you wish to use the BioWare way of doing it. It is unknown by the Lexicon's authors, at this time, if the system is available on non-Hordes of the Underdark installations.
Player Login Order
Important mainly for multiplayer servers, the order of events of a player entering is:
- OnAcquireItem for each item in the inventory (including those equipped)
- OnPlayerEquipItem for any item is equipped
- (Repeat 1 for each item in inventory)
- OnClientEnter
- Removal of expired effects, eg will run EffectRunScript sOnRemovedScript script
- OnEnter (of the area they're put into then any triggers/traps they are on top of)
Known Bugs
On the first login after module start the object references returned by GetModuleItemAcquiredBy and GetPCItemLastEquippedBy are correct. On subsequent logins on the same module session, the object references returned by the aforementioned functions will be OBJECT_INVALID.
To work around this use GetItemPossessor on the item relevant to the event. This has been reported in detail here.
See Also
GetPCItemLastEquippedBy() , GetPCItemLastEquipped()