Jump to content
bangabob

Civilian Occupation System (COS)

Recommended Posts

COS



Civilian Occupation System

Civilian Occupation System efficiently populates all towns and villages with realistic AI civilians and vehicles when needed and removes them when not needed.

COS features v0.5 (11/04/14)

- Fully automatic. Simply add COS into your mission to populate the map

- Quickly populate towns and villages with civilians, vehicles and parked cars

- Civilians act realistically and run from combat

- Add your own civilian occupation zones easily

- Blacklist towns to stop auto-population

- Dedicated for civilians. Can be used in conjunction with EOS

- Easily add your own scripts to all civilians and vehicles

Instructions

1. Copy COS folder into your mission folder

2. Open editor and place an object named SERVER

3. Copy this into the SERVER initialization box: null=[] execVM "cos\cosInit.sqf";

Download below and open Read Me to get started

Build 0.5

Download COS

ArmaHolic Mirror

Previous Builds

Build 0.41

Download COS

Build 0.4

Download COS

Build 0.3

Download COS

Build 0.2

Download COS

Build 0.1

Download COS

ChangeLog

Version 0.5

- Aerial activation option added

- Town labels now local to players in vicinity of town (Dedicated servers)

- Fixed debug feature

- Spawn cycle efficiency is improved

- Replaced random functions with shuffle outside of loop

- Road is not removed from roadlist array in each loop

- Count gets unique road from roadlist

- Only required road positions are stored

- Added notes to scripts for reference

- COS should now be called using the Server - Game Logic (See example mission)

Version 0.41

- Fixed COS whiteList markers

Version 0.4

- Removed useless format operation from cosInit.sqf

- MarkerID is now unique for COS to avoid conflict with other scripts

- COS now gets marker description from Whitelist markers for COS labels

- Added Hatchbacks into COS unit pool

- Improved spawning efficiency by moving patrol script outside loop

- Patrol script is now run via ExecVM instead of function

- Several code optimisations in spawning cylce

- Blacklist towns are now removed from COS

Version 0.3

- Modular options for Pedestrians/cars/parked

- COS now sequentially spawns towns

- Set Maximum group limit for COS at any one time (If limit is hit then civilians will be placed into a single group for each town)

- COS will now exit spawn loop if player leaves during spawn

- Show town label and debug messages now work on dedicated servers

Version 0.2 (Updated : 00.25am)

- Each towns population is pre-calculated and stored

- Each towns Near roads are pre-calculated and stored.

- Simple Patrol script uses stored near roads variable instead of generating its own

- Patrol script saved as function

- Fired-near EV script saved as function

- Groups now deleted properly

Version 0.1

-Original Build



By BangaBob

Edited by BangaBob
  • Like 3

Share this post


Link to post
Share on other sites

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Foxhound
updated to latest version

Share this post


Link to post
Share on other sites

Sorry. I realised shortly after releasing that there was a serious performance bug.

This is now resolved in v0.2. Please update if you havn't already

Version 0.2 (Updated : 00.25am)

- Each towns population is pre-calculated and stored

- Each towns Near roads are pre-calculated and stored.

- Simple Patrol script uses stored near roads variable instead of generating its own

- Patrol script saved as function

- Fired-near EV script saved as function

- Groups now deleted properly

Edited by BangaBob

Share this post


Link to post
Share on other sites

Hi there,

Nice script but I found a tiny error in the debug.

cosCore.sqf line 47:

		_grp=createGroup DefaultSide;
	_unit = _grp createUnit [_tempUnit, _tempPos, [], 0, "NONE"];
				IF (debugCOS) then {
			_txt=format["INF%1,MKR%2",_counter,_mkr];
			_debugMkr=createMarker [_txt,getpos _unit];
			_debugMkr setMarkerShape "ICON";
			_debugMkr setMarkerType "hd_dot";
			_debugMkr setMarkerText "Civ Spawn";
					};
		player sidechat format ["civilians%1",_grp];			
			_civilianArray set [count _civilianArray,_grp];		
			null =[_grp,_roadlist2] call Patrol_FNC;
			null =[_unit] execVM "cos\addScript_Unit.sqf";
				};

I thought it should like this:

		_grp=createGroup DefaultSide;
	_unit = _grp createUnit [_tempUnit, _tempPos, [], 0, "NONE"];
				IF (debugCOS) then {
			_txt=format["INF%1,MKR%2",_counter,_mkr];
			_debugMkr=createMarker [_txt,getpos _unit];
			_debugMkr setMarkerShape "ICON";
			_debugMkr setMarkerType "hd_dot";
			_debugMkr setMarkerText "Civ Spawn";
			player sidechat format ["civilians%1",_grp];
					};			
			_civilianArray set [count _civilianArray,_grp];		
			null =[_grp,_roadlist2] call Patrol_FNC;
			null =[_unit] execVM "cos\addScript_Unit.sqf";
				};

Edith: It would also very nice if you can make it more modular

Civilians = True;

Cars = False;

Parked_Cars = True;

what do you think?

anjan

Edited by Anjan-Riot

Share this post


Link to post
Share on other sites

I've downloaded this and had a quick look through the scripts. Looks nice and lightweight. It appears to be MP compatible if I run it server side only?

Share this post


Link to post
Share on other sites

Everything i change in these early builds is important for reliability, functionality and performance.

I feel like i am getting close to the finished version of this script because spawning civilians is all i want this script to do. Simpler the better IMO.

Please let me know if you encounter any problems and i will do my best to fix them in the next patch.

Version 0.3 changelog

- Modular options for Pedestrians/cars/parked

- COS now sequentially spawns towns

- Set Maximum group limit for COS at any one time (If limit is hit then civilians will be placed into a single group for each town)

- COS will now exit spawn loop if player leaves during spawn

- Show town label and debug messages now work on dedicated servers

---------- Post added at 17:09 ---------- Previous post was at 17:08 ----------

It appears to be MP compatible if I run it server side only?

I have tested it on my dedicated server and it appears to run good.

---------- Post added at 17:10 ---------- Previous post was at 17:09 ----------

Edith: It would also very nice if you can make it more modular

Civilians = True;

Cars = False;

Parked_Cars = True;

Thanks for the tip. And that code was left over from my testing (doh). Modular spawning is now available in the latest version.

Share this post


Link to post
Share on other sites
Hey BB,

Have you thought about a mod version?

I dont know, what are the benefits of using a mod version?

Currently all the mission creator needs to do is copy the COS folder into his missions and run the execVM in the init.sqf.

Share this post


Link to post
Share on other sites
I dont know, what are the benefits of using a mod version?

Currently all the mission creator needs to do is copy the COS folder into his missions and run the execVM in the init.sqf.

I'm curious about this too.

To use a mod you need to:

1.: Download the mission

2.: Download the mod

3.: Copy the mod into a folder

4.: Edit the startup parameters of A3

5.: repeat steps 1-3 everytime the mod is getting updated

6.: every player who wants to play a mission using this mod has to do steps 1-4

vs.

1.: Download and play the mission

It's obvious that you need mods to add vehicles etc. but other than that?

Share this post


Link to post
Share on other sites

Thanks BB

I have some applications in mind for COS .. Just have to try to fit it within the ever-present performance budget for MP.

Share this post


Link to post
Share on other sites

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Sorry BB. You are right. I thought it was going to be more complicated to get running. I was wrong. I have put in my mission without any problems.

Good work mate.

Share this post


Link to post
Share on other sites

If only the civilian drivers didn't keep running the pedestrians down! lol It's carnage out there.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Top video is crazy. And BIS wonder why we complain about the AI ! Shocking.

Share this post


Link to post
Share on other sites
Top video is crazy. And BIS wonder why we complain about the AI ! Shocking.

It is shocking. The driver actually swerves onto the pavement to run those two guys down.

Share this post


Link to post
Share on other sites

this script is greatness. went into one of my missions with ease. gonna put it in all my missions tonight. thanks for making this.

Share this post


Link to post
Share on other sites

Thanks for this BangaBob,

Especially this update:

Version 0.3 changelog

- Modular options for Pedestrians/cars/parked

Share this post


Link to post
Share on other sites

Problem here; aside from the appalling driving of the AI, which isn't down to this script. :)

In Domination, none of the main target markers appear. I think (though I can't be sure) that the marker based technique cosInit uses to find towns and put triggers on them is obliterating the Domination main target marker.

Everything works.... The Domi target assets and enemies are there, as well as the civilians, but the marker Domi makes isn't there. :(

---------- Post added at 21:38 ---------- Previous post was at 20:31 ----------

Aha, I have worked out why it's not working in Domi.

COS and Domi both use the name of the town as their marker name and marker names must be unique. So the last one created survives, in this case the COS one.

Share this post


Link to post
Share on other sites

Hey bangabob, quality work as usual, thanks for this. Nice way to populate Civilians - tried EOS but wasn't the same seeing them 'patrolling' a town instead of random wandering.

@Tankbuster

try this as a replacement for the COS marker creation - line 63 in cosInit.sqf

now you'll have unique marker names

_foo = createmarker [_markerID, _pos];

The code is already there, it might have been overlooked by Bangabob....:D

Share this post


Link to post
Share on other sites
To edit population of Zones open COS/cosCore.sqf.

I had a look through the script but it wasn't clear to me how to do this. Could someone provide a clearer explanation please?

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

×