Difference between revisions of "OnItemRemoved - ObjectReference"

Jump to navigation Jump to search
m
→‎Notes: Added the trick to cancel events.
imported>DavidJCobb
(→‎Notes: I just tested Diplomatic Immunity with a mod that makes this mistake. On my normal savegame, carrying my usual amount of items, that mod caused stack dumping, generating at least 118 stacks (those were the ones that got dumped). So yeah.)
imported>DavidJCobb
m (→‎Notes: Added the trick to cancel events.)
Line 37: Line 37:
*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.
*If you need to temporarily stop OnItemAdded and OnItemRemoved calls from being queued, you can use AddInventoryEventFilter with an empty FormList as an argument. To resume listening for item additions and removals, you can call [[RemoveAllInventoryEventFilters - ObjectReference|RemoveAllInventoryEventFilters]].
**This trick stops OnItemRemoved calls from ''being queued.'' It doesn't prevent the execution of function calls that have already been queued. To wit, using this trick from inside of OnItemRemoved won't stop Skyrim from dumping stacks when something calls RemoveAllItems(), because the first OnItemRemoved call only executes after the other hundred or so have been queued. You'd have to stop listening to inventory events before the item removals ever take place.


== See Also ==
== See Also ==
Anonymous user

Navigation menu