Followspline: object disappears if ready with followspline


(MCEmperor) #1

Hi all,

I got a simple problem: I have an object that follows a spline, but if ready, it will disappear. Here is a part of my script. Note that the trigger followroute has been called before anywhere:

tank {
trigger followroute {
followspline 0 tank_route_default 50 wait length 32
followspline 0 tank_route_1 50 wait length 32
followspline 0 tank_route_2 50 wait length 32
followspline 0 tank_route_3 50 wait length 32
}
}

Any suggests are welcome.


(Flippy) #2

I’m not 100% sure, but I think you need an extra splinepoint at the end of the spline, but don’t make it move to that splinepoint.
Just keep the script the same, but add an extra spline called “tank_route_4” or “tank_route_stop” maybe, whatever…

I’m not too sure on the exact behaviour then, it could be that the tank stops on that extra splinepoint, or that it stops on the splinepoint before that (which is now your last splinepoint). But you can easily try that out.


(.Chris.) #3

It also needs one before the start position I think or at least that’s what I had to do when I encountered this problem.


(MCEmperor) #4

Hey I got some great news: it works. It’s just a simple solution: to make sure that your moving object stops moving before the spline ends.

Thank y’all very much, also for that very fast reply!


(Flippy) #5

Well, making it stop one splinepoint earlier is basically the same concept as adding an extra splinepoint, no? :stuck_out_tongue:


(C) #6

There are 2 script-commands for moving script_movers:
followspline & followpath
They both have a <targetname> as a parameter.

Say You have a (short) path with just 2 info_train_spline_main entities:
*A: targetname=splineA, target=splineB
*B: targetname=splineB

If You issue a followspline-command, “followspline splineA …”, the script_mover will start moving from the splineA, and it will move to the info_train_spline_main that splineA is targeting, in this case splineB.

A followpath command works a little different:
It moves a script_mover (from anywhere the script_mover allready is), to the indicated <targetname>…

So, a followpath-command shows the position a script_mover will end its movement, whereas a followspline-command states the position a script_mover will start its movement.

The followspline command is different from the followpath-command also, because of the possibility to “aim” the script_mover into the correct heading. Followspline needs the next targeted spline to “know” how to rotate the script_mover.
So when a tank follows a U-turn path, its heading is adjusted along the path, and eventually the tank will face the opposite direction as from where it started that U-turn path.
This is the reason why You can create a tank anywhere in Your map, facing it (lets say) North… then create a path that starts moving the tank East.
When the tank spawns, You let it follow the first spline (very quickly), that spline will target the next spline (East of it), and automaticly the tank will face into the correct direction when it has reached the second spline-point.

Followpath is somewhat simpeler, it does not change the heading of a script_mover…


(Flippy) #7

Nice explanation C. Didn’t know the part about followspline targetname being the starting splinepoint instead of the ending splinepoint :slight_smile: