Translate To causing me to go mad. Help!

Post » Thu May 28, 2015 8:24 am

GlobalVariable Property Ccount AutoObjectReference Property ObjToMoveRef auto ObjectReference Property StatHolder AutoObjectReference Property ThisHolder AutoObjectReference Property CrystalKeyInHolder AutoObjectReference Property soundObj AutoMiscObject Property CrystalKey AutoSound Property mySound  AutoInt Property afSpeed1 Autofloat afXfloat afYfloat afZfloat afXAnglefloat afYAnglefloat afZAnglefloat afSpeed2 = 500.0ObjectReference property EndPointRef auto ; Was High End Point Whether XYorZObjectReference property StartPointRef auto ; Was Low Start Point Whether XYorZEvent OnInit()	afX = ObjToMoveRef.getPositionX() ;X position of StartPointRef	afY = StartPointRef.getPositionY() ;Y position of StartPointRef	afZ = ObjToMoveRef.getPositionZ() ;Z position of StartPointRef	afXAngle = ObjToMoveRef.getAngleX()	afYAngle = ObjToMoveRef.getAngleY()	afZAngle = ObjToMoveRef.getAngleZ()	ObjToMoveRef.TranslateTo(afX, afY, afZ, afXAngle, afYAngle, afZAngle, afSpeed2) ;Translates the object to the start point, in case the placement in CK is a bit off.EndEventEvent OnActivate(objectReference akActivator)if Game.GetPlayer().GetItemCount(CrystalKey) >= 1Game.GetPlayer().RemoveItem(CrystalKey, 1)StatHolder.Enable()CrystalKeyInHolder.Enable()ThisHolder.Disable()Utility.Wait(2.0)mySound.Play(soundObj)CrystalKeyInHolder.Disable()Ccount.Mod(1.0)	Float fEndPointZ = EndPointRef.getPositionZ()	Float fStartPointZ = StartPointRef.getPositionZ()	If afZ == fEndPointZ ;Translates the object to the start point, if the object is currently at the end point.		afZ =  fStartPointZ		ObjToMoveRef.TranslateTo(afX, afY, afZ, afXAngle, afYAngle, afZAngle, afSpeed1)	ElseIf afZ == fStartPointZ ;Translates the objectto the end point, if the object is currently at the start point.		afZ = fEndPointZ		ObjToMoveRef.TranslateTo(afX, afY, afZ, afXAngle, afYAngle, afZAngle, afSpeed1)	Else ;Presumably in case the translation stops somewhere between the start and end points. In which case the object is translated to the start point.		afZ =  fStartPointZ		ObjToMoveRef.TranslateTo(afX, afY, afZ, afXAngle, afYAngle, afZAngle, afSpeed1)	EndIfEndIfEndEvent

Ok first off the script and a video so you know what is going on.
https://onedrive.live.com/?cid=B60C11D037429D8E&id=b60c11d037429d8e!30794&v=3

The second crystal and the third which isn't shown, won't line up. I have messed around with this for hours and cannot figure out why. The script is placed on 3 crystals, all are unique objects "crystal01a, crystal01b and crystal01c". Here is a screenshot of them in CK. The 2 xmarkers are the Z begin level and Z end level.
https://onedrive.live.com/?cid=B60C11D037429D8E&id=b60c11d037429d8e%2130796&v=3

Player activates the first receptacle, the crystal translates. Upon activation the receptacle activator is disabled and a static receptacle is enabled. Player goes off in search of more crystals. When player leaves the cell he/she triggers a "trigger" just outside the cell entrance in the world which checks how many crystals have been placed. In the video the first crystal has been placed, the first receptacle is disabled, the static enabled, player leaves cell, script checks how many crystals, 1 in this case, script disables static receptacle and enables the second receptacle activator waiting for the next crystal. If player has no crystals when trying to activate any of the receptacles he/she is told so "Go find some."

I have toyed with the positioning of this second crystal for hours. Off-setting in CK so hopefully it would line up in game, double-checking x,y and z co-ords. it lines up perfect in CK and the first crystal translates correctly. Why oh why won't the others?

Thanks for listening to my rant.

User avatar
Rich O'Brien
 
Posts: 3381
Joined: Thu Jun 14, 2007 3:53 am

Post » Thu May 28, 2015 8:28 am

This does seem strange.

You don't like using TranslateToRef?

Why does afY reference StartPointRef and not ObjToMoveRef like the others?

User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm


Return to V - Skyrim