Difference between revisions of "OnItemRemoved - ObjectReference"

Jump to navigation Jump to search
m
→‎Notes: Tips for RemoveAllItems.
imported>DavidJCobb
m (→‎Notes: Added the trick to cancel events.)
imported>DavidJCobb
m (→‎Notes: Tips for RemoveAllItems.)
Line 35: Line 35:
**If something calls [[RemoveAllItems - ObjectReference|RemoveAllItems]] and you don't use an inventory event filter, then for every type of item removed from the object's inventory, one call to your OnItemRemoved event handler will be queued. If the player is holding a wide variety of items, then Skyrim will queue up more calls than it can even keep track of, causing an instant stack dump. This may negatively impact your own script as well as other scripts written by other people.
**If something calls [[RemoveAllItems - ObjectReference|RemoveAllItems]] and you don't use an inventory event filter, then for every type of item removed from the object's inventory, one call to your OnItemRemoved event handler will be queued. If the player is holding a wide variety of items, then Skyrim will queue up more calls than it can even keep track of, causing an instant stack dump. This may negatively impact your own script as well as other scripts written by other people.
***The "Diplomatic Immunity" quest is a good testcase for this; getting thrown in jail may also work.
***The "Diplomatic Immunity" quest is a good testcase for this; getting thrown in jail may also work.
***You can detect RemoveAllItems calls by making sure that the player always has a weightless non-playable item on their person, and using an inventory event filter to listen for that item's removal. Under that circumstance, only a removal of all items will ever cause your OnItemRemoved handler to fire.
****Do remember that you can point multiple aliases at the player, and each alias can have its own inventory event filters. This allows you to filter OnItemAdded and OnItemRemoved differently.
*If the item is consumed by any means (crafting, charging, poisoning, eat/drink) the dest parameter is None and most likely, but not always, the reference is None too.
*If the item is consumed by any means (crafting, charging, poisoning, eat/drink) the dest parameter is None and most likely, but not always, the reference is None too.
* If player uses a poison to apply it to a weapon the event is fired twice: before and after the confirmation dialogue. If canceled in the confirmation dialogue then is not fired twice.
* If player uses a poison to apply it to a weapon the event is fired twice: before and after the confirmation dialogue. If canceled in the confirmation dialogue then is not fired twice.
Anonymous user

Navigation menu