Linear Movement Script Help

Post » Thu Aug 08, 2013 5:07 pm

I'm looking to create a simple "elevator" activator that moves up and down the z axis from point A to B. I found a Script called http://cs.elderscrolls.com/index.php/Scripted_Linear_Movement, and I figured I would give try to give it a try.

I replaced the sample variables with my own, attached the script to an activator, and scripted a door to activate the elevator when the door was opened. The problem is, nothing seems to happen; there's not any movement as far as I can see.

I confess I don't have a very in-depth knowledge of mathematical functions. I know the code for obtaining the object's position is there; is the code necessary for the actual movement missing? Or is the movement there already, but I'm just not coding it correctly?

Any help would be greatly appreciated.

scn Testshort Activeshort DoOnceshort MoveToEndshort MoveToStartRef StartPointRefRef EndPointRefRef ActivatorRefFloat xStartFloat yStartFloat zStartFloat xEndFloat yEndFloat zEndFloat xNewFloat yNewFloat zNewFloat xDifferenceFloat yDifferenceFloat zDifferenceBegin OnActivate ;Check if the activator is activatedIf Active == 0Set Active to 1ElseSet Active to 0EndifEndBegin OnResetSet DoOnce to 0Set Active to 0Set MoveToEnd to 1Set MoveToStart to 0EndBegin GamemodeIf DoOnce == 0Set StartPointRef to TestActivator1Set EndPointRef to TestActivator2Set ActivatorRef to GetSelf Set xStart to StartPointRef.getpos x 384.0000Set yStart to StartPointRef.getpos y -6144.0000Set zStart to StartPointRef.getpos z 6976.0000Set xEnd to EndPointRef.getpos x 384.0000Set yEnd to EndPointRef.getpos y -6144.0000Set zEnd to EndPointRef.getpos z 6208.0000Set xNew to StartPointRef.getpos x 384.0000Set yNew to StartPointRef.getpos y -6144.0000Set zNew to StartPointRef.getpos z 6976.0000Set xDifference to (xStart - xEnd)Set yDifference to (yStart - yEnd)Set zDifference to (zStart - zEnd)ActivatorRef.SetPos x xNewActivatorRef.SetPos y yNewActivatorRef.SetPos z zNewSet MoveToEnd to 1Set MoveToStart to 0Set DoOnce to 1EndifIf (xNew != xEnd) && (yNew != yEnd) && (yNew != zEnd) && (MoveToEnd == 1)Set xNew to xNew - (xDifference/100)Set yNew to yNew - (yDifference/100)Set zNew to zNew - (zDifference/100)ActivatorRef.SetPos x xNewActivatorRef.SetPos y yNewActivatorRef.SetPos z zNewelseif (xNew == xEnd) || (yNew == yEnd) || (zNew == zEnd)if MoveToEnd == 1Set MoveToEnd to 0Set MoveToStart to 1EndifendifIf (xNew != xStart) && (yNew != yStart) && (yNew != zStart) && (MoveToStart == 1)Set xNew to xNew + (xDifference/100)Set yNew to yNew + (yDifference/100)Set zNew to zNew + (zDifference/100)ActivatorRef.SetPos x xNewActivatorRef.SetPos y yNewActivatorRef.SetPos z zNewelseif (xNew == xStart) || (yNew == yStart) || (zNew == zStart)if MoveToStart == 1Set MoveToStart to 0Set MoveToEnd to 1EndifendifEnd
User avatar
Anna S
 
Posts: 3408
Joined: Thu Apr 19, 2007 2:13 am

Return to IV - Oblivion