Jump to content

Finding PlaceAtMe's ObjectReference


Elec0

Recommended Posts

I'm doing this:

 


Furniture property activatorToPlace auto
ObjectReference toPlace
float xRot
float yRot
float zRot

Event OnInit()
; Stop the item from being picked up, since that's not what we want
Self.BlockActivation()
EndEvent

Event OnActivate(ObjectReference activator)

If Game.GetPlayer().IsSneaking() == True
	xRot = Self.GetAngleX()
	yRot = Self.GetAngleY()
	zRot = Self.GetAngleZ()
	
	toPlace = Self.PlaceAtMe(activatorToPlace)
	
	;Debug.Trace("Place & deactivate.")
	Self.PlaceAtMe(activatorToPlace)
	Self.Disable()
Else
	Game.GetPlayer().AddItem(Self, 1)
	Self.Disable()
EndIf

 

It obviously isn't working. I'm placing a new object of the activatorToPlace, but it's a Furniture which extends Form, which has no rotation functions. I'm aware this is because it turns into an ObjectReference when you place it, but my question is how do you figure out what said ObjectReference is called?

Link to comment
Share on other sites

I'm not sure what you mean by "what said ObjectReference is called". An ObjectReference is basically a pointer to your base form (a Furniture form, in this case) that also contains some extra data, like rotational data.

 

P.S. That "Self" syntax isn't required, although it will compile and work perfectly. I expect, although I haven't tested this, that the Papyrus compiler is good enough to optimise either of these examples just as well, but they're both functionally identical:

Self.Disable()

Disable()

 

Cipscis

Link to comment
Share on other sites

Yeah, I suppose it would, but it just helps me keep it more organized in my mind.

 

I'm trying to place the object, then rotate it to the rotation of the previous object. But the Furniture property extends Form, which has no rotation functions.

 

Edit:

 

It just hit me, I actually read about this on the Wiki:

ObjectReference newBox = TargetMarker.PlaceAtMe(BoxBase)

 

That's what I need to do. Sorry I didn't see this earlier.

Edited by Elec0
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...