TranslateTo Repeat. How do I make it so?

Post » Tue Jan 27, 2015 10:34 pm

Currently using this script to move a ship along its Y axis.

objectReference property ObjToMoveRef autofloat afXfloat afYfloat afZfloat afXAnglefloat afYAnglefloat afZAnglefloat afSpeed1 = 32.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, afSpeed1) ;Translates the object to the start point, in case the placement in CK is a bit off.EndEventEvent onActivate(objectReference akActivator)	Float fEndPointY = EndPointRef.getPositiony()	Float fStartPointY = StartPointRef.getPositiony()	If afY == fEndPointY ;Translates the object to the start point, if the object is currently at the end point.		afY =  fStartPointY		ObjToMoveRef.TranslateTo(afX, afY, afZ, afXAngle, afYAngle, afZAngle, afSpeed1)	ElseIf afY == fStartPointY ;Translates the objectto the end point, if the object is currently at the start point.		afY = fEndPointY		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.		afY =  fStartPointY		ObjToMoveRef.TranslateTo(afX, afY, afZ, afXAngle, afYAngle, afZAngle, afSpeed1)	EndIfEndEvent

All is good except for 2 things. When I leave the area (go walkabout for some time) and return the ship is translating, backwards, to its starting point. I guess this is the OnInIt part of the script moving it back.

What I'd like is that the ship completes its course, quite a length, then is put back, guessing MoveTo will work, to its starting position and start over.

Help scripting this appreciated, thanks.

User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm

Return to V - Skyrim