Jump to content
bangabob

Civilian Occupation System (COS)

Recommended Posts

If not is there a guaranteed way to stop this happening? It is a clear giveaway that something is about to happen :)

Good question. Would having civilians cached over the entire map cause less lag than spawning and despawning as they are needed?

IMO having a milisecond stutter before each spawn is preferable to having slightly less frames over the entirety of the mission.

Any input would be appreciated

Share this post


Link to post
Share on other sites

Concerning the spawn lag:

I've done some testing on this (with my own spawn scripts) and came to the conclusion that it mainly depends on where the game files are stored.

If they're on a HDD the game can lag really bad when spawning units/objects, it's way better on a SSD and pretty much barely noticeable on a ramdisk.

So nothing you can influence as the creator of the script.

Adding a slight performance sleep between each spawn (something like 0.2/0.3 seconds) should reduce most stutter.

The downside is that it's taking quite a while until everything is done spawning.

A simple solution would be to add a _performancesleep and a _spawndistance variable and let the mission maker enter the values to fit his mission.

Maybe there's a better solution to this since my scripting knowledge isn't that great, for now it's the only solution I can think of. ;)

Share this post


Link to post
Share on other sites
Good question. Would having civilians cached over the entire map cause less lag than spawning and despawning as they are needed?

IMO having a milisecond stutter before each spawn is preferable to having slightly less frames over the entirety of the mission.

Any input would be appreciated

Spawning when needed is the better of 2 evils, the couple of seconds lag is barely noticeable depending on what you are doing at the time.

A spawndistance variable probably would be nice as I could then time up eos and cos separately and lesson the impact by avoiding them both impacting at the same time.

Share this post


Link to post
Share on other sites

Great script, one question...Why are parking cars still exploding even if i set this in the addScript _vehicle script?

/*
Add Script to vehicles spawned by COS.
_veh = Vehicle. Refer to vehicle as _veh.
*/

_veh =(_this select 0);
_veh addEventHandler ["HandleDamage", {false}]; 
_veh setVehicleLock "locked";
_veh allowDamage false;

Share this post


Link to post
Share on other sites

Bangabob, a quick question for you;

Line 137 of cosinit says (note this is your code slightly modified by me)

_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 50} count allunits > 0";

I was wondering if using allUnits here is too expensive on the CPU? Could this be made any cheaper like so?

_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 50} count thisList > 0";

Would this work? I've not tested it as I'm deep in the middle of another project and didn't really want to get sidetracked.

Share this post


Link to post
Share on other sites
Bangabob, a quick question for you;

Line 137 of cosinit says (note this is your code slightly modified by me)

_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 50} count allunits > 0";

I was wondering if using allUnits here is too expensive on the CPU? Could this be made any cheaper like so?

_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 50} count thisList > 0";

Would this work? I've not tested it as I'm deep in the middle of another project and didn't really want to get sidetracked.

Ah I see. You may be correct. I just ripped that code from eos so it may be outdated and inefficient compared to the newer COS code

Share this post


Link to post
Share on other sites

As far as I can see, it's counting (from allUnits) everyone who is in the trigger, (in a vehicle or on foot), who is a player and is below 50m altitude.

A performance saving might be made if instead of checking allUnits for this condition, we only check dudes who are *already* in the trigger.

Share this post


Link to post
Share on other sites

Any reason why one of my missions that uses this doesn't work correctly on a dedicated server? I'm using COS to populate several zones in Fallujah. COS works great on single player and as a local host, populating these zones and having civilians roam about, but when I run it on my dedicated server, it doesn't seem like the COS script is executing correctly. All the markers appear on the map, instead of being hidden by COS, and of course, no civilians are being spawned. What's going on here?

Share this post


Link to post
Share on other sites

As another question on optimisation, wouldn't it be better to remove the one sleep from cosInit.sqf? I mean the one in the loop that checks for road positions (line 141).

I've understood that a mission initialises under the loading screen as far as it can get before it runs into a waitUntil that doesn't pass, or sleep. Wouldn't removing it allow all the positions to be checked during loading, while currently it'll start running only after the mission has started, causing extra slowdown during the first seconds?

I do have to finally thank for this wonderful script that has helped me bring so much more atmosphere to my missions. It's too bad that I've lately been having problems with it. Sometimes the game freezes for several seconds when the trigger is activated, and in the end nothing is spawned. I guess I should try to debug what's the cause, somehow.

Share this post


Link to post
Share on other sites

This script is excellent, My only issue thus far is that the Pedestrians walk too far in the street, And the Vehicles Follow Those paths and are nearly on the sidewalks and run them over constantly.

Share this post


Link to post
Share on other sites

I tried COS on Stratis (I like COS :) )and switched to debug mode to find out the marker names for the blacklist. All names work, except Stratis Airbase and Kamino-Schiessplatz. What are the correct names for these two locations for the blacklist? Thanks.

Share this post


Link to post
Share on other sites

Great Script but how exactly do I spawn in Markers for places for civilians to spawn I tried created a marker and naming is the same as the one in Whitelisted but this didnt work. Thanks

Share this post


Link to post
Share on other sites

I do love this but recently idiots have been having fun killing civs, I would love to put in place taking 10 points off them with civvy killed, have we got any clever scripters put there able to put something together to achieve this. Thank you in advance for any help with this.

Share this post


Link to post
Share on other sites

Nice script but I confirm there are some micro-freezes each 10 seconds approximately, which is quite annoying.

Share this post


Link to post
Share on other sites

How can i prevent civilians spawning on the altis airfield? How do i have to set up a marker/trigger to do so?

Share this post


Link to post
Share on other sites

Is there a way to use the CAF Aggressors with this? Would putting the faction name "caf_ag_afr_civ" into the pool work?

Share this post


Link to post
Share on other sites
Is there a way to use the CAF Aggressors with this? Would putting the faction name "caf_ag_afr_civ" into the pool work?

If you manually enter all of the unit names, yes. I am using the middle eastern civillians on my Sangin map with COS. In the COS folder in COSinit.sqf, there is a section like this:

// Types of units that will be spawned as civilians.

COScivPool =["CAF_AG_ME_CIV","CAF_AG_ME_CIV_02","CAF_AG_ME_CIV_03","CAF_AG_ME_CIV_04"];

COSmotPool =["C_Hatchback_01_F","C_Hatchback_01_sport_F","C_Offroad_01_F","C_SUV_01_F","C_Van_01_box_F","C_Van_01_fuel_F","C_Van_01_transport_F"];

Thats mine for running middle eastern civs, it'll put them as the drivers of the vehicles to. Just swap out the classnames with the african ones and you're good to go.

Share this post


Link to post
Share on other sites
If you manually enter all of the unit names, yes. I am using the middle eastern civillians on my Sangin map with COS. In the COS folder in COSinit.sqf, there is a section like this:

// Types of units that will be spawned as civilians.

COScivPool =["CAF_AG_ME_CIV","CAF_AG_ME_CIV_02","CAF_AG_ME_CIV_03","CAF_AG_ME_CIV_04"];

COSmotPool =["C_Hatchback_01_F","C_Hatchback_01_sport_F","C_Offroad_01_F","C_SUV_01_F","C_Van_01_box_F","C_Van_01_fuel_F","C_Van_01_transport_F"];

Thats mine for running middle eastern civs, it'll put them as the drivers of the vehicles to. Just swap out the classnames with the african ones and you're good to go.

Thanks!

Share this post


Link to post
Share on other sites
Does this work (or is there a way to make it work) in Takistan? I've been trying the whitelist markers but IDK.

Nevermind... I figured it out.

Share this post


Link to post
Share on other sites

hey mate awesome script, I've implemented it into a PMC mission which also uses the Budget Defense System script. And I'm trying to make it so when a Civ is killed a figure is taken off the teams budget. At the moment I'm using this script

Civkilled.sqf

SHK_DeadCivilianCount = 0;

SHK_DeadCivilianLimit = 20;

SHK_fnc_deadCivilians = {

hintsilent format ["Civilian death toll: %1, $20,000 Deducted from teams budget",_this];

if (_this >= SHK_DeadCivilianCount) then {

B_defensebudget= (B_defensebudget-20000); publicVariable "B_DefenseBudget";; // whatever

};

};

if isserver then {

{

if (side _x == Civilian && _x iskindof "Man") then {

_x addEventHandler ["killed", {

SHK_DeadCivilianCount = SHK_DeadCivilianCount + 1;

publicvariable "SHK_DeadCivilianCount";

if !isdedicated then {

SHK_DeadCivilianCount call SHK_fnc_deadCivilians;

};

}];

};

} foreach allunits;

} else {

"SHK_DeadCivilianCount" addpublicvariableeventhandler { (_this select 1) call SHK_fnc_deadCivilians };

};

and I'm calling it in the init.sqf with execVM "scripts\Civkilled.sqf";

It works when I place Civs in the editor but for some reason it doesnt count with the civilians spawned with your script. I've tried adding that code at the bottom of most of your scripts. Just wondering if you have any suggestions on how I could get this to work with your script ?

Share this post


Link to post
Share on other sites

Hey bangabob first thing first I love your scripts EOS & COS (:

However is there a way to make some of the civilians Armed so if a player kills to many of them in a city the armed civilians would shot at the player ? I have look but arma3 does not have any armed civilian scripts that I can find. Could you help a brother out with this! Avibird

Share this post


Link to post
Share on other sites

I have modified the class-names in this script to spawn zombies instead of civilians, and that works ok.....can the script be changed to make the spawned zombies attack players?

Or could this script be combined with another script... http://www.armaholic.com/page.php?id=24679

Share this post


Link to post
Share on other sites

The directions for this mod are horrible, 100% horrible, and I can tell from the comments where someone asked about the cosInit.sqf not found error that no one cares to assist, for a newbie these directions are worthless, what do you mean copy the COS folder into your mission folder, do you mean the mission I created, or the default arma 3 "missions" folder where my mission folder is stored, do you mean copy the COS_5 folder, or literally the COS folder inside COS_05\COS.Altis, I have spent hours trying to get this to work and nothing, I created the gamelogic object and named it SERVER, I put null=[] execVM "cos\cosInit.sqf"; in the initialization field of my gamelogic object and I am getting the cosInit.sqf not found error which another user got no answer for, is there a reason your directions are using as few descriptive words as humanly possible? It's so frustrating trying to figure this out. Is English your native language or are you assuming we all know what you know, I love how anytime anyone asks for help there is either a snarky reply or no reply at all.

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

×