laxemann 1673 Posted September 30, 2019 L_ambiCivs by LAxemann (For AI traffic, check out L_ambiDrive) A lightweight script suite that allows multiplayer-compatible civil population. Civilians will walk around urban areas after spawning into "their" house. Features a "script hook" for running a function on every spawned civilian or its assigned house. Features blacklisting areas and players. The script runs COMPLETELY SERVER-SIDE. Quick Start 1. Drop the "L_ambiCivs" 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_ambiCivs\init.sqf" Quick configuration 1. Navigate into the L_ambiCivs 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 distances and behaviour. (Tip: Increase the check intervals in case you experience performance issues with a large amount of players) 2.1: Assigning a function name to L_ambiCivs_customInitFunction will make the function run when a civilian spawns, passing the argument [civilian, assigned house]. 3. Classes.sqf: Civilian classes that will be spawned. 4. Blacklist.sqf: Blacklisting areas civilians 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 / limitations - The script focuses on performance and by default does a simple job - it makes AI civilians walk around cities. Advanced behaviour can be scripted manually via the script hook. - Spawning units in ArmA always causes a micro-lag. The script is very efficient and can spawn civilians in a very rapid order by decreasing the check-intervals, but bear in mind that the micro-stuttering from spawning units will appear a lot more often this way. 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_ambiCivs (0.975) 7 4 Share this post Link to post Share on other sites
Whalenator 15 Posted September 30, 2019 Headless support? 1 Share this post Link to post Share on other sites
SpartanSix 367 Posted October 7, 2019 Hey Lax, been waiting for something like this for quite sometime, I do have a question though, how would I go about randomizing the civilians attire, for example when using 3CB factions, they only provide 4-5 civilian types but they randomize the clothing and so forth, and when using Bohemia's civilian modules I place the following in the module's init field to get a randomizing effect; _this adduniform selectRandom ["UK3CB_TKC_C_U_01","UK3CB_TKC_C_U_01_B","UK3CB_TKC_C_U_01_C","UK3CB_TKC_C_U_01_D","UK3CB_TKC_C_U_01_E","UK3CB_TKC_C_U_02", "UK3CB_TKC_C_U_02_B","UK3CB_TKC_C_U_02_C","UK3CB_TKC_C_U_02_D","UK3CB_TKC_C_U_02_E","UK3CB_TKC_C_U_03","UK3CB_TKC_C_U_03_B","UK3CB_TKC_C_U_03_C","UK3CB_TKC_C_U_03_D","UK3CB_TKC_C_U_03_E","UK3CB_TKC_C_U_06","UK3CB_TKC_C_U_06_B","UK3CB_TKC_C_U_06_C","UK3CB_TKC_C_U_06_D","UK3CB_TKC_C_U_06_E"]; _this addheadgear selectRandom ["UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_01_2","UK3CB_TKC_H_Turban_01_3", "UK3CB_TKC_H_Turban_01_4","UK3CB_TKC_H_Turban_01_5","UK3CB_TKC_H_Turban_02_1","UK3CB_TKC_H_Turban_02_2","UK3CB_TKC_H_Turban_02_3", "UK3CB_TKC_H_Turban_02_4","UK3CB_TKC_H_Turban_02_5","UK3CB_TKC_H_Turban_03_1","UK3CB_TKC_H_Turban_03_2","UK3CB_TKC_H_Turban_03_3", "UK3CB_TKC_H_Turban_03_4","UK3CB_TKC_H_Turban_03_5","UK3CB_TKC_H_Turban_04_1","UK3CB_TKC_H_Turban_04_2","UK3CB_TKC_H_Turban_04_3", "UK3CB_TKC_H_Turban_04_4","UK3CB_TKC_H_Turban_04_5","UK3CB_TKC_H_Turban_05_1","UK3CB_TKC_H_Turban_05_2","UK3CB_TKC_H_Turban_05_3", "UK3CB_TKC_H_Turban_05_4","UK3CB_TKC_H_Turban_05_5","UK3CB_TKC_H_Turban_06_1","UK3CB_TKC_H_Turban_06_2","UK3CB_TKC_H_Turban_06_3", "UK3CB_TKC_H_Turban_06_4","UK3CB_TKC_H_Turban_06_5"]; _this setFace selectRandom ["PersianHead_A3_01", "PersianHead_A3_02", "PersianHead_A3_03"]; _this setSpeaker selectRandom ["Male01PER", "Male02PER", "Male03PER"]; removeGoggles _this; Appreciate your hard work mate 👍 1 Share this post Link to post Share on other sites
laxemann 1673 Posted October 8, 2019 On 10/7/2019 at 1:35 PM, SpartanSix said: Hey Lax, been waiting for something like this for quite sometime, I do have a question though, how would I go about randomizing the civilians attire, for example when using 3CB factions, they only provide 4-5 civilian types but they randomize the clothing and so forth, and when using Bohemia's civilian modules I place the following in the module's init field to get a randomizing effect; _this adduniform selectRandom ["UK3CB_TKC_C_U_01","UK3CB_TKC_C_U_01_B","UK3CB_TKC_C_U_01_C","UK3CB_TKC_C_U_01_D","UK3CB_TKC_C_U_01_E","UK3CB_TKC_C_U_02", "UK3CB_TKC_C_U_02_B","UK3CB_TKC_C_U_02_C","UK3CB_TKC_C_U_02_D","UK3CB_TKC_C_U_02_E","UK3CB_TKC_C_U_03","UK3CB_TKC_C_U_03_B","UK3CB_TKC_C_U_03_C","UK3CB_TKC_C_U_03_D","UK3CB_TKC_C_U_03_E","UK3CB_TKC_C_U_06","UK3CB_TKC_C_U_06_B","UK3CB_TKC_C_U_06_C","UK3CB_TKC_C_U_06_D","UK3CB_TKC_C_U_06_E"]; _this addheadgear selectRandom ["UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_01_2","UK3CB_TKC_H_Turban_01_3", "UK3CB_TKC_H_Turban_01_4","UK3CB_TKC_H_Turban_01_5","UK3CB_TKC_H_Turban_02_1","UK3CB_TKC_H_Turban_02_2","UK3CB_TKC_H_Turban_02_3", "UK3CB_TKC_H_Turban_02_4","UK3CB_TKC_H_Turban_02_5","UK3CB_TKC_H_Turban_03_1","UK3CB_TKC_H_Turban_03_2","UK3CB_TKC_H_Turban_03_3", "UK3CB_TKC_H_Turban_03_4","UK3CB_TKC_H_Turban_03_5","UK3CB_TKC_H_Turban_04_1","UK3CB_TKC_H_Turban_04_2","UK3CB_TKC_H_Turban_04_3", "UK3CB_TKC_H_Turban_04_4","UK3CB_TKC_H_Turban_04_5","UK3CB_TKC_H_Turban_05_1","UK3CB_TKC_H_Turban_05_2","UK3CB_TKC_H_Turban_05_3", "UK3CB_TKC_H_Turban_05_4","UK3CB_TKC_H_Turban_05_5","UK3CB_TKC_H_Turban_06_1","UK3CB_TKC_H_Turban_06_2","UK3CB_TKC_H_Turban_06_3", "UK3CB_TKC_H_Turban_06_4","UK3CB_TKC_H_Turban_06_5"]; _this setFace selectRandom ["PersianHead_A3_01", "PersianHead_A3_02", "PersianHead_A3_03"]; _this setSpeaker selectRandom ["Male01PER", "Male02PER", "Male03PER"]; removeGoggles _this; Appreciate your hard work mate 👍 Hey dude, happy you're happy, haha! What you want can be achieved with the "script hook" I implemented. In the "config.sqf" (in the L_ambiCivs folder), there is a line called L_ambiCivs_customInitFunction = ""; If you change the "" to the name of your function, e.g. L_ambiCivs_customInitFunction = MyLittleFunction; the function will be called on every spawned civilian, with the arguments [Spawned Civilian, Assigned House]. . . . . . . No clue how much you're into scripting in ArmA, so here's a quick and dirty setUp that should work. In your init.sqf, put the following: S6_fnc_testFunction = { params ["_civ"]; _civ adduniform selectRandom ["UK3CB_TKC_C_U_01","UK3CB_TKC_C_U_01_B","UK3CB_TKC_C_U_01_C","UK3CB_TKC_C_U_01_D","UK3CB_TKC_C_U_01_E","UK3CB_TKC_C_U_02", "UK3CB_TKC_C_U_02_B","UK3CB_TKC_C_U_02_C","UK3CB_TKC_C_U_02_D","UK3CB_TKC_C_U_02_E","UK3CB_TKC_C_U_03","UK3CB_TKC_C_U_03_B","UK3CB_TKC_C_U_03_C","UK3CB_TKC_C_U_03_D","UK3CB_TKC_C_U_03_E","UK3CB_TKC_C_U_06","UK3CB_TKC_C_U_06_B","UK3CB_TKC_C_U_06_C","UK3CB_TKC_C_U_06_D","UK3CB_TKC_C_U_06_E"]; _civ addheadgear selectRandom ["UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_01_2","UK3CB_TKC_H_Turban_01_3", "UK3CB_TKC_H_Turban_01_4","UK3CB_TKC_H_Turban_01_5","UK3CB_TKC_H_Turban_02_1","UK3CB_TKC_H_Turban_02_2","UK3CB_TKC_H_Turban_02_3", "UK3CB_TKC_H_Turban_02_4","UK3CB_TKC_H_Turban_02_5","UK3CB_TKC_H_Turban_03_1","UK3CB_TKC_H_Turban_03_2","UK3CB_TKC_H_Turban_03_3", "UK3CB_TKC_H_Turban_03_4","UK3CB_TKC_H_Turban_03_5","UK3CB_TKC_H_Turban_04_1","UK3CB_TKC_H_Turban_04_2","UK3CB_TKC_H_Turban_04_3", "UK3CB_TKC_H_Turban_04_4","UK3CB_TKC_H_Turban_04_5","UK3CB_TKC_H_Turban_05_1","UK3CB_TKC_H_Turban_05_2","UK3CB_TKC_H_Turban_05_3", "UK3CB_TKC_H_Turban_05_4","UK3CB_TKC_H_Turban_05_5","UK3CB_TKC_H_Turban_06_1","UK3CB_TKC_H_Turban_06_2","UK3CB_TKC_H_Turban_06_3", "UK3CB_TKC_H_Turban_06_4","UK3CB_TKC_H_Turban_06_5"]; _civ setFace selectRandom ["PersianHead_A3_01", "PersianHead_A3_02", "PersianHead_A3_03"]; _civ setSpeaker selectRandom ["Male01PER", "Male02PER", "Male03PER"]; removeGoggles _civ; }; Then, in the config.sqf of ambiCivs, change the custom initFunction to the function we just defined, like this: L_ambiCivs_customInitFunction = S6_fnc_testFunction; 2 2 Share this post Link to post Share on other sites
SpartanSix 367 Posted October 9, 2019 I've been trying to figure out functions since you released it, I have never really messed with functions before so this helps a lot! I'll give this a go and see how it goes, once again thanks mate! 1 1 Share this post Link to post Share on other sites
SpartanSix 367 Posted October 15, 2019 I've added the code as instructed and have been racking my brain for a while now trying to get this to work, it works okay in single player, though setface and setspeaker don't seem to be working at all, but in multiplayer it doesn't work at all and I have no idea why. Share this post Link to post Share on other sites
LSValmont 789 Posted October 23, 2019 Probably the best MP civilian script in terms of performance! Love the cleanness and CBA/ACE3 scripting style of going full unscheduled environment! I might have found a potential issue. If you kill a civilian and set the L_ambiCivs_fnc_deleteCheck to take longer to check for deletion of the Ai then they might not get removed from the L_ambiCivs_civs Array. Therefore you go around killing civilians you can reach the L_ambiCivs_maxCivs fast! I used a mission killed EH to remedy this. As soon as the CIVs die they get deleted from the Array. Would love some ambient hostile camps, hideouts, MG/AA emplacements and roadblocks using this style of scripting and some compositions trowed into the mix! We are really lacking such scripts... 1 Share this post Link to post Share on other sites
Ben@Arms 4 Posted January 19, 2020 This is a very handy script! Do you plan anything to implement panic behaviour on the civilians? 1 Share this post Link to post Share on other sites
laxemann 1673 Posted January 21, 2020 On 1/19/2020 at 10:35 PM, Ben@Arms said: This is a very handy script! Do you plan anything to implement panic behaviour on the civilians? Nope, stuff like this can either be achieved by using the script hook or dedicated AI mods, such as LAMBS Danger.fsm 🙂 1 Share this post Link to post Share on other sites
MacMillan CCT 0 Posted yesterday at 01:39 AM Hello, I'm using this script with Western Sahara DLC (Sefrou-Ramal Map), but civilians are only spawning inside Altis/Stratis/Malden buildings. How can we solve this? Thanks! Share this post Link to post Share on other sites