Flow Mission
Reference for the flowgraph mission type, the primary mission class used by most BeamNG missions. Extends `baseMission` with flowgraph manager integration, vehicle/traffic/environment setup modules, c
Reference for the flowgraph mission type, the primary mission class used by most BeamNG missions. Extends baseMission with flowgraph manager integration, vehicle/traffic/environment setup modules, career star/reward support, and custom script loading.
Module Export
Returns a constructor function (derivedClass, ...) that creates a flowMission instance inheriting from baseMission's C class. Accessible via gameplay_missions_missions.flowMission().
Class C - Key Methods
Lifecycle
| Method | Signature | Description |
|---|---|---|
onStart | C:onStart() | Loads FG manager, sets variables, starts flowgraph, calls custom script |
onUpdate | C:onUpdate(dtReal, dtSim, dtRaw) | Calls script onUpdate, applies wind to vehicles |
onStop | C:onStop(data) | Stops FG manager, aggregates abandoned attempt, calls script onStop |
attemptAbandonMission | C:attemptAbandonMission() → bool | Delegates to FG's onRequestAbandon hook if available |
Setup & Configuration
| Method | Signature | Description |
|---|---|---|
getCommonSettingsData | C:getCommonSettingsData() → table | Builds vehicle/traffic/environment user settings UI data |
processCommonSettings | C:processCommonSettings(flatSettings) | Applies user settings to setup modules |
processUserSettings | C:processUserSettings(settings) | Stores user settings for later use |
setBackwardsCompatibility | C:setBackwardsCompatibility(keyAliases) | Migrates old mission formats (vehicle modes, timeOfDay) |
setPreviewsForCustomVehicles | C:setPreviewsForCustomVehicles(userSettings) | Updates thumbnails for custom vehicle selections |
Flowgraph Integration
| Method | Signature | Description |
|---|---|---|
setupFlowgraphManager | C:setupFlowgraphManager(fgFile, variables) | Loads FG project, sets mission/progress variables |
addOrSetVariable | C:addOrSetVariable(name, value) → err | Sets a flowgraph variable (bool/string/number/vec3/quat) |
retrieveProgressFromFlowgraph | C:retrieveProgressFromFlowgraph() | Reads progress variables back from FG |
Career
| Method | Signature | Description |
|---|---|---|
getEntryFee | C:getEntryFee(userSettings) → table|nil | Returns entry fee (attribute amounts) |
getDynamicStarReward | C:getDynamicStarReward(key, userSettings) | Override point for dynamic star rewards |
getGameContextUiButtons | C:getGameContextUiButtons() → table | Gathers UI buttons from FG nodes |
getRules | C:getRules() → table | Loads HTML rule pages from mission layers |
showRulesAsPopups | C:showRulesAsPopups() | Displays rules as intro popups |
Setup Modules
Missions configure these via setupModules:
Vehicles
enabled- whether vehicle setup is activevehicles- array of{model, config, configPath, paintName}includePlayerVehicle- allow player's own carprioritizePlayerVehicle- default to player's car- User setting key:
setupModuleVehicles
Traffic
enabled,useTraffic,usePrevTraffic,useSimpleVehs,useGameOptionsamount,activeAmount,parkedAmount,respawnRatecustomGroupFile- vehicle group JSON- User setting key:
setupModuleTraffic
Environment
enabled,time,timeScale,fogDensity,windSpeed,windDirAngletodUserSetting- enable time-of-day user setting- User setting key:
setupModuleEnvironmentTime
How It Works
-- Mission start flow:
function C:onStart()
-- 1. Log issues for debugging
-- 2. Call onPreStart() if defined
-- 3. Merge fgVariables + oneOffVariables
-- 4. Call preprocessMissionTypeData() if defined
-- 5. setupFlowgraphManager(fgPath, variables)
-- 6. Set progress variables from saved progress
-- 7. Set user settings as FG variables
-- 8. Start FG manager
-- 9. Call script:onStart() if loaded
endKey Behaviors
- Custom scripts loaded from
missionFolder/script.lua- instantiated with{mission = mission} - FG variables only set if they already exist in the flowgraph (no auto-creation)
ignoreUserSettingsKeyForActiveStarsexcludes certain settings from star eligibility checks- Backwards compatibility handles old
modevehicle setup,timeOfDaynumber format, and old branch names onFlowgraphStateStarted/Stoppedhooks forwarded to custom scripts- Vehicle hooks (
onVehicleReset) forwarded viascriptHookstable
See Also
- missionTypes/baseMission - Base Mission Type Constructor - Related reference
- missionTypes/editorHelper - Mission Editor UI Element System - Related reference
- Gameplay Systems Guide - Guide
Editor Helper
Reference for the editor helper class that provides a rich set of UI elements for editing mission type data in the mission editor. This is the backbone of all mission editor panels.
Bus Mode Missions
Reference for the bus mode procedural mission generator that creates missions from bus route data files.