JacobJ 10 Posted April 15, 2011 Hey all I have made a trigger with civilians present and repeatable. This trigger covers a village. I have ALICE placed in the village and only in that village. When I make a call for how many civilians there is present in the trigger I get 71, but there is only 35 civilians, 5 wreaks and some SLIVE cars. This is what I use to call the count: _pop = civilian countSide list countzone; hint str _pop; I have found a script that seems to do what I want, but it only works on civilians you place in the editor and not the once generated by ALICE. Here is the script(s): civ_init.sqf /* trigger act by Civilians Present nul = [thisList, side] execVM "nokillciv\civ_Init.sqf"; side = WEST, EAST */ private [ "_civLista" ]; _civLista = _this select 0; // list of all civilians RAF_KilledBySide = _this select 1; // side which count the kills { if (_x isKindOf "civilian") then { _x AddEventHandler ["killed", {nul= _this execVM "nokillciv\CountKilledCiv.sqf";}]; }; } forEach _civLista; cyw = 0; Countkilledciv.sqf: private [ "_killerSide", "_side" ]; _side = RAF_KilledBySide; _killerSide = side (_this select 1); if (_side == _killerSide) then { cyw = cyw + 1; }; Is there another way to display how many civilians there is in the town or even in the whole map (because I have no other civilians in the mission and I dont have ALICE in other towns)? /Jacob Share this post Link to post Share on other sites
roguetrooper 2 Posted April 15, 2011 (edited) Is there another way to display how many civilians there is in the town or even in the whole map (because I have no other civilians in the mission and I dont have ALICE in other towns)? Whole map: _center = position objectName / or [x,y,z]; _distance = 500; _amount = 0; _side = civilian; { if ((alive _x) and (side _x == _side)) then { _amount = _amount + 1 } } forEach allUnits; hintsilent format ["%1: %2", _side,_amount]; Within an area with _center as center: { if ((_x distance _center <= _distance) and (alive _x) and (side _x == _side)) then { _amount = _amount + 1 } } forEach allUnits; hintsilent format ["%1: %2", _side,_amount]; Concerning a limited area, you could place a trigger on the map (Activation: once, Condition: true, without any functions), give it a name (= _center) and the radius/area (= _distance) you are looking for. So you can see directly within the editor the area that is searched for civilians. For creating civilians in a town, I use my own scripts, such as: if !(isServer) then { exit }; _amount = paramsArray select 11; if (isNil _"amount") then { _amount = _this select 0 }; if (_amount <= 0) then { goto "end" }; _possible1 = ["TK_CIV_Takistani01_EP1","TK_CIV_Takistani02_EP1","TK_CIV_Takistani03_EP1","TK_CIV_Takistani04_EP1","TK_CIV_Takistani05_EP1","TK_CIV_Takistani06_EP1"]; _possible2 = ["TK_CIV_Woman01_EP1","TK_CIV_Woman02_EP1","TK_CIV_Woman03_EP1"]; _possible3 = ["TK_CIV_Worker01_EP1","TK_CIV_Worker02_EP1"]; _possible = [] + _possible1 + _possible2 + _possible3; _number = 0; _radius = 225; _pos = position wpc1; _grp = group dummy_civ; _skill = 0.2; _rank = "private"; _form = "NONE"; #start _number = _number + 1; _type = _possible select (random ((count _possible)-1)); _name = format ["civ%1",_number]; _name = _grp createUnit [_type, _pos, [], _radius, _form]; _name setdir random 360; [_name] joinSilent grpNull; [_name,wpc1,225,"MOVE"] exec "waypoints.sqf"; _name addEventHandler ["Killed", {[_this select 0,_this select 1] exec "civkilled.sqf"} ]; removeallweapons _name; _name removebackpack; _name setcombatmode "blue"; _name setbehaviour "careless"; _name setunitpos "up"; _name setspeedmode "limited"; _name allowfleeing(random 0.25) _name setskill _skill; if ( random(100) < 10 ) then { _name setspeedmode "normal" }; if (_number < _amount) then { goto "start" }; #end deletevehicle dummy_civ; exit; waypoints.sqf: _man = _this select 0; _grp = group _man; _pos = position (_this select 1); _radius = _this select 2; _type = _this select 3; if ((isNil "_man") or (isPlayer _man)) then { exit }; _array = []; _wps = 30; for "_x" from 1 to _wps do { _array = _array + [_x] }; { wp = _grp addWaypoint [_pos,_radius] } forEach _array; { [_grp, _x] showwaypoint "never" } forEach _array; { [_grp, _x] setWaypointType _type } forEach _array; [_grp,_wps] setWaypointType "CYCLE"; #end exit; This is just an example. So I can create an variable and desired amount of civilians in a definable area around a definable center. They all move in a realistic and civilian way (pedestrian walks and such) randomly through the town. This makes a town realistically inhabited. To make it work, you need a civilian placed anywhere in the editor with the name "dummy_civ" (my example). It gets deleted when all civilians are created. This example creates civilians around an object (invisible helipad or gamelogic or sth like this) in a radius of 225 meters. Each civilian walks his/her own ways within a radius of 225 around the center. Edited April 15, 2011 by RogueTrooper Share this post Link to post Share on other sites
JacobJ 10 Posted April 15, 2011 Okay, that is one cool script you got there. Very nice! I will defenetly use this in my mission now. Thank you very much! Share this post Link to post Share on other sites