EquipItem
Revision as of 20:41, 28 May 2008 by imported>Quetzilla
Syntax:
[ActorID.]EquipItem ObjectID NoUnequipFlag
Example:
EquipItem FavoriteCuirass player.EquipItem CursedHelm 1
Forces the actor to equip the item. If NoUnequipFlag = 1, actor (including the player) will be unable to unequip the item. Once the item is unequipped with the UnequipItem function, the item can be equipped and unequipped as normal.
Notes
- This function does not always work when used to equip items which have been added to an inventory using addItem, unless you provide a delay between adding the items and equipping them. For instance:
addItem someItem 1 equipItem someItem 1 ; <- item may not be equipped short equipDelay if ( equipDelay == 0 ) addItem someItem 1 set equipDelay to 1 elseif ( equipDelay < 10 ) ; wait 10 frames set equipDelay to equipDelay + 1 elseif ( equipDelay > 0 ) equipItem someItem ; <- should work properly now set equipDelay to -1 ; finished endif
- By default, using this function on the player will display a message informing the player that the item in question has been equipped. In many situations, this is very annoying, but you can use a pair of blank Message calls to prevent it from happening, like so:
Message " " Message " " player.EquipItem "item ID"
- This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds, so please use it only if you are sure no other messages will be disrupted, or you would create a lot of message spam otherwise.
- OBSE 0015 provides EquipItemNS which works exactly the same as EquipItem but without displaying any messages.
- BUG :
- If you equip a playable item with the NoUnequipFlag set to 1 on a NPC, a subsequent call of RemoveAllItems on this NPC will crash the game.
- If you equip a playable non-quest item with the NoUnequipFlag set to 1 on the player, a subsequent call of RemoveAllItems on the player will crash the game.