This is an old revision of the document!
Racing
Worlds can have a number of different race courses defined. You create these by setting up checkpoints along the course that the player must travel across, along with a starting region and finishing line. Defining the course is done through the in-game World Editor.
Races can be run either by having one player (or admin) 'hosting' the race - i.e. they choose when it starts - or they can be fully automated.
Races can be initiated automatically through settings or can be triggered either manually or from script using the following commands:
*raceinit [course_num] [entry_fee] *racejoin [player_name] [course_num] [Spawn_Mode] *racestart [course_num] [start_mode] *raceleave [player_name] [course_num]
*raceinit
initiates the race, the entry_fee is optional, if set the amount will be deducted automatically from the player when they join and is added to a pool that is given to the winner.
*racejoin
is used to add players to the race. Setting 'Spawn_Mode' to 1 automatically places the player in the start zone, facing in the right direction and sets them 'Ready' which locks their controls. (Otherwise it is up to the player themselves to 'Set Ready'.)
*racestart
triggers a countdown and starts the race.
Normally if you're scripting a race, you'll want to some mechanism to initiate a race (e.g. Using a particular item or selecting an option in a special building) and then players would be given the option to join the race, perhaps through a popup notification. An example of how to do this is provided here
Racing Script Events & Sys Function
RaceStart : Triggered once when the race starts. $gTaskItem1
will be set to the course number
RaceEnd
RaceWinner : Triggered with the details of the player who won the race.
sysRaceIsActive( [course_num] ) can be used in script to find out if a race course is currently active.
Automated Races through Settings
TBD