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

Time Limit Goal

A scenario goal that fails the scenario if the player exceeds a maximum time. Supports countdown warnings and wait time after the limit.

A scenario goal that fails the scenario if the player exceeds a maximum time. Supports countdown warnings and wait time after the limit.


Internal State

FieldTypeDescription
M.instancesvariesAssigned as {}

Public API (Exports)

FunctionSignatureDescription
M.init(scenario)Parses and validates timeLimit goals from scenario JSON
M.processState(scenario, state, stateData)Checks time each tick; fails at limit
M.updateFinalStatus(scenario, instance)Reports final goal status to statistics

Goal JSON Schema

{
  "goal": {
    "timeLimit": {
      "maxTime": 60,
      "waitTime": 0,
      "countdown": 10,
      "msg": "scenarios.myScenario.timeFail"
    }
  }
}
FieldTypeDefaultDescription
maxTimenumberrequiredMaximum allowed time in seconds
waitTimenumberrequiredGrace period after maxTime before failing
countdownnumberoptionalSeconds before limit to start showing countdown
msglocalizedStringautoCustom failure message

How It Works

  1. init filters goals for id == "timeLimit", validates that maxTime and waitTime are numbers
  2. Processing states:
    • onRaceTick: If countdown is set and time remaining < countdown seconds, shows decreasing flash messages ("3", "2", "1")
    • After maxTime + waitTime has passed, calls failedGoal() which sets status to "failed" and calls scenario_scenarios.finish()
    • onRaceResult: If finalTime > maxTime, also triggers failure
  3. Countdown tracking uses instance.wait to prevent duplicate messages per second

Usage Examples

-- In scenario JSON: fail if race takes longer than 120 seconds
{
  "vehicles": {
    "scenario_player0": {
      "goal": {
        "timeLimit": {
          "maxTime": 120,
          "waitTime": 0
        }
      }
    }
  }
}

-- With 10-second countdown warning:
{
  "timeLimit": {
    "maxTime": 60,
    "waitTime": 2,
    "countdown": 10,
    "msg": "Time's up!"
  }
}

Key Notes

  • Both maxTime and waitTime must be numbers (validated in init)
  • The actual fail triggers at maxTime + waitTime, not just maxTime
  • countdown shows flash messages with helper.flashUiMessage at each second
  • If countdown is not a number, the goal is rejected with an error log
  • Also checks onRaceResult for post-race validation (e.g., if race finishes exactly at limit)
  • The passed status is only set in onRaceResult when finalTime <= maxTime

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

Speed Goal

A scenario goal that monitors vehicle speed and triggers win or fail if the vehicle stays outside a speed range for too long. Supports min/max speed, timeout countdown, waypoint-specific checks, and d

Waypoint Action

A scenario goal that displays flash messages when the player reaches specific waypoints. Unlike other goals, this is purely informational - it doesn't trigger win or fail conditions.

On this page

Internal StatePublic API (Exports)Goal JSON SchemaHow It WorksUsage ExamplesKey NotesSee Also