move an item from a cell to a player

Post » Tue Jun 19, 2012 12:58 am

K, sorry if this is obvious but I've been stuck on this problem most of the day. The purpose of this script is to create a tent for the player when they activate the Deer Hide (that I duplicated and renamed Collapsed Tent) that they threw on the ground.

Basically my debug notification goes off like it is supposed to, the Deer Hide (actually named BK_DeerHide) goes into the players inventory like it's supposed to at the moment (haven't started the Delete part of the code yet), but a tent never appears.

Scriptname BK_TentScript extends ObjectReference{Creates my tent when you activate my DeerHideand then Removes the DeerHide}ObjectReference Property BK_CampingTent AutoEvent OnActivate(ObjectReference akActionRef)Debug.Notification("Hello, World")BK_CampingTent.Moveto(self, 10, 10, 0)EndEvent

I went into properties and tied "BK_CampingTent" to the matching Item of mine in it's cell. Does it matter that the cell is a basically empty one I duplicated, dumped and named the item in, and has no connection to the rest of the world?

The Moveto command doesnt work with Game.GetPlayer() instead of self either. Also I stuck the X,Y movement in just to test if the player was preventing it from spawning.


ObjectReference Tent = Game.GetPlayer().PlaceAtMe(Game.GetForm(0x010012D3))
Doesn't work either, but I think that's due to the 010012D3 not being a property I guess. Sorry for the rambling, just saying things I've tried basically lol. Any help would be appreciated!
User avatar
James Potter
 
Posts: 3418
Joined: Sat Jul 07, 2007 11:40 am

Post » Mon Jun 18, 2012 1:56 pm

This version is used by the Bag of Holding mod:
 ObjectReference Property BagOfHoldingREF Auto  If BagOfHoldingREF.IsDisabled()  BagOfHoldingREF.Enable()  EndIf  BagOfHoldingREF.MoveTo(Self)  Disable()  Delete() EndIf

Where BagOfHoldingREF is the named reference of the Bag Of Holding already in the world. So in your case I would suggest dumping your base item (BK_CampingTent) in an empty cell, name it BK_CampingTentREF and use the script I just posted. Hope this helps!
User avatar
Latisha Fry
 
Posts: 3399
Joined: Sat Jun 24, 2006 6:42 am

Post » Mon Jun 18, 2012 11:55 pm

Nope still didn't work :(

ObjectReference Property BK_CampingTentREF AutoEvent OnActivate(ObjectReference akActionRef)   If BK_CampingTentREF.IsDisabled()        BK_CampingTentREF.Enable()   EndIfBK_CampingTentREF.MoveTo(Self)Disable()Delete()EndEvent

And I made a new completely empty cell like you suggested and reset my script properties to the tent I dropped in it and named BK_CampingTentREF. I must be missing something completely obvious, thanks for trying to help though!

On a side note the Collapsed Tent was still added to my inventory when I activated it, however it did the disappear and delete when I dropped it onto the ground again lol.
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Mon Jun 18, 2012 5:44 pm

You do know that you have to define the property BK_CampingTentREF right? I mean, you need to put that in your script, after that, go to the item your script is attached to, then click once on your script and to the right is a button called properties. Click that button. A window will open where you can define your properties. Click on BK_CampingTentREF and pick the cell where the object is located and pick the object itself. Have you done this? Otherwise this would be the reason for your script not to be working. Oh and remove the Disable and Delete commands at the end of your script, you don't need those.
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Tue Jun 19, 2012 1:21 am

Yep I've been doing that, took me almost 2 hours this morning to figure that little tidbit out lol. Tried switching it to a bedroll out of curiousity, still no go. Wonder if it's something related to Static world objects and not actors that are meant to be moved or move. Or there's just something insanely insanely simple I'm missing. Do I have to mess with ParentRefs or LinkedRefs on the item I'm trying to teleport? Or Keywords on any of the items?

Sorry, I did some modding on Oblivion back in the day (original Crowded Roads an Cities, small Hunger mod, an a Marriage mod) but this is a little more complicated.
User avatar
Imy Davies
 
Posts: 3479
Joined: Fri Jul 14, 2006 6:42 pm

Post » Mon Jun 18, 2012 9:48 pm

Well just thought I'd post for those that use the Search function on the forums that I think I figured it out. Tents and Bedrolls are Static objects not ObjectReference's. Unfortunatly after changing the Properties you can't use MoveTo on a Static. So here's what I got working.

Float ANGLEyfloat ANGLExfloat ANGLEzStatic Property BK_CampingTentREF AutoEvent OnActivate(ObjectReference akActionRef)	 Debug.Notification("Hello, World")	 ;ANGLEy = self.getangleY()	 ;ANGLEx =self.getanglex()	 ;ANGLEz = self.getanglez()	 ObjectReference Tent = Game.GetPlayer().PlaceAtMe(BK_CampingTentREF)	 ;Tent.SetAngle(ANGLEx, ANGLEy, ANGLEz)	 Tent.SetAngle(0, 0, 0)	 ;Debug.Notification("ActionRef Angle is " + ANGLEx + ", "+ ANGLEy + ", "+ ANGLEz + ", " )EndEvent

Basically now I'm just playing with figuring out how to make it so that the tent matches the slope of the land around it (cause it appears at a truly weird angle) before moving onto making the tent be able to vanish again. Thanks for trying to help Silverbird :smile:
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am


Return to V - Skyrim