Jump to content
bangabob

Civilian Occupation System (COS)

Recommended Posts

On 10/6/2016 at 6:58 AM, thedubl said:

I looked at this for 5 minutes this morning, while having the morning coffee. Looks like this is finding wonky roads segments being return by roadConnectedTo (https://community.bistudio.com/wiki/roadsConnectedTo), which then leads to the rest breaking since the _connectedRoad var is not defined. I will see if I can do work around after work today.

cosCore: ~129, ~185


_tempPos=_roadPosArray select _rdCount;_rdCount=_rdCount+1;		_roadConnectedTo = roadsConnectedTo _tempPos;_connectedRoad = _roadConnectedTo select 0;_direction = [_tempPos, _connectedRoad] call BIS_fnc_DirTo;

Any fixes yet? I changed direction to be  _direction = random 360; which makes it work, but at the expense of vehicles being lined up with the road.

  • Like 1

Share this post


Link to post
Share on other sites

Is there a way I can accurately track all civilians in an Area being spawned? I need to be able to count all civilians at the start of a mission without a using constant loop. I tried putting it at the end of cosInit.sqf but that only seems to be accurate to the script initializing and not actually spawning the civilians. FYI I am only spawning the civilians in a single town (the spawn points of which are made up of the town itself and 3 markers around it) and after the first civilians spawn in the town I don't need to spawn anymore. Is there somewhere perhaps in cosCore where I could put my count which would be accurate to all the civilians being spawned?

Share this post


Link to post
Share on other sites
On 6/8/2017 at 3:23 PM, Haymaker said:

Any fixes yet? I changed direction to be  _direction = random 360; which makes it work, but at the expense of vehicles being lined up with the road.

Because I just want this damn thing to work with the direction did you just put                    _direction = random 360; in place of                    _direction = [_tempPos, _connectedRoad] call BIS_fnc_DirTo;

 

Also im trying to implement this on malden however all the units are spawning on the roads only this worked really well in tanoa so im unsure of what part needs to be  changed.

Share this post


Link to post
Share on other sites

Hey all,

 

I have an issue with the town population not showing for all players. I logged into a mission with a friend (host) and he could see the popup with the town name and population while I could not. Apart from that everything works flawlessly so far.

I looked a bit into the init and tried to modify some things but could not find the appropriate one. Should I rerun the script globally via the in-game debug console or modify something in the init? Any suugestions are very welcome!

 

Thanks,

Adam

Share this post


Link to post
Share on other sites
13 minutes ago, pappagoat said:

I can't get the white list and black list markers to work, any ideas?

 

check https://community.bistudio.com/wiki/nearestLocation and https://community.bistudio.com/wiki/nearestLocations

basically they are the city names. All predefined cities are by default in whitelist and in case you do not want civilians in any one of them you use the blacklist

whitelist is used by custom markers where you want some civilians. I didn't use it but I think you put some buildings on a remote are where no city or building exists, then you put a marker there and put the name of the marker in whitelist

Share this post


Link to post
Share on other sites
On 10/30/2018 at 7:53 PM, Devastator_cm said:

 

check https://community.bistudio.com/wiki/nearestLocation and https://community.bistudio.com/wiki/nearestLocations

basically they are the city names. All predefined cities are by default in whitelist and in case you do not want civilians in any one of them you use the blacklist

whitelist is used by custom markers where you want some civilians. I didn't use it but I think you put some buildings on a remote are where no city or building exists, then you put a marker there and put the name of the marker in whitelist


Can markers be used for blacklist areas?

Share this post


Link to post
Share on other sites

Ok so does this script still work?  And he anyone used a separate script to allow civs to join silent players? If so what script and please explain usage.  Thanks.

Share this post


Link to post
Share on other sites

Anyone fix the Tanoa Direction_to errors? Really wanting this script right now. works awesome on altis

Share this post


Link to post
Share on other sites

COS_Tanoa.zip

 

COS v0.5a - TANOAN SPECIFIC UPDATE by me, karphead

 

Added a few lines to remove road positions that cause COS to fail. nearRoads is pulling in objects like "101052: invisibleroadway_square_f.p3d" to the _roadlist variable which is why I think the script is failing down the road (I don't know why, it's above my paygrade). Harcourt is a Tanoan location that causes COS to fail regularly. When I dumped _roadlist to the log I saw various entries that had .p3d filenames and that seemed to be the common denominator when it came to COS crashes on Tanoa. Here's is an ARRAY OF OBJECTS that gets returned when using nearRoads on Harcourt:

 

[1683361: ,1683363: ,1683364: ,1683365: ,1683366: ,1683367: ,1683368: ,101050: invisibleroadway_square_f.p3d,1683800: ,1683801: ,1683802: ,1683803: ,1683370: ,1683369: ,101052: invisibleroadway_square_f.p3d,101051: invisibleroadway_square_f.p3d,1684124: ,1683804: ,1683371: ,101053: invisibleroadway_square_f.p3d,1684125: ,1683372: ,1683614: ,101183: invisibleroadway_square_f.p3d,101182: invisibleroadway_square_f.p3d,1684126: ,1684127: ,1683373: ,1683617: ,1683618: ,1683616: ,1683615: ,1683613: ,1683612: ,1683611: ,1684128: ,1683374: ,1683610: ,1684129: ,1683376: ,1683375: ,1683609: ,1684119: ,1684118: ,1684113: ,1684117: ,1684116: ,1684115: ,1683608: ,1684114: ,1683377: ,1685013: ,1684112: ,1684111: ,1683607: ,1683606: ,1694605: ,1694606: ,1694607: ,1683378: ,1683379: ,1685009: ,1685011: ,1685010: ,1685012: ,1694608: ,1684108: ,1684110: ,1684109: ,1684107: ,1684106: ,1683605: ,1684105: ,1683604: ,1683603: ,1683601: ,1683602: ,1685008: ,1683380: ,1684133: ,1684134: ,1684135: ,1683383: ,1683384: ,1683385: ,1683386: ,1683387: ,483252: bridgesea_01_ramp_down_f.p3d,483251: bridgesea_01_ramp_f.p3d]

 

Harcourt is located on an outlier island, separated by a bridge to Tanoa - I believe the invisibleroadway_square_f.p3d objects are for the bridge. It also has a boat ramp, which is what I think all the "bridgesea" objects are about.

 

The script I added goes through the _roadlist array to remove any items that respond false to isOnRoad. The only way I've been able to distinguish the .p3d files from the other objects is by using isOnRoad (getObjectType and typeName were of no use because they all returned the same result). However, not all of the .p3d filenames return false, for example, most of the "invisibleroadway" files respond false to isOnRoad but the "bridgesea" files do not. I believe, but I haven't verified yet, that the "bridgesea" files will cause COS to fail.

 

The good news is there were only two locations (Harcourt and Saint-Julien) that I discovered that had .p3d filenames that returned true to isOnRoad:
 
    483247: bridgesea_01_ramp_f.p3d ("Harcourt")
    483252: bridgesea_01_ramp_down_f.p3d ("Harcourt")
    483251: bridgesea_01_ramp_f.p3d ("Harcourt")
    483249: bridgesea_01_ramp_f.p3d ("Harcourt")
    456862: bridgesea_01_ramp_down_f.p3d ("Saint-Julien")

 

So, I've blacklisted those two cities by default. I've also blacklisted Sosovo and Nasua because they didn't have enough road locations and would cause the spawn search to go crazy.

 

When adding you're own markers, just make sure you're keeping them away from bridges and boat landings. It's  likely there are other objects that will cause the script to fail but I don't know what they are yet. Keep an eye out for weird road objects I guess.

 

In any case, the script I added should make COS work on Tanoa without erroring out. Don't quote me on that. It's a band-aid. What someone needs to do is write some code that can remove all the .p3d entries from _roadlist reliably.

 

Other stuff:
- removed "sagonisi" from blacklist
- made _showmarker = true by default, update to false to turn off
- made debugCOS = true by default, update to false to turn off
- the number in this forEach line is tied to map size. Updated it to 8000 for Tanoa (radius).
foreach (nearestLocations [getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["NameCityCapital","NameCity","NameVillage","CityCenter"], 8000]) +whiteListMkrs;
- added map teleport if debug is true
- added roadcheck script after road position array is generated (_roadlist). It removes any road positions that come back false to isOnRoad which could cause COS to error out:
    {
        _roadcheck = isOnRoad _x;
        if !(_roadcheck) then {
            _roadlist = _roadlist - [_x];
        };
    } forEach _roadlist;
- reduced # of civilian spawns to half
- reduced COS spawn distance to 300 (from 500)
- reduced max COS groups to 36 (from 72)
- reduced _slack to 1
- reduced radius search to 25 (from 50)
- added TESTMARKER to whitelist

 

Since the Tanoan map is smaller than Altis I reduced a lot of the spawn numbers to half. It doesn't seem out of place for the island and helps performance. It actually felt like overkill using the default spawn numbers.

 

My fix is rather slow, using an if/then statement to remove the problem array items. I couldn't get deleteAt to work and didn't really have much luck with the Object Array because of the weird long names with punctuation and spaces. It could definitely be optimised by someone that is more familiar with working with Arma arrays. I hate them.

Share this post


Link to post
Share on other sites

oh yeh, i think if you still run into connectedRoad issues it's because you have two major roads in your marker that aren't connected to each other by a road that COS recognizes. so when creating your whiteList markers make sure all the roads within are connected. duh.

Share this post


Link to post
Share on other sites

i failed. upon continued testing i started running into errors again. notably around Tobakoro, La Foa, Cerebu and Vagalala and Oumere. probably others. reducing spawn numbers again seemed to help but not enough to make Tanoa error-free. sorry, i initially only tested this for a day and i thought i had nailed it with the .p3d crap, but there's definitely more going on that's causing it to fail.

 

here's an updated mission file with reduced spawn numbers - i will say that it is reliable enough for myself to include it as a quick and easy way to add civilian life to my own Tanoan missions - but that's me being subjective:

 

COS_Tanoa_v0.5b

 

- turned aerielActivation to false (turn to true if you want flying over towns to spawn civs)
- reduced _slack to zero
- reduced # of spawned civs

 

i should distinguish that i see two types of errors, one that causes COS to stop running (the .p3d issues?) and another that I think just affects the patrol script (the connectedRoad issues?), good luck to anyone that can kill them

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

×