Difference between revisions of "RemoveItem"
Jump to navigation
Jump to search
OBSE 0015 provides RemoveItemNS which works exactly the same as RemoveItem but without displaying any messages.
When you remove an item while the player's inventory menu (MenuMode 1002) is open, the item will remain visible even though it's really not there. To refresh the menu after removing the item, use
When you remove a large number of unique items from the player while their inventory menu is open, there may be some lag. You can prevent this with OBSE's con_ToggleMenus by placing it on both sides of the remove lines:
imported>Quetzilla |
imported>Quetzilla m |
||
Line 33: | Line 33: | ||
*This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds. [[Avoiding Message Spam|Here]] are some alternative methods that don't disrupt other messages. | *This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds. [[Avoiding Message Spam|Here]] are some alternative methods that don't disrupt other messages. | ||
<li>OBSE 0015 provides [[RemoveItemNS]] which works | <li>OBSE 0015 provides [[RemoveItemNS]] which works exactly the same as RemoveItem but without displaying any messages.</li> | ||
<li>When you remove an item while the player's inventory menu ([[MenuMode]] 1002) is open, the item will remain visible even though it's really not there. To refresh the menu after removing the item, use</li> | <li>When you remove an item while the player's inventory menu ([[MenuMode]] 1002) is open, the item will remain visible even though it's really not there. To refresh the menu after removing the item, use</li> |
Revision as of 19:38, 28 May 2008
Removes count number of the specified item from the calling object's inventory.
Syntax:
RemoveItem ObjectID, count
Examples:
RemoveItem Gold001 50
Ref MyItem Short count set MyItem to ArenaAkaviriLongSword set count to 1 player.removeitem MyItem Count
Notes
- You can use a reference variable as ObjectID and a short variable for count.
- If ObjectID is a leveled list, the leveled item generated from the leveled list will be removed.
- Removing an equipped item may cause a CTD. Use GetEquipped to find out if the item is equipped, and, if so, use UnequipItem before removing it.
- By default, using this function on the player will display a message informing the player that the item in question has been removed. 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.RemoveItem "item ID" 1
- This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds. Here are some alternative methods that don't disrupt other messages.
player.AddItem YourMiscItem 1 player.EquipItem YourMiscItem player.UnEquipItem YourMiscItem player.RemoveItem YourMiscItem 1
- If the menu has been hidden with con_ToggleMenus (either via script or console) this will not work.
con_ToggleMenus player.RemoveItem SomeItem001 1 ... player.RemoveItem SomeItem100 1 con_ToggleMenus ;Refresh the menu player.AddItem YourMiscItem 1 player.EquipItem YourMiscItem player.UnEquipItem YourMiscItem player.RemoveItem YourMiscItem 1