A concern about Objectreference...

Post » Mon Nov 19, 2012 7:47 am

Maybe it's only a lack of logic but... well^^:

Say we have an item with a baseform A
This item is dropped on the world that means it has now
-A baseform (A) (0000aaaa)
-An objectreference ( B ) (ff00bbbb)

In a script, I save B address somewhere. (ff00bbbb)

Lets pick Up this item (A) , which is now in my inventory
with my script, i know B, and I delete B, papyrus doesn't raise any error and the object A is still in my inventory

If I drop A somewhere, the object still have B as objectReference.

Lets pick Up this item (A) again , which is now in my inventory again.
now lets remove A (delete it)

Does B still somewhere, and should I care about it? will it be garbagecollected? will the reference be reassigned to another item later?
User avatar
Nina Mccormick
 
Posts: 3507
Joined: Mon Sep 18, 2006 5:38 pm

Post » Mon Nov 19, 2012 9:48 am

My guess is that the items Objectreference changes when it enters a container and becomes managed by the container. Which would explain why you can't call member functions on objects once they enter a container. But it is simply speculation. Why dont you make a test quest with a player alias and register for the OnItemAdded and OnItemRemoved events and see if the objectreference of the item is maintained during the transitions?
User avatar
Ilona Neumann
 
Posts: 3308
Joined: Sat Aug 19, 2006 3:30 am

Post » Mon Nov 19, 2012 3:18 am

My guess is that the items Objectreference changes when it enters a container and becomes managed by the container.
This, but with the exceptions of persistent ObjectReferences (REFR) and quests' ReferenceAliases. Even non-persistent ObjectReferences will temporarily retain their REFRs' FormIDs, but they'll not be remembered accross save game loads/game restarts. Ghostblade, [REFR:00094A2C] (places dunAnsilvundGhostblade "Ghostblade" [WEAP:00094A2B] in GRUP Cell Persistent Children of Ansilvund02 "Ansilvund Burial Chambers" [CELL:0001F358]), will always retain its REFR FormID since it's persistent. http://www.creationkit.com/Delete_-_ObjectReference will only work on script created, save game or [FF] range forms and shouldn't be used on anything that's placed by a plugin.
User avatar
GLOW...
 
Posts: 3472
Joined: Thu Aug 03, 2006 10:40 am

Post » Mon Nov 19, 2012 2:51 pm

Thanks, you two.
Yes I made some test but:
but they'll not be remembered accross save game loads/game restarts.
that was actually my concern, I was wondering if "empty" object reference would cause useless ref in save, and apparently not.
Thx!
User avatar
meg knight
 
Posts: 3463
Joined: Wed Nov 29, 2006 4:20 am


Return to V - Skyrim