Difference between revisions of "RemoveItem - ObjectReference"
Added note about how this function does not work on items inside containers that have not had their contents yet loaded by the game. Included a workaround solution.
imported>B1gBadDaddy m (added notes to script) |
imported>IsharaMeradin (Added note about how this function does not work on items inside containers that have not had their contents yet loaded by the game. Included a workaround solution.) |
||
Line 61: | Line 61: | ||
*The function seems to have a preference for equipped items. Or if not equipped items then the first instance of the item that's in inventory (which is the same thing, since when you equip something, it's the first instance of the object in the inventory). | *The function seems to have a preference for equipped items. Or if not equipped items then the first instance of the item that's in inventory (which is the same thing, since when you equip something, it's the first instance of the object in the inventory). | ||
*The akItemToAdd argument of [[AddItem - ObjectReference]] can be a LeveledItem. A LeveledItem as akItemToRemove, however, won't work and the members of the LeveledItem must be passed individually as akItemToRemove. | *The akItemToAdd argument of [[AddItem - ObjectReference]] can be a LeveledItem. A LeveledItem as akItemToRemove, however, won't work and the members of the LeveledItem must be passed individually as akItemToRemove. | ||
*This function does not work on items pre-placed inside containers until that container is opened and its contents are finally loaded by the game. | |||
**Solution for scenarios that need to remove such items: | |||
***Use [[RemoveAllItems - ObjectReference]] to transfer the entire container's contents to a separate container | |||
***Use the [[OnItemAdded - ObjectReference]] event on the second container to obtain the incoming items | |||
***Finally use [[RemoveItem - ObjectReference]] to send all but the unwanted item(s) back to the first container | |||
== See Also == | == See Also == |