Talk:OnItemRemoved - ObjectReference

From the CreationKit Wiki
Jump to navigation Jump to search

akItemReference parameter has incomplete documentation[edit source]

I made some extensive testing regarding this and it seems that the parameter is not None if player drops a non-persistent item into the world and it is None if the player uses a persistent item in crafting.

Testing method: have the event on a player alias and print a notification from the event, decided if an item is persistent or not by what I knew about my items and also from the printed message when moving the item to a container (only in this case the description with persistence seems correct). Results: if it was NOT None when transferred it was None when used in crafting. If it was None when transferred it was NOT None when dropped, also in this case the printed references where mostly consecutive numbers proving they were generated at that moment. Not tested: behavior when using scripted dropObject()

Because of this a reliable method to determine if an item was used to craft something or dropped would be: (!akItemReference && !akDestContainer) means crafting, dropped or transferred otherwise. Also valid for soul gems and behaving like crafting when charging items with them.

The main page not only needs additions but the information there is also wrong. I will update it in a couple of days if no objections are made here on the talk page. If this was already known please point me to relevant links so I can check it what I got is correct and complete. LukeH (talk) 2013-04-01T02:57:02 (EDT)

The method seems unreliable for other consume methods like poisoning weapons and consuming. Testing details here: http://forums.bethsoft.com/topic/1452786-onitemremoved-question/ LukeH (talk) 2013-04-03T08:37:39 (EDT)