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
Locations DetectorMission ManagerMissionsMission Screen UIPOI TestProgressMission Start TriggerUnlocks

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 Extensionsgameplaymissions

Unlocks

Reference for `gameplay_missions_unlocks`, which evaluates start/visible conditions, manages unlock dependencies between missions, and computes mission ordering depth.

Reference for gameplay_missions_unlocks, which evaluates start/visible conditions, manages unlock dependencies between missions, and computes mission ordering depth.


Module Exports (M)

Unlock Evaluation

FunctionSignatureDescription
updateUnlockStatus(missions?)Evaluates startable/visible conditions for all missions
conditionMet(condition) → {met, condition, nested, label, hidden}Recursively evaluates a condition tree

Unlock Comparison

FunctionSignatureDescription
getSimpleUnlockedStatus() → tableSnapshots current unlock state of all missions
getUnlockDiff(before, after) → tableCompares two snapshots to find changes
getMissionBasedUnlockDiff(mission, diff) → tableGets unlock status of missions directly downstream

Dependency Analysis

FunctionSignatureDescription
setUnlockForwardBackward(missions)Builds forward/backward dependency links and depth ordering
getMissionsForCondition(cond, list)Recursively extracts referenced mission IDs from conditions
getBranchLevelForCondition(cond, list)Recursively extracts branch level requirements

Sorting

FunctionSignatureDescription
depthIdSort(a, b) → boolSort comparator: depth first, then ID
depthIdSortUsingIds(aId, bId) → boolSame but takes IDs instead of mission objects
M.conditionMet(condition)-
M.depthIdSort(a,b)-
M.depthIdSortUsingIds(aId,bId)-
M.getBranchLevelForCondition(cond, list)-
M.getMissionBasedUnlockDiff(mission, diff)-
M.getMissionsForCondition(cond, list)-
M.getSimpleUnlockedStatus()-
M.getUnlockDiff(before, after)-
M.onExtensionLoaded()-
M.setUnlockForwardBackward(missions)-
M.startConditionMetvalue-
M.updateUnlockStatus(missions)-

Condition System

Conditions are loaded from /gameplay/missions/unlocks/conditions/*.lua files on extension load. Each condition type provides:

{
  info = "Description",
  editorFunction = "editorFnName",  -- optional
  getLabel = function(condition) → string/table end,
  conditionMet = function(condition) → bool, nested? end,
  hidden = bool  -- optional, hides condition from UI
}

Unlock Evaluation Flow

local function updateUnlockStatus(missions)
  -- Pass 1: Evaluate startCondition for each mission
  for _, mission in ipairs(missions) do
    mission.unlocks.startable = conditionMet(mission.startCondition).met
    -- Career+freeroam missions: always startable outside career
  end

  -- Pass 2: Evaluate visibleCondition
  for _, mission in ipairs(missions) do
    if visibleCondition.type == 'automatic' then
      -- Visible if any backward-linked mission is startable
      -- (or if no backward links exist)
    else
      mission.unlocks.visible = conditionMet(mission.visibleCondition).met
    end
  end
end

Dependency & Depth Ordering

setUnlockForwardBackward(missions):

  1. Extract dependencies - Parse startCondition for mission references (missionPassed/missionCompleted)
  2. Double-link - Build forward links (which missions does this unlock?)
  3. Extract branch levels - Parse conditions for branchLevel and league requirements
  4. Propagate branch data - Forward-propagate max branch level and branch tags
  5. Compute depth - BFS from root missions (no backward links), depth = distance from root
  6. Shift by branch level - Offset depth by accumulated branch level thresholds

This produces mission.unlocks.depth used for UI ordering.


Unlock Diff Structure

{
  list = { {missionId, change = {{key, old, new}, ...}}, ... },
  byId = { [missionId] = change },
  missionsList = { {name, id}, ... }  -- newly startable missions
}

Key Behaviors

  • Career missions with showInCareer and showInFreeroam both true are always startable/visible outside career
  • 'automatic' visible condition: visible if any predecessor is startable (or no predecessors)
  • Condition types loaded dynamically from condition files (see careerConditions, genericConditions, missionConditions, vehicleConditions)
  • Depth ordering ensures missions with higher branch level requirements appear later in UI

See Also

  • missions/locationsDetector - Nearby Mission Location Detection - Related reference
  • missions/missionManager - Mission Lifecycle Manager - Related reference
  • missions/missionScreen - Mission UI Screen & Starting Options - Related reference
  • Gameplay Systems Guide - Guide

Mission Start Trigger

Reference for `gameplay_missions_startTrigger`, which parses mission start triggers into location data and clusters nearby missions for the POI/marker system.

Base Mission

Reference for the base mission type, the simplest mission class providing minimal lifecycle hooks. Returned by `gameplay_missions_missions.baseMission()`.

On this page

Module Exports (M)Unlock EvaluationUnlock ComparisonDependency AnalysisSortingCondition SystemUnlock Evaluation FlowDependency & Depth OrderingUnlock Diff StructureKey BehaviorsSee Also