# Civilian Occupation System (COS)

## Recommended Posts

Coming here and being rude is most certainly not going to get you the help you want.

If "copy the COS folder into your mission folder" is a mystery to you I feel you probably need to do a lot more reading and research before attempting to edit/create a mission.

##### Share on other sites
Coming here and being rude is most certainly not going to get you the help you want.

If "copy the COS folder into your mission folder" is a mystery to you I feel you probably need to do a lot more reading and research before attempting to edit/create a mission.

Sorry I know I went off, I finally got it to work and I am appreciative of the script creators work. 100% my bad. Made an ass of myself.

So this is how I got it to work. I will use my skills in explanation to help people as dense as me, I get paid to be a programmer IRL and yet I couldn't solve this as easily as it could have been with good documentation.

Create a mission in the Arma 3 editor, make your player character and whatever else you want.

Create a Game logic Object named SERVER, you do this inside the editor using the unit creation tool, it is a type of unit. Within the initialization box of this newly created SERVER game logic object, paste in null=[] execVM "cos\cosInit.sqf";

Save your mission as an export to singleplayer if that is what you are creating or if you want to use the editor just save it as normal.

Copy the "cos", folder within COS_05\COS.Altis to C:\Users\whateveryourusernameis\Documents\Arma 3\missions\yourmissonname.yourmissionsmapname folder.

For example this is how my path looks. C:\Users\whateveryourusernameis\Arma 3\missions\CIVUSR.Altis\cos

What the directions are lacking are specific folder paths, there are something like 3 missions folders for Arma 3, super confusing for someone who has no experience with these scripts.

---------- Post added at 01:55 ---------- Previous post was at 01:42 ----------

Last thing I want to say now that this is working, it is 100% amazing. This is by far the best civilization mod out there. Nothing even comes close to the population density that this has. My apologies and thanks to the author. Nice work man.

##### Share on other sites

Cool, great to see you sorted it out and agreed it has been a real great addition to any mission I have made.

##### Share on other sites
Sorry I know I went off, I finally got it to work and I am appreciative of the script creators work. 100% my bad. Made an ass of myself.

So this is how I got it to work. I will use my skills in explanation to help people as dense as me, I get paid to be a programmer IRL and yet I couldn't solve this as easily as it could have been with good documentation.

Create a mission in the Arma 3 editor, make your player character and whatever else you want.

Create a Game logic Object named SERVER, you do this inside the editor using the unit creation tool, it is a type of unit. Within the initialization box of this newly created SERVER game logic object, paste in null=[] execVM "cos\cosInit.sqf";

Save your mission as an export to singleplayer if that is what you are creating or if you want to use the editor just save it as normal.

Copy the "cos", folder within COS_05\COS.Altis to C:\Users\whateveryourusernameis\Documents\Arma 3\missions\yourmissonname.yourmissionsmapname folder.

For example this is how my path looks. C:\Users\whateveryourusernameis\Arma 3\missions\CIVUSR.Altis\cos

What the directions are lacking are specific folder paths, there are something like 3 missions folders for Arma 3, super confusing for someone who has no experience with these scripts.

---------- Post added at 01:55 ---------- Previous post was at 01:42 ----------

Last thing I want to say now that this is working, it is 100% amazing. This is by far the best civilization mod out there. Nothing even comes close to the population density that this has. My apologies and thanks to the author. Nice work man.

##### Share on other sites

Any idea what the micro-freezes every minute or so can be remedied by? They're very disruptive. It's not CPU usage causing a lock up, that was my first thought.

You don't have them spawn in until you're in range - so I wonder what the issues are. Perhaps that I'm using a map with A2 assets? Or that I'm trying to get it to work with CAF aggressors? I've also noticed that the civilians spawned are never from the CAF aggressors, is there a cap on that? I used the appropriate class names - ported vehicles and units from other packs will show without a problem, though the freezing bug is still an issue. Maybe it's a loop, I'll go fishing in the code to see what's going on in there. I really hope I can get this to work soon without lockups (I won't make others go through that in MP) - I need something for MP on DEDI and VDEDI as TPW's unmodified stuff locks down on servers.

##### Share on other sites

Hey guys,

I have a question. Does anybody know, how to get this to work on Takistan using AiA Terrain Pack?

##### Share on other sites

I have recently implemented this script into a mission i've created and I am encountering a problem. The script seems to work fine, however if players are in a vehicle and enter a zone that starts to spawn civs, all the passengers expirence a crash to desktop.

The driver is uneffected.

Any idea what could be causing this?

Thanks

##### Share on other sites

Hello gents, first post here on the forums.

Huge fan of the work done here on COS. In the past this script has worked brilliantly for my counter-insurgency mission. Unfortunately, I as well have encountered an issue with this script...

- When I preview the mission in editor, my population populates, but does not move.

- When I play the mission in lan with friends, my population populates, but does not move.

- When my friend hosts the map on his server, the population does not populate.

I reinstalled the most recent version of COS just yesterday, leaving all settings vanilla. I have been using this mod since it hit the market so I have experience with adjusting its parameters.

Any help would be appreciated.

##### Share on other sites

Thanks for this very nice script. And thanks also for EOS, BRS, and LFC. I use them all and really appreciate them.

##### Share on other sites

May have missed it through the thread, but is there a way to turn off the hint that comes up with name of town and population currently there? Other than that, works pretty damn well. Just looking to turn off the notification for realism purposes.

Disregard, found it in the init.sqf, sorry about that.

Edited by Crow_X
Solved

##### Share on other sites

I am trying to use this script with Chernarus from the "All In Arma" Mod pack. The script only detects about half the towns in Chern. Other than doing it long hand and adding the markers myself, is there anything I can do to get the script to recognize the other towns? Thanks.

Edit: I cannot even get the whitelist markers option to function on Chern. I'm not having any of these troubles on Altis, so I know that the script DOES work.

Edited by stychiz

##### Share on other sites

I am wondering if anyone has used this to create suicide bombers? I would like to have random suicide bombers in my mission. I am looking for something along the lines that civs' spawn only a few here and there and having approx 20 % chance there is a bomber in the group spawned. Then when Nato is nearby they run up and blow them up.

Please post any ideas or personal ways to making this happen. So if this has been previously asked.

Looking at COS.init, in theory could I just add 1 marker for entire Altis, with only 20 civ's spawned total any time and have 2 of them bombers?

Am wondering if this is how I should place this script?

_unit =(_this select 0);

_unit = [this] execVM "hkRandom.sqf";// EXAMPLE SCRIPT

Edited by JAndrews1

##### Share on other sites

I'm using the script on Takistan and it's perfect except for the fact that when entering certain towns (Chak Chak specifically), the civilians are spawned all across the map instead inside the town's marker. I've tried placing my own markers but for some reason I can't get the script to recognize them within the cosInit. Any help?

##### Share on other sites

Can somebody please tell me how to blacklist a town? I'm also having trouble adding an object named SERVER. It say's the variable is already used but the script doesn't load so I'm assuming that there isn't an object named SERVER.

Edited by idkwidlol

##### Share on other sites

Sadly this script is not working properly on maps with low roads like Dariyah as the civ are only spawning on roads and not around/in houses.

You can have civ being spawned really far away from the intended position and none at all on the target city.

Can this be corrected/updated ?

Thx!

##### Share on other sites

Hello, I couldn't see it skimming through all these pages but is there an option or way to add a penalty like an instant mission failure after you kill a certain number of civilians.

##### Share on other sites
Can somebody please tell me how to blacklist a town? I'm also having trouble adding an object named SERVER. It say's the variable is already used but the script doesn't load so I'm assuming that there isn't an object named SERVER.

So i think you have an object named server, but thats not what you need.

Place a unit down in the editor, then another option will occur where you choose unit/objects ect., its named gamelogic.

Place one in your mission anywhere and name it server in the name field of it.

Srry my english is not the best, hope you get what i mean.

##### Share on other sites

I am trying to use this code in the "extra script" portion of your civ script. Getting an error. Is this set up correctly for this script.

_unit =(_this select 0);
While (true) do
{
}
else
{
_unit addAction = ["",{[((_this select 3) select 0),"",(0-100),(20 + random 20),west,1,0.5] execVM "scripts\ws_assassins.sqf"},[_unit]];
};

##### Share on other sites
I am trying to use this code in the "extra script" portion of your civ script. Getting an error. Is this set up correctly for this script.

_unit =(_this select 0);
While (true) do
{
}
else
{
_unit addAction = ["",{[((_this select 3) select 0),"",(0-100),(20 + random 20),west,1,0.5] execVM "scripts\ws_assassins.sqf"},[_unit]];
};

It's very hard to say without knowing the error message you are getting.

But this while loop with no sleep worries me because this will be a infinite loop for each civilian spawned. + It will continually add actions to the unit forever

##### Share on other sites
It's very hard to say without knowing the error message you are getting.

But this while loop with no sleep worries me because this will be a infinite loop for each civilian spawned. + It will continually add actions to the unit forever

Hey BangBob, I will post the error later, but I am open to suggestions on this, I have both scripts set to only activate 20/30% of civs that spawn with these, but am open to suggestions at this time. Am wanting small % of civs to turn on players, both these allow that.

##### Share on other sites
Hey BangBob, I will post the error later, but I am open to suggestions on this, I have both scripts set to only activate 20/30% of civs that spawn with these, but am open to suggestions at this time. Am wanting small % of civs to turn on players, both these allow that.

I see. To add the action to 20%-30% of the civilians an IF statement would suffice. For example

_unit = (_this select 0);
_chance = 20 + (random 10);
if ((random 100) <= _chance) then {

//RUN SCRIPT HERE FOR 20%-30% OF UNITS
};


##### Share on other sites

This script was easy to add, and provides life to the previously lifeless cities. It always annoyed me that the massive towns had no people in them. Now when I scan with thermal sights, I have to pick out what is a valid target or not. I also have to refrain from using artillery indiscriminately. This is a great script, thank you for making it and sharing it, its definitely going in everything I can think of creating.

##### Share on other sites

BangaBob, great scrip man! Really does help to add some realism. A few people on here have asked about tracking civilian deaths and I am so frikkin close to getting a working system but I seem to have a bug that only works for the first to civilian kills. I was hoping someone with more scripting experience could help me out! Here's my code:

init.sqf

//Auto populate towns
null=[] execVM "cos\cosInit.sqf";

//Check civilian casualties
null=[]execVM "civilianCasualties.sqf";



civilianCasualties.sqf

// Global variable to hold the death counter.

if (!isServer) {
// PublicVariable eventhandler to catch the update sent by the server.

};
fnc_updatedDeathCount = {
};



/*
Add Script to individual units spawned by COS.
_unit = unit. Refer to Unit as _unit.
*/

_unit =(_this select 0);

//check to see if civilian was killed

_killer = (_this select 1);
_victim = (_this select 0);

if (side _killer == WEST) then { //Make sure killer was BLUFOR, we don't want to count enemy kills or car explosions
_killer globalChat "Civilian down!"; //announce who killed a civie
publicvariable "DeadCivilians"; //push updated number to other clients
};
_victim removeAllEventHandlers  "killed"; //clean up eventhandlers for dead unit
}];



So to break it down really quick, init.sqf starts COS and runs civilianCasualties.sqf. civilianCasualties.sqf sets the variables, and runs the public variable event handler to catch updates from the other players. In addScript_Unit.sqf I've added a killed event handler so that every spawned civie when killed checks to see if the killer was on blufor, increments the casualty counter, announces the casualty and sends the variable to the other clients. For some damn reason the script works flawlessly for the first 2 civilian kills! then it just stops working... arg!

##### Share on other sites
BangaBob, great scrip man! Really does help to add some realism. A few people on here have asked about tracking civilian deaths and I am so frikkin close to getting a working system but I seem to have a bug that only works for the first to civilian kills. I was hoping someone with more scripting experience could help me out! Here's my code:

init.sqf

//Auto populate towns
null=[] execVM "cos\cosInit.sqf";

//Check civilian casualties
null=[]execVM "civilianCasualties.sqf";



civilianCasualties.sqf

// Global variable to hold the death counter.

if (!isServer) {
// PublicVariable eventhandler to catch the update sent by the server.

};
fnc_updatedDeathCount = {
};



/*
Add Script to individual units spawned by COS.
_unit = unit. Refer to Unit as _unit.
*/

_unit =(_this select 0);

//check to see if civilian was killed

_killer = (_this select 1);
_victim = (_this select 0);

if (side _killer == WEST) then { //Make sure killer was BLUFOR, we don't want to count enemy kills or car explosions
_killer globalChat "Civilian down!"; //announce who killed a civie
publicvariable "DeadCivilians"; //push updated number to other clients
};
_victim removeAllEventHandlers  "killed"; //clean up eventhandlers for dead unit
}];



So to break it down really quick, init.sqf starts COS and runs civilianCasualties.sqf. civilianCasualties.sqf sets the variables, and runs the public variable event handler to catch updates from the other players. In addScript_Unit.sqf I've added a killed event handler so that every spawned civie when killed checks to see if the killer was on blufor, increments the casualty counter, announces the casualty and sends the variable to the other clients. For some damn reason the script works flawlessly for the first 2 civilian kills! then it just stops working... arg!

To help isolate the problem try running your killed eventhandler on non-cos units.

If the problem is solved then it is a error with COS and I may be more help

##### Share on other sites

Hi! can anyone help me? Options moved to description.ext, revival of civil and cars. enable or disable the game.