Engima's Traffic v1.7
by Engima
Description:
Script that adds dynamic traffic to any map. Vehicles are spawned in out of sight for the player(s) and are removed again when they get at a certain distance.
You can customize traffic by editing the file Engima/Traffic/ConfigAndStart.sqf. Customizable parameters are side, vehicle classes, amount of vehicles, spawn distances, crew's skill, map area, and you can also add callbacks that fire when vehicles are spawning and being removed.
Works in SP, MP, Dedi and JIP.
Download:
Download Link at Armaholic
Also released as CPack Engima.Traffic for the TypeSqf Editor
Installation:
1. Copy folder "Engima" to root of your mission folder.
2. Create the file "init.sqf" in your mission folder (if you don't already have it). Add the following line to the top of the init.sqf:
call compile preprocessFileLineNumbers "Engima\Traffic\Init.sqf";
3. Customize the traffic behavior in the file "Engima\Traffic\ConfigAndStart.sqf".
Documentation and a complete reference of set up parameters can be found in file "Engima\Traffic\Documentation.txt";
Usage:
Here is an example of how to initialize the traffic in the file Engima/Traffic/ConfigAndStart.sqf:
// Set traffic parameters.
_parameters = [
["SIDE", east],
["VEHICLES", ["O_MRAP_02_F", "O_Quadbike_01_F", "O_Truck_02_transport_F"]],
["VEHICLES_COUNT", 10],
["MAX_GROUPS_COUNT", 12],
["MIN_SPAWN_DISTANCE", 800],
["MAX_SPAWN_DISTANCE", 1200],
["MIN_SKILL", 0.4],
["MAX_SKILL", 0.6],
["AREA_MARKER", "EnemyMarker1"],
["HIDE_AREA_MARKER", true],
["ON_UNIT_CREATING", { true }],
["ON_UNIT_CREATED", {}],
["ON_UNIT_REMOVING", {}],
["DEBUG", false]
];
// Start an instance of the traffic
_parameters spawn ENGIMA_TRAFFIC_StartTraffic;
You may create more than one instance of the script, if you want different kinds of traffic with different behavior. See the documentation for how that is done.
How to update from older version:
Manually:
1. Back up your own customization file (Engima\Traffic\ConfigAndStart.sqf).
2. Replace the folder Engima\Traffic with the corresponding folder in the download package.
3. Replace the original ConfigAndStart.sqf with your own ConfigAndStart.sqf that was backed up in step 1.
TypeSqf:
1. Open the CPack console and run command "update Engima.Traffic".
Change log:
v1.7
- Fixed: The same car had different random texture on different clients. Now all players see the same texture on all cars.
- Fixed: Script error when no players are in the mission.
v1.6.1
- Adjusted vehicle spawn distances.
- Improved traffic flow by removing immobile vehicles outside visual range.
- Fixed: Many traffic units not moving at all on maps with several small islands (like Tanoa).
- Fixed: Units get stuck on small paths in the woods (like on Tanoa). Paths are now ignored.
- Fixed: Number of vehicles not relative to traffic area coverage in some cases.
- Added callback ON_UNIT_CREATING which fires right before a vehicle spawns.
- Replaced callback ON_SPAWN_CALLBACK with ON_UNIT_CREATED.
- Replaced callback ON_REMOVE_CALLBACK with ON_UNIT_REMOVING.
- Fixed: Vehicles tend to spawn more often behind the players than ahead of them.
- Added support for headless client.
- Script no longer tries to terminate scripts executed in spawn callback.
v1.30
- Possibility to select areas (markers) where the traffic will be.
- Better performance on large maps (like Altis).
v1.25
- First version published on Armaholic.com.
Licence:
Free to use, but if you release anything with it, please write my name somewhere suitable.
Requirements:
Arma 3.