GetItemInSlot
From NWN Lexicon
Contents |
[edit] GetItemInSlot(int, object)
Retrieve the item in a given inventory slot of a creature.
object GetItemInSlot( int nInventorySlot, object oCreature = OBJECT_SELF );
[edit] Parameters
nInventorySlot
oCreature
Target creature. (Default: OBJECT_SELF)
[edit] Description
Returns the object which is in oCreature's specified inventory slot (nInventorySlot).
Returns OBJECT_INVALID if oCreature is not a valid creature or there is no item in nInventorySlot.
[edit] Remarks
Remember that the INVENTORY_SLOT_* constants are actually integers from 0 to 17 (or, if Bioware ever decides to add more slots, 0 to NUM_INVENTORY_SLOTS - 1). Thus, you can create a for loop to cycle through somebody's equipped items. See codesample.
[edit] Version
1.32
[edit] Example
//Strip entering player to the bone void main() { object oPC=GetEnteringObject(); if (!GetIsPC(oPC)) return; object oItem; int nSlot; for (nSlot=0; nSlot<NUM_INVENTORY_SLOTS; nSlot++) { oItem=GetItemInSlot(nSlot, oPC); //unequip if valid if (GetIsObjectValid(oItem)) AssignCommand(oPC, ActionUnequipItem(oItem)); } }
[edit] See Also
functions: | |
constants: |
author: Jason Harris, editor: Lilac Soul, additional contributor(s): Lilac Soul