# Civilian Occupation System (COS)

## Recommended Posts

Hi all- trying to make it so civilians don't run away from My Russian OPFOR, anyone know how I would do this please?

Also- which bit do I edit exactly to make it spawn less civis please? I read through this whole thing and just can't get my head around it. Andlastly- cars appear to just spawn in and blow up?

Great script though!

Thanks!

##### Share on other sites

Hi all- trying to make it so civilians don't run away from My Russian OPFOR, anyone know how I would do this please?

Also- which bit do I edit exactly to make it spawn less civis please? I read through this whole thing and just can't get my head around it.

Great script though!

Thanks!

You can adjust the number of civs in the COSint at the "customise population by number of houses" ~line 80 to ~113.

You can set the civs "friendly to" in the editor under advanced or

east setFriend [resistance, 1];

resistance setFriend [east, 1];

• 1

##### Share on other sites

sorry double posted

##### Share on other sites

You can set the civs "friendly to" in the editor under advanced or

east setFriend [resistance, 1];

resistance setFriend [east, 1];

Ahhh thank you! But where do I find the advance option? and that failing where would I put those set friend codes exactly? Just the AI spawn randomly and I couldn't see anywhere to put it in the actual COSinit script.

Thanks again.

##### Share on other sites

Ahhh thank you! But where do I find the advance option? and that failing where would I put those set friend codes exactly? Just the AI spawn randomly and I couldn't see anywhere to put it in the actual COSinit script.

Thanks again.

Just add it to your serverinit or init sqfs

##### Share on other sites

Ok thanks, I tried adding it into the server script and it didn't seem to do anything. I wonder if anyone knows of a decent civilian script I can drop in the the addscript_unit.sqf that might do all of that for me and set a bit of dialogue up?

##### Share on other sites

Well not sure why it isn't working for you. Should be the first thing that runs in the serverinit. Might want to read up on this https://community.bistudio.com/wiki/Side_relations#IsFriendly. Maybe in the addScript_unit use create group. Untested, might work. I use this to set the to the independent side. I would not see why it would not work for the east. Just a thought.

_unit =(_this select 0);

[_unit] join createGroup EAST;

(units group _unit) join createGroup EAST;

##### Share on other sites

Hmmmm hang on maybe I messed up. When you say 'Just add it to your serverinit or init sqfs' Where exactly are those? Do you mean modify the actual script? Or input this into the server object that makes the script run? Currently they just run around aimlessly. :/

##### Share on other sites

I mean- is there nothing I can edit in the cosinit script?

##### Share on other sites

Initserver.sqf and init.sf are event scripts in your mission root that fire automatically at mission start. If u dont have the one needed then u need tto create it

##### Share on other sites

I just wanted to thank thedubl for spending hours sorting out my problem. Thank you mate.

##### Share on other sites

How do I get this to spawn a few civilian flying around m900?

##### Share on other sites

I'm getting this error too.

Yes ! i'm sure ! i didn't do nothing !

Just exported the scripts files to my folder, to verify the issue !

I'm making a new mission by scripts... and after the update, i had an error, then i shearched in my scripts, but after, i just tested the COS script to be sure... and "Bawww"... it was broken !

I think they have changed something in the config file map... or did an obvious mistake !?!

2:23:08 Starting mission:
22:23:08  Mission file: test_COS
22:23:08  Mission world: Stratis
22:23:08  Mission directory: C:\Users\####\Documents\Arma 3 - Other Profiles\chal00[FR]\missions\test_COS.Stratis\
22:23:09 Attempt to override final function - bis_functions_list
22:23:09 Attempt to override final function - bis_functions_listpreinit
22:23:09 Attempt to override final function - bis_functions_listpostinit
22:23:09 Attempt to override final function - bis_functions_listrecompile
22:23:09 Attempt to override final function - bis_fnc_missiontaskslocal
22:23:09 Attempt to override final function - bis_fnc_missionconversationslocal
22:23:09 Attempt to override final function - bis_fnc_missionflow
22:23:12  Mission id: ################################
22:23:13 No speaker given for Zaim Okoye
22:23:14 No speaker given for Zaim Osmani
22:23:14 Error in expression < %1, expected %2, on index %3, in %4", [_par] call _fnc_getTypeName, [_x] call _>
22:23:14   Error position: <_par] call _fnc_getTypeName, [_x] call _>
22:23:14   Error Variable indÃ©finie dans une expression: _par
22:23:14 File A3\functions_f\Debug\fn_errorParamsType.sqf, line 146
22:23:14 Error in expression <tedTo select 0;
_direction = [_tempPos, _connectedRoad] call BIS_fnc_DirTo;

if >
22:23:14   Error position: <_connectedRoad] call BIS_fnc_DirTo;

if >
22:23:14   Error Variable indÃ©finie dans une expression: _connectedroad
22:23:14 File C:\Users\g\Documents\Arma 3 - Other Profiles\chal00[FR]\missions\test_COS.Stratis\cos\cosCore.sqf, line 131
22:23:14 Error in expression <veh, [], 0, "CAN_COLLIDE"];
_veh setdir _direction;

_unit assignAsDriver _veh;
>
22:23:14   Error position: <_direction;

_unit assignAsDriver _veh;
>
22:23:14   Error Variable indÃ©finie dans une expression: _direction
22:23:14 File C:\Users\g\Documents\Arma 3 - Other Profiles\chal00[FR]\missions\test_COS.Stratis\cos\cosCore.sqf, line 143
22:23:14 Error in expression < %1, expected %2, on index %3, in %4", [_par] call _fnc_getTypeName, [_x] call _>
22:23:14   Error position: <_par] call _fnc_getTypeName, [_x] call _>
22:23:14   Error Variable indÃ©finie dans une expression: _par
22:23:14 File A3\functions_f\Debug\fn_errorParamsType.sqf, line 146
22:23:14 Error in expression <tedTo select 0;
_direction = [_tempPos, _connectedRoad] call BIS_fnc_DirTo;

if >
22:23:14   Error position: <_connectedRoad] call BIS_fnc_DirTo;

if >
22:23:14   Error Variable indÃ©finie dans une expression: _connectedroad
22:23:14 File C:\Users\g\Documents\Arma 3 - Other Profiles\chal00[FR]\missions\test_COS.Stratis\cos\cosCore.sqf, line 131
22:23:21 Weather was forced to change

Tested only with previsualisation !!

##### Share on other sites

Just a quick note to say that I contacted Bangabob a few days ago, asking for permission to modify and use this script package.

Although he's not logged in here for some time and is clearly no longer a community member, he did give permission to do anything with these scripts. As steam chat forgets everything, I can't quote him exactly, but he was pretty non-restrictive about what we might do and I think it's safe to assume this extends to his other works here.

##### Share on other sites

Hi guys!

Great script:)

Im using this on our server to spawn zombies by placing the zombie class names in the civilian array in the cosinit file.

This is working great but I would like to add one boss zombie only that spawns in each town also.Any help onthe problem would be much appreciated.

:)

##### Share on other sites

Just a quick note to say that I contacted Bangabob a few days ago, asking for permission to modify and use this script package.

Although he's not logged in here for some time and is clearly no longer a community member, he did give permission to do anything with these scripts. As steam chat forgets everything, I can't quote him exactly, but he was pretty non-restrictive about what we might do and I think it's safe to assume this extends to his other works here.

If this is true I might touch up and clean up my interpretation of COS and release it. (Same idea/logic but complete rewrite with some personal tweaks)

##### Share on other sites

I can't speak for him, but I'm convinced he'd be happy for you to do that. I'm sure everyone remembers what a sound chap he was and unlike some (often those involved in The Great Ragequit of 2013), he didn't mind at all be contacted about an Arma matter some years after he left the community.

As I'm sure you've found, the script is in need of a buff up, if for no other reason than it could make use of script commands that have come along since COS was written. I, for one, could never make the patrol function or it's firednear EH work satisfactorily, so am in the process of rewriting that.

##### Share on other sites

Yeah the firednear EH is indeed a bit "limited" an we often have civvies just walking about close to firefights which makes for some chuckles. But with allowFleeing, SAFE behaviour and the EH which breaks their waypoint loop and makes them run to the nearest cover its mostly sufficient.

I did however manage to get the "patrolling" to work rather satisfactory. Each town is assigned x+1 waypoints on init where x is the amount of civvvies that would spawn in said town on activation. Then when civvies spawn each are given a 10 waypoint loop out of the waypoint pool which is randomized. For pedestrians the waypoints are additionally placed inside buildings (nearestBuilding, buildingPosition) so that they move out of and into buildings instead of just random points.

The main reason I rewrote it over a year ago was to make it compatible with Headless clients so that it isn't the server running the scripts / AI. It was quite laggy and the result was a bit of a let down but since the introductino of disableRemoteSensors it has been working like dream.

##### Share on other sites

It sounds like you have made way more progress than me. Can you share what you have?

##### Share on other sites

Yeah the firednear EH is indeed a bit "limited" an we often have civvies just walking about close to firefights which makes for some chuckles. But with allowFleeing, SAFE behaviour and the EH which breaks their waypoint loop and makes them run to the nearest cover its mostly sufficient.

I did however manage to get the "patrolling" to work rather satisfactory. Each town is assigned x+1 waypoints on init where x is the amount of civvvies that would spawn in said town on activation. Then when civvies spawn each are given a 10 waypoint loop out of the waypoint pool which is randomized. For pedestrians the waypoints are additionally placed inside buildings (nearestBuilding, buildingPosition) so that they move out of and into buildings instead of just random points.

The main reason I rewrote it over a year ago was to make it compatible with Headless clients so that it isn't the server running the scripts / AI. It was quite laggy and the result was a bit of a let down but since the introductino of disableRemoteSensors it has been working like dream.

leshrack, i'm porting Civilian Interaction Module (created by Nielsen on Arma 2 - http://www.armaholic.com/page.php?id=15664). It's close to 70% ok, i have to solve some issues yet but it's already playable. It could be interesting merge CIM mod with COS. If you are interested contact me. I'm looking for something where we could have civilian ambience and interaction with they.

• 3

##### Share on other sites

Awesome that you guys are fixing this script. Cant wait to see the results!

##### Share on other sites

I thought I would share this in case someone might like some armed civs in the mix. First, thing to note is the I have set the independents friendly to no one. Second, I am using this with EOS (marker color is important). I have 3 zone colors so, if you are using the EOS 1.98 that is not modified you may want to adjust it for just red (red = CSAT, green =  independent, blue = captured).

In the addScript_unit.sqf within the COS folder, I have add the following bit. If the randomCiv equals 3,7, or 10 then, select a number for gun type, look for the nearest marker and the color. If the marker is hostile (red or green) add some random hostile civs.  Makes it kind of interesting (keeps you watching everyone). Works well on the server. Feel free to adjust as you wish.

_unit =(_this select 0);

/************************Make random civs rebels: Created by Dub*******************************/
_randomCivs = floor(random 10);

if(_randomCivs == 3 ||_randomCivs == 7|| _randomCivs == 10) then {

_whichGun = floor(random 3);

//find the closet marker and the color
_nearestMarker = [allMapMarkers, _unit] call BIS_fnc_nearestPosition;
_color = getMarkerColor _nearestMarker;
//_meters = _unit distance _nearestMarker; //commented out, but here if you want to add it to the if statement to check the distance too

//RED = CSAT, GREEN = INDEPENDENTS
if (_color == "ColorRed" || _color == "ColorGreen" ) then {

switch (true) do {

case (_whichGun == 1): {_weapon = [_unit, "arifle_Mk20_F", 4, 1] call BIS_fnc_addWeapon;};
case (_whichGun == 2): {_weapon = [_unit, "arifle_MX_SW_Black_F", 4, 1] call BIS_fnc_addWeapon;};
case (_whichGun == 3): {_weapon = [_unit, "arifle_MX_ACO_F", 4, 1] call BIS_fnc_addWeapon;};
default {_weapon = [_unit, "SMG_02_F", 4, 1] call BIS_fnc_addWeapon;};

};

//set the civ to rebel side
[_unit] join createGroup independent;
(units group _unit) join createGroup independent;

//set the mode
_unit setBehaviour "COMBAT";

};

};



dub

• 3

##### Share on other sites

Guys is there something I can do to prevent the nps spawning on the runways of altis and aswell I need to make them spawn on the sides of road not in the middle so a bit more random. Any ideas?

##### Share on other sites

Is there anything that can be done to reduce the levels of road deaths?

Watch how this fuel truck driver swerves to kill two civilians walking by the side of the road. I think this particular driver might not be typical, though there's no reason for him to make this maneuver, there is nothing else in the road to distract him, and there's no junction there.

In testing this, the number of run downs was surprising. We all know the AI drivers can't drive for toffee, but was wondering if there's anything we can do to reduce it, other than not having moving cars?

---------- Post added at 14:02 ---------- Previous post was at 13:53 ----------

And here. Is it possible this is just about fuel truck drivers?

LOL this is funny , made my day, decent script tho

##### Share on other sites

Has anyone had any luck with this script on Tanoa?   I'm getting script errors related to 'roadsConnectedTo'