Difference between revisions of "Talk:RemoveItem"

1,776 bytes added ,  17:32, 10 June 2008
RemoveItem Bug
imported>Haama
(Refresh and Lag notes)
imported>Nephele
(RemoveItem Bug)
Line 78: Line 78:


Finally, if you extend the '''con_ToggleMenus''' section to include the ''Refresh inventory menu'' section, it will no longer refresh the menu.--[[User:Haama|Haama]] 16:07, 23 January 2008 (EST)
Finally, if you extend the '''con_ToggleMenus''' section to include the ''Refresh inventory menu'' section, it will no longer refresh the menu.--[[User:Haama|Haama]] 16:07, 23 January 2008 (EST)
== RemoveItem Bug ==
Based upon gameplay reports, there appears to be a bug with RemoveItem.  I was wondering whether any modders could confirm this bug, and whether information about the bug belongs in the article.
The bug occurs if there are multiple stacks of the same item in an inventory.  For example, if the player inventory contains both 15 legitimate Minotaur Horns and 10 stolen Minotaur Horns, then the command:
:<code>Player.RemoveItem MinotaurHorn 20</code>
will attempt to remove all 20 minotaur horns from just '''one''' of the two stacks.  Even if that stack contains less than 20 horns, and even if the other stack contains the other horns necessary to reach 20.  Therefore, the player will end up with 15 legitimate horns ''or'' 10 stolen ones... instead of ending up with just 5 horns of one type or another.  On the other hand, commands such as GetItemCount (correctly) sum all of the different stacks.  So scripts for quests such as "Expelled from the Mages Guild" will check and see that the player has the 20 horns necessary for the quest -- but then won't actually remove all 20 horns.
This also happens with cases where items "invisibly" exist in multiple inventory slots.  For example, on NPCs gold may come from multiple sources (multiple leveled lists from original inventory list; a separate stack for gold added by additem commands).  Although only the total amount of gold is generally visible, "RemoveItem Gold001" will only empty the requested gold from one of the inventory slots, and therefore will not correctly reduce the NPC's available gold.
I'd guess it also happens with weapons/armor that have differing amounts of health, although I haven't seen specific examples of that. --[[User:Nephele|Nephele]] 18:32, 10 June 2008 (EDT)
Anonymous user