Jump to content

Scripted Linear Movement - Problems


SKuban

Recommended Posts

Good evening all!

 

I want to move a static or better said an activator moving just from north to south along the Y-Axis.

Searching for a script i found at the construction set Wiki a script which handles my wish, but there seem to be a conflict in the script.

I followed the instruction of the page:

 

http://cs.elderscrolls.com/constwiki/index.php/Scripted_Linear_Movement

 

Well, i created the three activators and typed coordinates into the scipt, as followed:

but got warning in line 46, marked it yellow.

 

 

 

scn LinearMovement

 

short Active

short DoOnce

 

short MoveToEnd

short MoveToStart

 

Ref StartPointRef

Ref EndPointRef

Ref ActivatorRef

 

Float xStart

Float yStart

Float zStart

 

Float xEnd

Float yEnd

Float zEnd

 

Float xNew

Float yNew

Float zNew

 

Float xDifference

Float yDifference

Float zDifference

 

Begin OnActivate ;Check if the activator is activated

If Active == 0

Set Active to 1

Else

Set Active to 0

Endif

End

 

Begin OnReset

Set DoOnce to 0

Set Active to 0

Set MoveToEnd to 1

Set MoveToStart to 0

End

 

Begin Gamemode

If DoOnce == 0

Set StartPointRef to 000StartPointActivator <- Script 'Linear Movement', line46: Syntax Error. Unknown command 'StartPointActivator'. Missing expression in set command.

Set EndPointRef to 000EndPointActivator

Set ActivatorRef to GetSelf

 

Set xStart to StartPointRef.getpos 120000

Set yStart to StartPointRef.getpos -186000

Set zStart to StartPointRef.getpos 0

 

Set xEnd to EndPointRef.getpos 120000

Set yEnd to EndPointRef.getpos -200000

Set zEnd to EndPointRef.getpos 0

 

Set xNew to StartPointRef.getpos 120000

Set yNew to StartPointRef.getpos -186000

Set zNew to StartPointRef.getpos 0

 

Set xDifference to (xStart - xEnd)

Set yDifference to (yStart - yEnd)

Set zDifference to (zStart - zEnd)

 

ActivatorRef.SetPos x xNew

ActivatorRef.SetPos y yNew

ActivatorRef.SetPos z zNew

 

Set MoveToEnd to 1

Set MoveToStart to 0

 

Set DoOnce to 1

Endif

 

If (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 xNew

ActivatorRef.SetPos y yNew

ActivatorRef.SetPos z zNew

 

elseif (xNew == xEnd) || (yNew == yEnd) || (zNew == zEnd)

if MoveToEnd == 1

Set MoveToEnd to 0

Set MoveToStart to 1

Endif

endif

 

If (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 xNew

ActivatorRef.SetPos y yNew

ActivatorRef.SetPos z zNew

 

elseif (xNew == xStart) || (yNew == yStart) || (zNew == zStart)

if MoveToStart == 1

Set MoveToStart to 0

Set MoveToEnd to 1

Endif

endif

End

 

 

 

How do I solve this warning, please? It's my first script, so please help a newbie :laugh:

 

By the way do you see more faults in this script or have easier, shorter versions to move static / activators just along the Y-Axis ?

Link to comment
Share on other sites

I don't know why someone started a ref with numbers, I'd advice against it. Changing that 000StartPointActivator to just StartPointActivator (at the script AND the object) might help out.

At first sight I'm not sure what's wrong as the ref seems placed and named appropriately.

 

At the Getpos you need to add x,y and z. As with GetPos you track things down.

With SetPos you can change movement. like Ref.Setpos x 200 or Ref.Setpos x variable

Link to comment
Share on other sites

it's because of reference ID numbers; 0s will make it look for a reference number rather than the ID name, resulting in a callback error. something like using a piece of your username to identify your scripts works better and can keep them organized.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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