RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Bus DriverDamage GoalDemolition DerbyDistance GoalDrift GoalFinish Race GoalNo-Move GoalPosition GoalQuick RaceQuick Race LoaderRace MarkersRace DebugRace Goals ManagerRace UIScenario HelperScenario EngineScenarios LoaderSpeed GoalTime Limit GoalWaypoint ActionScenario Waypoints

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsscenario

Finish Race Goal

A scenario goal that tracks whether a vehicle finishes a race. Supports both "must finish" and "must win" modes.

A scenario goal that tracks whether a vehicle finishes a race. Supports both "must finish" and "must win" modes.


Public API

FunctionSignatureDescription
M.init(scenario)Parses finishRace goals from scenario JSON
M.processState(scenario, state, stateData)Handles waypoint reached and race result events
M.updateFinalStatus(scenario)Reports final goal status to statistics system

Goal JSON Schema

{
  "goal": {
    "finishRace": {
      "mustWin": true,
      "passed": "scenarios.race.youWon",
      "failed": "scenarios.race.youLost"
    }
  }
}
FieldTypeDefaultDescription
mustWinbooleanfalseIf true, only the first vehicle to finish passes
passedlocalizedString"You finished the race."Message on pass
failedlocalizedString"You failed to finish the race."Message on fail

How It Works

  1. init collects all goals with id == "finishRace"
  2. On onRaceWaypointReached: when next == nil (final waypoint):
    • mustWin mode: First vehicle to reach end passes; all others fail
    • Normal mode: Each vehicle is marked pass/fail based on whether it finishes
  3. On onRaceResult: Finishes the scenario with pass/fail messages
  4. A vehicle that never reaches the final waypoint defaults to "failed"

State Events

EventTrigger
onRaceWaypointReachedVehicle crosses last waypoint (next == nil)
onRaceResultRace ends - calls passedGoal or failedGoal

| M.instances | varies | Assigned as {} |

Usage Examples

-- Simple finish goal: just cross the finish line
{
  "vehicles": {
    "scenario_player0": {
      "goal": {
        "finishRace": {}
      }
    }
  }
}

-- Must beat AI to win
{
  "finishRace": {
    "mustWin": true,
    "failed": "scenarios.race.aiWon"
  }
}

Key Notes

  • Uses statistics_statistics.setGoalProgress to report results
  • In mustWin mode, once any vehicle finishes, the player's result is locked
  • Without mustWin, each vehicle independently passes or fails
  • Both passedGoal and failedGoal call scenario_scenarios.finish() to end the scenario

See Also

  • Scenario Bus Driver - Bus Route Scenario Logic - Related reference
  • Scenario Damage Goal - Damage-Based Win/Fail Condition - Related reference
  • Scenario Demolition Derby - Last Vehicle Moving Wins - Related reference
  • Scenario System Guide - Guide

Drift Goal

A scenario goal that calculates drift scores from vehicle angle and speed, supports combo chains, and triggers win/fail based on minimum drift score thresholds.

No-Move Goal

A scenario goal that fails if a vehicle moves from its starting position. Used for parking/brake scenarios where a vehicle must remain stationary.

On this page

Public APIGoal JSON SchemaHow It WorksState Events| M.instances | varies | Assigned as {} |Usage ExamplesKey NotesSee Also