Difference between revisions of "EquipItem"

235 bytes added ,  16:02, 25 December 2011
Added a note on equipping armor on NPCs
imported>ZuTheSkunk
(Forcing actors into drinking the potions)
imported>QQuix
(Added a note on equipping armor on NPCs)
Line 9: Line 9:
== Notes ==
== Notes ==
* This '''''will not''''' run the [[onEquip]] block of a script attached to the item. However, an [[onUnequip]] block '''''will''''' run when the object is unequipped using [[UnequipItem]]. This means that scripted ability spells that are added and removed using these two block types can malfunction if the item is equipped and unequipped via script.
* This '''''will not''''' run the [[onEquip]] block of a script attached to the item. However, an [[onUnequip]] block '''''will''''' run when the object is unequipped using [[UnequipItem]]. This means that scripted ability spells that are added and removed using these two block types can malfunction if the item is equipped and unequipped via script.
<ul><li>EquipItem will not work if there is already an item in that slot that has been equipped with the NoUnequipFlag set. This can be useful for determining whether or not that flag has been set. Use [[UnequipItem]] or [[UnequipItemNS]] to remove such an item before using EquipItem.</li>
*EquipItem will not work if there is already an item in that slot that has been equipped with the NoUnequipFlag set. This can be useful for determining whether or not that flag has been set. Use [[UnequipItem]] or [[UnequipItemNS]] to remove such an item before using EquipItem.
<li>This function can be used to force actors into drinking the potions.</li>
*This function can be used to force actors into drinking the potions.</li>
<li>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:
*Using this function to equip an armor item on an NPC will not automatically unequip the replaced item, as it does on the player. E.g., if you add and equip 10 types of boots, all will report as equipped (but not added to the Armor Rating). This may or may not be fixed in following frames.
*See [[Message Spam]] to avoid unwanted "Item Equipped" messages.
*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:
<pre>addItem someItem 1
<pre>addItem someItem 1
equipItem someItem 1 ; <- item may not be equipped
equipItem someItem 1 ; <- item may not be equipped
Line 24: Line 26:
   equipItem someItem ; <- should work properly now
   equipItem someItem ; <- should work properly now
   set equipDelay to -1 ; finished
   set equipDelay to -1 ; finished
endif</pre></li>
endif</pre>
<li>See [[Message Spam]] to avoid unwanted "Item Equipped" messages.
*'''RemoveAllItems Bugs:'''
<li>'''RemoveAllItems Bugs:'''
:*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.
<ul><li>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.</li>
:*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.
<li>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.</li></ul></ul>


==See Also==
==See Also==
Anonymous user