Level Editor/Scripting/Payload tracks: Difference between revisions

Level Editor: payload tracks scripting guide
 
American spelling
 
Line 12: Line 12:
== Driving the cart ==
== Driving the cart ==


Everything is measured in metres along the track: 0 is the start and [[Level Editor/Scripting/Reference/GamemodeServerApi#track_length|api.track_length]] is the end.
Everything is measured in meters along the track: 0 is the start and [[Level Editor/Scripting/Reference/GamemodeServerApi#track_length|api.track_length]] is the end.


* [[Level Editor/Scripting/Reference/GamemodeServerApi#tracks|api.tracks]] lists every track by name.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#tracks|api.tracks]] lists every track by name.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#track_progress|api.track_progress]] is how far the cart has come this tick.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#track_progress|api.track_progress]] is how far the cart has come this tick.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#track_checkpoints|api.track_checkpoints]] lists each checkpoint's distance, in order.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#track_checkpoints|api.track_checkpoints]] lists each checkpoint's distance, in order.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#set_track_speed|api.set_track_speed]] sets the speed the cart heads for, in metres per second: negative rolls it back, 0 stops it. The cart speeds up and slows down smoothly rather than jumping. Setting the same speed again costs nothing, so set it every tick from what the rules say right now.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#set_track_speed|api.set_track_speed]] sets the speed the cart heads for, in meters per second: negative rolls it back, 0 stops it. The cart speeds up and slows down smoothly rather than jumping. Setting the same speed again costs nothing, so set it every tick from what the rules say right now.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#set_track_floor|api.set_track_floor]] stops the cart rolling back past a distance. Raise it to a checkpoint once the cart reaches it, and the checkpoint holds.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#set_track_floor|api.set_track_floor]] stops the cart rolling back past a distance. Raise it to a checkpoint once the cart reaches it, and the checkpoint holds.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#track_point|api.track_point]] gives the world position a distance along the track, for placing things relative to the cart.
* [[Level Editor/Scripting/Reference/GamemodeServerApi#track_point|api.track_point]] gives the world position a distance along the track, for placing things relative to the cart.