GetPosition() Returns Dropped Position?

Post » Mon Jul 01, 2013 3:02 am

Hey guys, it's rare I post 2 threads at pretty much the same time, however they are two separate issues :smile:

It seems like GetPosition(), when called on a Misc Object, returns the values of where the object was originally dropped from the player's inventory, not where it rests now. Has anybody come up against this problem before?

Here is my code. This is attached to a Misc Object. The placed object gets positioned perfectly when the player chooses Set Up where it drops, however if you drop it, grab pick it up (hold E) and move it away, then activate it and select Set Up, the placed object gets placed in it's original position. Also simply walking into the object making it move, not just grabbing it to move it, doesn't return correct values.

Any help appreciated :smile:

* The code looks messy because of all of the different variations I have tried to solve the problem.
** I should note that the position is for where it was last dropped. So each time you add it to your inventory, the new position resets.

Spoiler

Activator Property HISTrapActRabbit01 AutoMessage Property HISTrapMiscRabbitMessage AutoMiscObject Property HISTrapMiscRabbit01  Auto  Actor Property PlayerREF AutoEvent OnLoad()	BlockActivation()EndEventEvent OnActivate(ObjectReference akActionRef)	if akActionRef == PlayerREF		int iButton = HISTrapMiscRabbitMessage.Show()			if iButton == 0; if the player selects Set Up				SetMotionType(Motion_Keyframed)				SetUpTrap()			elseif iButton == 1; if the player select pick up				Disable()				Delete()				PlayerREF.AddItem(HISTrapMiscRabbit01)			elseif iButton == 2; if the player select cancel				;			endif	endifEndEventFunction SetUpTrap()	float fPX = Self.GetPositionX()	float fPY = Self.GetPositionY() + 15.0	float fPZ = PlayerREF.GetPositionZ() + 27.0	Utility.Wait(0.2)	ObjectReference kTrap = PlaceAtMe(HISTrapActRabbit01, 1, False)	kTrap.SetMotionType(kTrap.Motion_Keyframed);	kTrap.SetPosition(GetPositionX(), GetPositionY(), GetPositionZ())	kTrap.SetPosition(fPX, fPY, fPZ)	kTrap.SetAngle(-125.0000, 0.00, 0.00)	Disable()	Utility.Wait(0.2)	Delete()EndFunction
User avatar
Dominic Vaughan
 
Posts: 3531
Joined: Mon May 14, 2007 1:47 pm

Post » Mon Jul 01, 2013 4:56 am

So although the function is meant to return the "current" position, http://www.creationkit.com/GetPositionX_-_ObjectReference, it doesn't... unless I'm using it like a pleb.

User avatar
Melissa De Thomasis
 
Posts: 3412
Joined: Tue Feb 27, 2007 6:52 pm

Post » Mon Jul 01, 2013 7:24 am

What about adding this one to your script?

Event OnRelease()Disable()Utility.Wait(0.2)Enable();get the position hereEndEvent

Or you could always get the position of the player and the distance from the player.

User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Mon Jul 01, 2013 7:46 am

Player position would work, however the ground level of the player may be slightly higher or lower than the level where the object is. This could make the placed object, which has my careful position and angle settings, look weird mate.

EDIT: Also simply walking into the object making it move, not just grabbing it to move it, doesn't return correct values. Updated main post.

User avatar
emma sweeney
 
Posts: 3396
Joined: Fri Sep 22, 2006 7:02 pm


Return to V - Skyrim