Simplistic Civilian Traffic System for Reforger.
Spawns civilian cars, drives them somewhere, despawns them. Raises some events for threat level changes:
SCR_TrafficEvents.OnCivilianEvent.Invoke(owner.GetOrigin(), "gunfight"); and
SCR_TrafficEvents.OnCivilianEvent.Invoke(owner.GetOrigin(), "killed");
handing over the position of the event to any script.
{
"m_bShowDebugMarkers": false,
"m_TrafficSpawnSettings": {
"m_bEnableTraffic": true,
"m_sTargetFaction": "CIV",
"m_bUseCatalog": true
},
"m_TrafficLimitSettings": {
"m_iMaxTrafficCount": 15,
"m_fTrafficSpawnRange": 2500.0,
"m_fPlayerSafeRadius": 500.0
}
}All traffic fields sit at the top level of the mission header JSON — there is no wrapper object.
m_bShowDebugMarkers(bool, default:false)
Display debug lines and markers in Game Master view. Shows waypoint paths and vehicle destinations for troubleshooting.
-
m_bEnableTraffic(bool, default:true)
Master switch for the entire traffic system. Set tofalseto disable all traffic spawning. -
m_sTargetFaction(string, default:"CIV")
Faction key to use for spawned traffic. Vehicles and drivers will be assigned to this faction. Common values:"CIV","US","USSR". -
m_bUseCatalog(bool, default:false)
Whentrue, dynamically loads vehicles from the Entity Catalog that matchm_sTargetFaction.
Whenfalse, uses hardcoded S1203 van variants (see "Adding Custom Vehicles" below).
-
m_iMaxTrafficCount(int, default:10)
Maximum number of traffic vehicles allowed on the map simultaneously. -
m_fTrafficSpawnRange(float, default:2000.0)
Maximum distance from any player where traffic can spawn or remain active (in meters).
Vehicles beyond this range will despawn to save performance. -
m_fPlayerSafeRadius(float, default:400.0)
Minimum distance from players where traffic can spawn (in meters).
Prevents vehicles from popping into existence right in front of players.
Set m_bUseCatalog to true in your mission header. The system will automatically find all vehicles assigned to the specified faction.
Requirements:
- Vehicles must be registered in the faction's Entity Catalog (the CIV faction catalog is populated by default in vanilla Reforger)
Pros: Dynamic, no code changes needed
Cons: Less control over specific vehicle selection
If m_bUseCatalog is false, the system uses a hardcoded array of vehicle prefabs.
To add custom vehicles:
- Open
SCR_AmbientTrafficManager.c - Find the
m_aVehicleOptionsarray (around line 68) - Add your vehicle prefab paths:
protected ref array<ResourceName> m_aVehicleOptions = {
"{D2BCF98E80CF634C}Prefabs/Vehicles/Wheeled/S1203/S1203_cargo_beige.et",
"{YOUR_VEHICLE_GUID}Prefabs/Path/To/Your/Vehicle.et",
"{ANOTHER_VEHICLE}Prefabs/Path/To/Another.et"
};