Jump to content
bangabob

Civilian Occupation System (COS)

Recommended Posts

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?

Its in cosInit.sqf. Search for '_houses'.

Share this post


Link to post
Share on other sites

Thanks for the reply BangaBob :)

You might want to update the 'Usage' notes on the Armaholic page if you hadn't already thought to do that. I spent a lot of time looking in the wrong file, wondering why I couldn't see it :p

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

Ah, I wondered what markerid was being made for. Damn, should have seen that one myself. Thanks Kev. :)

---------- Post added at 18:32 ---------- Previous post was at 18:19 ----------

This gives an error though. Civs spawn, but despawn seconds afterwards.

2014/04/06, 20:27:53 Error in expression <n] spawn BIS_fnc_infoText;
};



while {_var} do
{
_var=server getvariable _varI>
2014/04/06, 20:27:53   Error position: <_var} do
{
_var=server getvariable _varI>
2014/04/06, 20:27:53   Error Undefined variable in expression: _var
2014/04/06, 20:27:53 File mpmissions\__cur_mp.Altis\cos\cosCore.sqf, line 170

Share this post


Link to post
Share on other sites
Any idea on the above Bob? having the same problem as Tanky

Cheers

Champy

Put "_markerID" in private on line 42.

Next, line 150 replace _var=format["var%1", _town]; with _var=format["var%1", _markerID];

Edited by BangaBob

Share this post


Link to post
Share on other sites
Put "_markerID" in private on line 42.

Next, line 150 replace _var=format["var%1", _town]; with _var=format["var%1", _town];

Is it me or is there no difference between ^^^^

Share this post


Link to post
Share on other sites
Is it me or is there no difference between ^^^^

Updated post. Thanks for pointing it out.

Share this post


Link to post
Share on other sites

Is there a reason why cos\addScript_Unit.sqf has _unit addAction ["Hello", ""]; in it on default?

It would be nice if the default customisation options had a way for decreasing the number of civilians the system spawns. Other than that, this is a great system, thanks a lot.

Edit: Hmm, I also don't seem to get blackListTowns to work. Or at least when I put

blackListTowns = ["Kavala", "CityC_Kavala", "Neri", "CityC_Neri", "Aggelochori", "Panochori"];

in there, civilians still spawn in all of them.

Edited by Magirot

Share this post


Link to post
Share on other sites
Updated post. Thanks for pointing it out.

Yep, that's working a treat. :)

I can't overstate the importance of this. It's going to transform many missions.

Thanks for your work. :)

Share this post


Link to post
Share on other sites

New version released.

This version fixes several bugs. Such as the BlacklistTowns function not working as intended and COS conflicting with other scripts in missions.

Furthermore, COS now spawns civilians faster which should help with frame-rate drops during town activations.

As always keep this forum updated with any bugs and issues. Enjoy!

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

- Blacklisted towns are removed from COS spawning

---------- Post added at 18:28 ---------- Previous post was at 18:26 ----------

It would be nice if the default customisation options had a way for decreasing the number of civilians the system spawns. Other than that, this is a great system, thanks a lot.

You can change the number of civilians spawned by opening cosInit.sqf and finding the word '_houses'.

Share this post


Link to post
Share on other sites
Guest

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

First: Thanks for COS - we've needed this for a long time :)

I have two suggestions:

* could we have config variables like _distance as global vars with a prefix? Like, COS_distance or so? Just so we have separation of code that mission designers may have to touch, and the actual COS code.

* and I would *love* to get missions/mods from some kind of version control system, like git via github.com . From a software development perspective, that can make cooperation/contributing much more easy.

Edited by Fusselwurm
(edit: correctness/clarification)

Share this post


Link to post
Share on other sites
You can change the number of civilians spawned by opening cosInit.sqf and finding the word '_houses'.

I was just thinking that it'd be better if it was under the "official" customisation options, since people afraid of scripting might not want to venture past the "do not edit beyond this line" point. Just a percentage applied at the end of the _civilians checkup would likely work fine.

Thanks for fixing the blacklist, it works fine now. However, whitelistmarkers doesn't... whiteListMkrs=["civsmarker"]; gives

if (_name #== "") then {}else{
 Error Generic error in expression

on line 55 of cosInit.sqf. Doesn't == "" work with structured text or something?

Share this post


Link to post
Share on other sites

However, whitelistmarkers doesn't... whiteListMkrs=["civsmarker"];

Hotfix. Version 0.41.

- Fixed COS whiteList markers

Share this post


Link to post
Share on other sites

BB, couple of questions.

We've upped both the distance and the number of civs spawned.

Can the trigger be changed so it's not activated by fast moving units or high altitude units? While flying across the map, we're triggering towns as we fly over them and it's impacting the server a bit.

Also, if you are attacking Kavala, you activate the COS in in both Kavala and Aggelochori. They are both big towns and again this hurts the server too much. We'd like to blacklist both towns and make a whitelist marker sort of in the middle to cover both towns, but I can't work out how to use the whitelist. Do I put a marker in the mission editor and give the whitelist that marker's name? Or will it work with any named object?

I expect you're going to say I've got a bit giddy with the distance and spawning too many civs. :)

Share this post


Link to post
Share on other sites
BB, couple of questions.

We've upped both the distance and the number of civs spawned.

Can the trigger be changed so it's not activated by fast moving units or high altitude units? While flying across the map, we're triggering towns as we fly over them and it's impacting the server a bit.

Also, if you are attacking Kavala, you activate the COS in in both Kavala and Aggelochori. They are both big towns and again this hurts the server too much. We'd like to blacklist both towns and make a whitelist marker sort of in the middle to cover both towns, but I can't work out how to use the whitelist. Do I put a marker in the mission editor and give the whitelist that marker's name? Or will it work with any named object?

I expect you're going to say I've got a bit giddy with the distance and spawning too many civs. :)

WhiteList is markers you have placed inside the editor. And remember to give the markers nice descriptions for the town labels.

I will implement a height limit in the next update. Until then you can edit line 168 and give the trigger a height limit to solve some fps issues

Share this post


Link to post
Share on other sites
WhiteList is markers you have placed inside the editor. And remember to give the markers nice descriptions for the town labels.

I will implement a height limit in the next update. Until then you can edit line 168 and give the trigger a height limit to solve some fps issues

Excellent. Many thanks.

Share this post


Link to post
Share on other sites
Guest

Hotfixed 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!

Edited by Guest
updated to latest version

Share this post


Link to post
Share on other sites

Getting errors, I think related to debugCos.

2014/04/11, 12:03:06 Error in expression <ugCOS) then {
_txt=format["INF%1,MKR%2",_counter,_mkr];
_debugMkr=createMarker [>
2014/04/11, 12:03:06   Error position: <_counter,_mkr];
_debugMkr=createMarker [>
2014/04/11, 12:03:06   Error Undefined variable in expression: _counter
2014/04/11, 12:03:06 File mpmissions\__cur_mp.Altis\cos\cosCore.sqf, line 71

Share this post


Link to post
Share on other sites

New version released (v0.5)

This update makes COS less intensive during the spawning loop and i have added a new option (Aerial activation). This feature prevents units above 50m from activating COS zones when enabled.

Call COS from the SERVER object initialization box (editor) if you are uncomfortable with scripting.

Finally,I have commented the COS scripts for fellow scriptwriters to read and understand.

Full 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)

Share this post


Link to post
Share on other sites

yeah thank you. using it for my "hunt the agent private modification" :D

Sent from mobile

Share this post


Link to post
Share on other sites

Right ... I'm gonna fly lower than 50m .... just kidding BB. Step in the right direction.

So will this spawning (running on a dedi server) now lower the chance of having a 1/4 second 'stop' on the client when approaching a village? If not is there a guaranteed way to stop this happening? It is a clear giveaway that something is about to happen :)

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

×