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

Damage Goal

A scenario goal that monitors vehicle damage and triggers win or fail when damage exceeds a configurable limit. Supports threshold-based progress notifications.

A scenario goal that monitors vehicle damage and triggers win or fail when damage exceeds a configurable limit. Supports threshold-based progress notifications.


Internal State

FieldTypeDescription
M.instancesvariesAssigned as {}

Public API

FunctionSignatureDescription
M.init(scenario)Parses and validates damage goals from scenario JSON
M.processState(scenario, state, stateData)Checks damage each tick; triggers win/fail at limit
M.updateFinalStatus(scenario, instance)Reports final goal status to statistics system

Goal JSON Schema

{
  "goal": {
    "damage": {
      "damageLimit": 1000,
      "damageThreshold": 100,
      "purpose": "fail",
      "msg": "scenarios.myScenario.damageFail"
    }
  }
}
FieldTypeDefaultDescription
damageLimitnumberrequiredDamage value that triggers the goal
damageThresholdnumberoptionalIncrement for progress flash messages
purposestring"fail""fail" or "win" - what happens at limit
msglocalizedStringautoCustom message on trigger

How It Works

  1. init filters scenario goals for id == "damage", validates types, defaults purpose to "fail"
  2. Each onRaceTick, reads fobjData.damage from the map object tracker
  3. If damage exceeds damageLimit, calls showMsg which:
    • Sets result to "failed" or "passed" based on purpose
    • Calls scenario_scenarios.finish() with appropriate message
  4. If damageThreshold is set, shows progress flash messages at each threshold increment
  5. Tracks lastProgress to avoid duplicate notifications

Usage Examples

-- In scenario JSON: fail if damage exceeds 500
{
  "vehicles": {
    "scenario_player0": {
      "goal": {
        "damage": {
          "damageLimit": 500,
          "purpose": "fail"
        }
      }
    }
  }
}

-- With progress notifications every 20% of limit
{
  "damage": {
    "damageLimit": 1000,
    "damageThreshold": 200,
    "purpose": "fail"
  }
}

Key Notes

  • Uses map.objects[map.objectNames[vehicleName]] for damage tracking
  • If the map object is missing, re-tracks the vehicle via helper.trackVehicle
  • The damageThreshold shows flash messages like "50% damaged" at each increment
  • purpose: "win" is useful for demolition-style scenarios where taking damage is the objective

See Also

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

Bus Driver

M.dependencies = {'scenario_scenarios', 'core_groundMarkers'}

Demolition Derby

A simple demolition derby scenario mode where the last vehicle still moving wins. Tracks all scenario vehicles and declares a winner when only one remains in motion.

On this page

Internal StatePublic APIGoal JSON SchemaHow It WorksUsage ExamplesKey NotesSee Also