API ReferenceGE ExtensionsgameplaymissionsproceduralMissionGenerators
Bus Mode Missions
Reference for the bus mode procedural mission generator that creates missions from bus route data files.
Reference for the bus mode procedural mission generator that creates missions from bus route data files.
Module Exports (M)
| Function | Signature | Description |
|---|---|---|
generate | () → table | Generates bus mode mission data from scenario bus route files |
How It Works
local function generate()
-- 1. Get all levels with bus scenarios
local data = scenario_scenariosLoader.getLevels('bus')
for _, level in ipairs(data) do
-- 2. Load all .buslines.json files for the level
local busLineFiles = FS:findFiles('/levels/'..level.levelName..'/buslines/', '*.buslines.json')
-- 3. Index routes by composite key: routeID + variance
for _, route in pairs(busLine.routes) do
routeData[route.routeID .. route.variance] = route
end
-- 4. For each scenario, build a mission from route data
for _, scenario in ipairs(level.scenarios) do
local mission = getBaseMission()
mission.id = levelName..'-'..routeID.."-"..variance.."-procedural"
mission.missionType = "busMode"
-- 5. Set missionTypeData with route details
mission.missionTypeData = {
routeId = route.routeID,
variance = route.variance,
tasklist = route.tasklist,
navhelp = route.navhelp,
model = route.vehicle.model,
config = route.vehicle.config,
-- Reversed route for continuation
rtasklist = reverseRoute.tasklist,
rnavhelp = reverseRoute.navhelp,
}
-- 6. Set start trigger from bus spawn location
mission.startTrigger.pos = vec3(route.spawnLocation.pos)
mission.startTrigger.rot = quat(route.spawnLocation.rot)
end
end
return missions
endGenerated Mission Structure
| Field | Value |
|---|---|
missionType | "busMode" |
retryBehaviour | "infiniteRetries" |
careerSetup.defaultStarKeys | {'justFinish', 'noAccident'} |
careerSetup.showInCareer | false |
careerSetup.showInFreeroam | true |
description | Localized with bus stop count context |
thumbnailFile | /gameplay/missionTypes/busMode/thumbnail.jpg |
M.generate | () |
Key Behaviors
- Routes are identified by composite key
routeID + variance(e.g.,"route1a","route1b") - Reverse route (opposite variance) is included for mission continuation
- Spawn rotation handles both
rotAngAxisFandquatformats missionStartTriggerPoscan override the start position separately from the vehicle spawn- The generator only runs for levels that have bus route data files
- Generated missions are marked as procedural and get sanitized by the mission system
See Also
- proceduralMissionGenerators/timeTrialMissions - Time Trial Mission Generator - Related reference
- Gameplay Systems Guide - Guide
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
Time Trial Missions
Reference for the time trial procedural mission generator that converts quickrace tracks into playable time trial missions.