Jump to content
laxemann

L_ambiDrive - Civil traffic, performant and MP-Compatible

Recommended Posts

L_ambiDrive by LAxemann

(Formerly L_Civs. For AI Civilian population, check out L_ambiCivs)


A lightweight script suite that allows multiplayer-compatible civil traffic.
Civilians will drive around on the map and de-spawn again if the closest player exceeds a specified distance.
Features blacklisting areas and players.
The script runs COMPLETELY SERVER-SIDE.


Quick Start
1.   Drop the "L_ambiDrive" folder as well as the "initServer.sqf" into your mission folder. That's it.
1.1  If you already got an initServer.sqf, paste the following anywhere into the file:
     #include "L_ambiDrive\init.sqf"

    
Quick configuration
1. Navigate into the L_ambiDrive folder within your mission folder. You may want to look into three files: "config.sqf","classes.sqf" and "blacklists.sqf"
2. Config.sqf: Basic settings like spawn distance and speed limits. (Tip: Lower the city speed limit if the map features sharp turns within cities)
3. Classes.sqf: Vehicle and civilian classes that will be spawned.
4. Blacklist.sqf: Blacklisting areas vehicles shouldn't spawn in and players that should be ignored by the script.
!! All parameters can be changed on the fly during a mission !!

 

Requirements

CBA_A3: https://steamcommunity.com/sharedfiles/filedetails/?l=german&id=450814997


Known issues
- ArmA will be ArmA. Vehicles might crash into each other and/or the terrain. The script detects stuck vehicles but can only do so much to un-stuck them.


License
You are free to modify the script to your liking within your mission, but please mention the modification.
Uploading a modification of the script as a "standalone" version is not permitted.

 

Download:

https://github.com/LAxemann/L_ambiDrive (1.05)

  • Like 7
  • Thanks 4

Share this post


Link to post
Share on other sites

Hey Laxemann! Thank you very much for this amazing script!

 

22 hours ago, laxemann said:

Known issues
- ArmA will be ArmA. Vehicles might crash into each other and/or the terrain. The script detects stuck vehicles but can only do so much to un-stuck them.

 

This is a peace of code I run on the vehicles to check for objects in front of them so they don't crash into each other or run pedestrians down.

As an added bonus they will randomly blow their horns in anger if something or someone gets in their way.

Spoiler

 


	if (count nearestObjects[_veh getRelPos [5,0],["Man","Car"],4] > 0) then {
	doStop _veh;
		if (selectRandom[0,0,0,1] isEqualto 1) then {
			driver _veh forceWeaponFire [currentWeapon _veh ,currentWeapon _veh ];
		};
	_veh setBehaviour "SAFE";
	_veh setSpeedMode "LIMITED";
	_veh doMove (getPos _nearestRoad);
    _veh limitSpeed 30;
    };

 

 

 

 

I hope that bit of script helps making an amazing work even better 😉

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, LSValmont said:

Hey Laxemann! Thank you very much for this amazing script!

 

 

This is a peace of code I run on the vehicles to check for objects in front of them so they don't crash to each other or run pedestrians down.

As an added bonus they will randomly blow their horns in anger if something or someone gets in their way.

  Hide contents

 



	if (count nearestObjects[_veh getRelPos [5,0],["Man","Car"],4] > 0) then {
	doStop _veh;
		if (selectRandom[0,0,0,1] isEqualto 1) then {
			driver _veh forceWeaponFire [currentWeapon _veh ,currentWeapon _veh ];
		};
	_veh setBehaviour "SAFE";
	_veh setSpeedMode "LIMITED";
	_veh doMove (getPos _nearestRoad);
    _veh limitSpeed 30;
    };

 

 

 

 

I hope that bit of script helps making an amazing work even better 😉

 

Hey mate,

 

thanks for the snippet! I really like the idea (especially with the random horn :D).

A big concern for the script is performance, which is why it only checks in every few seconds on the vehicles.

I might implement it as a configurable feature. 🙂

  • Like 2

Share this post


Link to post
Share on other sites

So @icebreakr asked me if ambiDrive also includes handling of civilians on foot, which it doesn't .😛

Got home late and drank too much coffee soooo....

 

Edit:
First release:

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

GitHub Update to 1.05:

Now features L_ambiCivs' "Elevation scaling", meaning the spawn/despawn distances to players increase when they are above the vehicle's position.

You can define both the maximum factor for this scaling and the height it needs to reach the maximum scaling.

The feature is optional and ON by default.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you so much!

I understand from your Monday 06:04 AM post that you made two different scripts for civilians and cars. 

I have a newbie scripting question:
Hypothetically, if I wanted my combined arms invasion scenario of (populated) Kavala to be complete, I would need to run both this script and your "L_ambiCivs" script on the same server, yes? Can both scripts run simultaneously without error?

Share this post


Link to post
Share on other sites
17 hours ago, Melody_Mike said:

Thank you so much!

I understand from your Monday 06:04 AM post that you made two different scripts for civilians and cars. 

I have a newbie scripting question:
Hypothetically, if I wanted my combined arms invasion scenario of (populated) Kavala to be complete, I would need to run both this script and your "L_ambiCivs" script on the same server, yes? Can both scripts run simultaneously without error?

 

Correct and they absolutely can! 🙂

Make sure to get the latest version from gitHub. 🙂

Share this post


Link to post
Share on other sites

May I ask for a chance to spawn parked vehicles also?

 

Like 

L_ambiDrive_maxCivs = 20;

L_ambiDrive_parkedPercent = 10;

 

End result: 

2 cars will spawn parked (no drivers) and 18 will spawn on the move.

 

Also ambiDrive is lacking this config vars that ambiCivs have:

L_ambiCivs_deleteCheckInterval = 4; // How often the script checks in on spawned civilians in seconds

L_ambiCivs_spawnCheckInterval = 1; // How often the script will try to spawn a new civilian in seconds

 

Those would also be very useful for ambiDrive so that to delay the spawning/despawning of civ vehicles!

 

Thank you!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×