Move ObjReference into Container without deleting it

Post » Tue Jan 22, 2013 3:59 pm

So, this is probably my dumbest question ever, but I can't seen to figure it out. Probably missed the function/whatever right under my nose? How do you transfer an Objreference to an inventory/container, like when you pick up stuff? I mean transfer the actual ObjReference, not deleting one and creating another in the container to simulate it being picked/moved like i see usually.
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Wed Jan 23, 2013 12:55 am

I am not completely sure about this, but I would expect that behaviour to be determined by whether the item in question can be considered 'generic' or 'unique' in some sense. If the item is 'generic', it will be deleted, and an inventory counter incremented for the container.

You could try attaching a script to the object in question to make it a 'unique' instance. Depending on the specifics of your situation, there may be other ways to achieve 'uniqueness' (like being a quest item), but perhaps someone else knows more about those.
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Wed Jan 23, 2013 5:58 am

It actually isn't so much the uniqueness as the persistence. Look up persistence on the creationkit wiki. Basically an easy trick is to register the reference for an update that happens once every eternity or so.
User avatar
Tyler F
 
Posts: 3420
Joined: Mon Aug 27, 2007 8:07 pm

Post » Tue Jan 22, 2013 2:18 pm

The basic function is Activate. Use it on the object to be transferred and pass the container reference as the first parameter. If the original object is unique or special (enchanted item with charges used) it will be moved into the container, if it's not then it will be cleaned and a counter updated in the container. If your item isn't really unique then it shouldn't matter whether it's a copy or not.
User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm

Post » Tue Jan 22, 2013 5:54 pm

Just wildly speculating, but I wonder if this behaviour might be influenced by having an objectreference variable in whatever script pointing to the item in question? If persistense has an effect, that might be almost the easiest way to achieve it.
User avatar
Lily
 
Posts: 3357
Joined: Mon Aug 28, 2006 10:32 am

Post » Tue Jan 22, 2013 3:49 pm

Fill a ReferenceAlias with the REFR. It'll persist as long as it needs to and retain its FormID thus remaining its own, unique, script referenceable entity.
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Tue Jan 22, 2013 10:27 pm

Guys I know how to make them remain unique. That's not what I need. As I said before: I want to move the unique ObjRefs into an inventory or container via script. Activate() could work for misc stuff, but it doesn't work for me because my ObjRefs are books and they open when activated. Thanks for the answers, though.
User avatar
Quick Draw
 
Posts: 3423
Joined: Sun Sep 30, 2007 4:56 am

Post » Tue Jan 22, 2013 7:53 pm

Just a crazy thought but try having the book activate the container.

Or here's another thought. I assume the "container" in your case is really an actor right? If so what happens if it's an actual container object trying to pick up the book? If a true container can do it then you could have a "collector" container to pick up the book then use RemoveAllItems to transfer it to the actor you wanted to get it.
User avatar
Alexis Estrada
 
Posts: 3507
Joined: Tue Aug 29, 2006 6:22 pm

Post » Tue Jan 22, 2013 10:49 pm

http://www.creationkit.com/AddItem_-_ObjectReference does not work in that manner?

if it does, I can only agree with your initial statement :)
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm

Post » Tue Jan 22, 2013 3:43 pm

AddItem can take object references? That should solve everything without silly work-arounds if it actually works. Nice find Inki.
User avatar
Kellymarie Heppell
 
Posts: 3456
Joined: Mon Jul 24, 2006 4:37 am

Post » Tue Jan 22, 2013 3:17 pm

Well if the item is in the player's inventory you could do something like:
Actor Property PlayerREF AutoContainer Property MyChest AutoObjectReference Property MyREF Auto(PlayerREF).RemoveItem(MyREF, 1, akOtherContainer = MyChest)
This removes the ObjectReference from the player and moves it to a chest of your choice. You of course need to add an OnEvent if you want the script to fire.
User avatar
Nick Tyler
 
Posts: 3437
Joined: Thu Aug 30, 2007 8:57 am

Post » Tue Jan 22, 2013 7:23 pm

Try: SomeItem.Activate(Game.GetPlayer())
User avatar
Mandi Norton
 
Posts: 3451
Joined: Tue Jan 30, 2007 2:43 pm


Return to V - Skyrim