RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Rally Audio ManagerRally Camera Path PlayerRally ClientRally Cut CaptureRally EnumsRally Extension HelperRally GeometryRally ManagerRecce ManagerRecce AppRecce SettingsRally Settings ManagerSnap-to-RoadTraffic Exclusion ZonesRally UtilityRally Vehicle CaptureRally Vehicle Tracker
Rally Loop PenaltiesRally AttemptsRally Event LogRally Loop ManagerRoad Section Penalty KeeperRally Schedule UtilitiesSpeeding DetectorStaged Countdown TestStaged Countdown Utilities

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 Extensionsgameplayrallyloop

Rally Attempts

Creates and saves mission attempt records for rally loop completions and DNFs. Integrates with the mission progress system to record timing data, vehicle info, and stage times.

Creates and saves mission attempt records for rally loop completions and DNFs. Integrates with the mission progress system to record timing data, vehicle info, and stage times.


Public API

FunctionSignatureReturnsDescription
M.createRallyLoopAttemptForFinish(mgr)attempt, totalChangeCreates a normal completion attempt with timing + vehicle data
M.createRallyLoopAttemptForDnf(mgr, dnfType)attempt, totalChangeCreates a DNF attempt (restart/abandon) with vehicle data

Internals

Helper Functions

FunctionDescription
createAttempt()Creates a new attempt via gameplay_missions_progress.newAttempt('attempted', {})
addDnfData(mgr, attempt, dnfType)Sets attempt.dnf = true and stores DNF type + mission ID
addTimingData(mgr, attempt)Stores total penalty, total time, and individual SS stage times (timeSS1, timeSS2, etc.)
addVehicleData(attempt)Records vehicle model, config path, and whether config is a .pc file
aggregate(attempt, missionId)Calls gameplay_missions_progress.aggregateAttempt to update progress stats
save(missionId)Persists mission save data via gameplay_missions_progress.saveMissionSaveData

Attempt Data Structure

-- Finish attempt
attempt.data = {
  penalty = number,       -- total penalty seconds
  totalTime = number,     -- total rally time
  timeSS1 = number,       -- stage 1 time (optional)
  timeSS2 = number,       -- stage 2 time (optional)
  -- ...additional SS times
}
attempt.vehicle = {
  model = "jbeamName",
  config = "path/to/config",
  isConfigFile = boolean
}

-- DNF attempt
attempt.dnf = true
attempt.data = {
  dnfType = "restart"|"abandon",
  dnfMissionId = "mission-id"
}

How It Works

  1. Finish flow: createRallyLoopAttemptForFinish → creates attempt → adds timing (penalty, total time, per-stage times from event log) → adds vehicle data → aggregates → saves
  2. DNF flow: createRallyLoopAttemptForDnf → creates attempt → marks DNF with type → adds vehicle data → aggregates → saves
  3. Both flows get the mission ID from mgr:getRallyLoopMissionId() and return nil if unavailable
  4. Stage times are extracted from the event log via getStageTimes() and stored as timeSS{n} keys

Usage Example

local RallyAttempts = require('gameplay/rally/loop/rallyAttempts')

-- On rally completion
local attempt, change = RallyAttempts.createRallyLoopAttemptForFinish(loopManager)

-- On rally abandon
local attempt, change = RallyAttempts.createRallyLoopAttemptForDnf(loopManager, "abandon")

See Also

  • Rally Loop Penalties - Related reference
  • Rally Event Log - Related reference
  • Rally Loop Manager - Related reference
  • Gameplay Systems Guide - Guide

Rally Loop Penalties

Calculates time control penalties for rally loop events. Determines if a driver arrived early, on-time, or late at a checkpoint and computes penalty amounts (+10 per minute deviation).

Rally Event Log

Class-based event logger for rally loop gameplay. Records all events (timecards, penalties, recoveries, flips) and maintains aggregated totals. Events are grouped by `eventGroup` for per-stage queryin

On this page

Public APIInternalsHelper FunctionsAttempt Data StructureHow It WorksUsage ExampleSee Also