RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Freeroam Big Map MarkersFreeroam Big Map ModeFreeroam Big Map POI ProviderFreeroam Crash Cam ModeFreeroam Crash Cam Mode LoaderFreeroam Drag RaceFreeroam FacilitiesFreeroamFreeroam ConfiguratorFreeroam Gas StationsFreeroam Level StatsFreeroam OrganizationsFreeroam Special TriggersFreeroam Vue Big Map

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 Extensionsfreeroam

Freeroam Drag Race

Manages a quarter-mile drag race against an AI opponent in freeroam mode. Handles staging lights, countdown tree, start detection, finish timing, displays, and opponent AI behavior.

Manages a quarter-mile drag race against an AI opponent in freeroam mode. Handles staging lights, countdown tree, start detection, finish timing, displays, and opponent AI behavior.


Internal State

FieldTypeDescription
M.onUpdatevariesAssigned as onUpdate

Public API

FunctionSignatureReturnsDescription
M.accept()nilOpens the drag race overview/config UI
M.exit()nilExits drag race, deletes opponent
M.selectOpponent(selection)nilSpawns a chosen opponent vehicle
M.selectRandomOpponent(sameClass)tablePicks a random opponent config; optionally same performance class
M.restartRace()nilQuick-resets both vehicles
M.closeOverview()nilCloses the results overview UI
M.enableCinematicCam(value)booleanGets/sets cinematic camera mode
M.enableProTree(val)booleanGets/sets pro tree countdown mode
M.setLevel(lvl)nilSets the drag race level (e.g., gridmap_v2)
M.resetLights()nilHides all Christmas tree lights
M.onExtensionUnloaded()-
M.onClientEndMission()-
M.setupPrestage()-
M.setupStage()-

Hooks

HookPurpose
M.onPreRenderRuns countdown timer, staging logic, distance checks
M.onBeamNGTriggerHandles trigger enter/exit events for staging and finish
M.onVehicleSpawnedSets up opponent AI after spawn
M.onVehicleResettedRe-positions opponent after reset
M.onVehicleDestroyedCleans up vehicle references
M.onExtensionLoadedInitializes lights, displays, triggers for current level

Race Flow

  1. Trigger Entry: Player drives into dragTrigger, dialogue appears
  2. Opponent Selection: Player selects or random-picks an opponent vehicle
  3. Pre-stage: AI drives to start line; pre-stage lights illuminate
  4. Stage: Both vehicles aligned; stage lights on
  5. Countdown: Pro tree (all ambers simultaneous) or standard tree (sequential)
  6. Start: Green light, AI freeze released, JATO/NOS activated
  7. Finish: endTrigger records time and speed for each lane
  8. Results: Overview UI displays with optional cinematic camera

Jump Start Detection

If the player crosses the start line before green, red lights illuminate, race is disqualified, and opponent stops.

Display System

7-segment displays use TSStatic shape swapping (display_0.dae through display_9.dae) for time (3 decimal) and speed (2 decimal) readouts.

Supported Levels

  • west_coast_usa - Full cinematic cam support
  • gridmap_v2 - Simplified layout, no cinematic cam

Notes

  • Opponent AI uses setAiPath with waypoints for positioning
  • Speed displayed in mph (factor 2.2369)
  • Opponent named drag_opponent in scene tree
  • Supports JATO and nitrous oxide activation for AI

Additional Exports

  • M.startRace - (undocumented)

See Also

  • Freeroam Big Map Markers - Related reference
  • Freeroam Big Map Mode - Related reference
  • Freeroam Big Map POI Provider - Related reference
  • Freeroam Guide - Guide

Freeroam Crash Cam Mode Loader

Conditionally loads/unloads the crash cam extension based on the `enableCrashCam` user setting. Acts as a lightweight settings-reactive loader.

Freeroam Facilities

Manages level facilities (garages, gas stations, dealerships, computers, delivery providers, dragstrips). Loads facility definitions from JSON, provides parking spot lookups, and formats facilities as

On this page

Internal StatePublic APIHooksRace FlowJump Start DetectionDisplay SystemSupported LevelsNotesAdditional ExportsSee Also