Difference between revisions of "EquipItem"
no edit summary
imported>JOG |
imported>Scruggs |
||
Line 6: | Line 6: | ||
Forces the actor to equip the object. If NoUnequipFlag = 1, actor (including the player) will be unable to unequip the object. | Forces the actor to equip the object. If NoUnequipFlag = 1, actor (including the player) will be unable to unequip the object. | ||
==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: | |||
<pre>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</pre> | |||
==See Also== | ==See Also== |