Jump to content
Sign in to follow this  
1para{god-father}

Work out if No civilians left

Recommended Posts

How can I work out if there are no Civilians within a marker area - civilians are created by ALICE and some put in by editor

Thanks

Share this post


Link to post
Share on other sites

I tried to figure out the same thing using some triggers. The number of civilians change all the time and if you kill a few the number still goes up and down. The interesting thing is when I setdammaged all civilians in the trigger some explosions started in the doorways that spawns civilians. I couldnt figure out how to find the number of civilians as I dont know how ALICE and the doorways works.

Share this post


Link to post
Share on other sites

if its a perfect circle elipse marker, then you could just use distance to check.

_marker = _this select 0;
_unitNear = _this select 1;

_pos = getMarkerPos _marker;
_size = getMarkerSize _marker;
_radius = (_size select 0)/2;
if ( (_unitNear distance _pos) < _radius ) then {
hint format["%1 is inside marker %2",_unitNear,_marker];
};

// short version:
_marker = _this select 0;
_unitNear = _this select 1;

if ( (_unitNear distance (getMarkerPos _marker)) < ((getMarkerSize _marker select 0)/2) ) then {
hint format["%1 is inside marker %2",_unitNear,_marker];
};

if not a perfect circle, shuko knows the way. :D

Share this post


Link to post
Share on other sites

Thanks, how would I run that? , I would like to run it from a script rather than from the editor in a trigger, as the maker will be a random place on the map.

if its a perfect circle elipse marker, then you could just use distance to check.

_marker = _this select 0;
_unitNear = _this select 1;

_pos = getMarkerPos _marker;
_size = getMarkerSize _marker;
_radius = (_size select 0)/2;
if ( (_unitNear distance _pos) < _radius ) then {
hint format["%1 is inside marker %2",_unitNear,_marker];
};

// short version:
_marker = _this select 0;
_unitNear = _this select 1;

if ( (_unitNear distance (getMarkerPos _marker)) < ((getMarkerSize _marker select 0)/2) ) then {
hint format["%1 is inside marker %2",_unitNear,_marker];
};

if not a perfect circle, shuko knows the way. :D

Share this post


Link to post
Share on other sites

Reread the question, and modified abit.

Place this local function in top of your script or atleast before you neeed to check.

_checkMArker_fnc = {
_marker = _this select 0;
_side = _this select 1;

_pos = getMarkerPos _marker;
_size = getMarkerSize _marker;
_radius = (_size select 0)/2;
// get number of how many of the choosen side is within marker wich is perfect circle.
_someOnePresent = ({side _x == _side AND (_x distance _pos) < _radius} count allUnits);
_someOnePresent
};

run this in your script whenever you want to check if a civilian is inside.

_count = ["markerName",civilian] call _checkMArker_fnc;  // civilian is side, use east or west etc for other sides.

you will get the number of units inside the marker of the desired side, 0 for noone and etc...

Share this post


Link to post
Share on other sites

ohhh nice 1 that done the Job !

What would be the best way to check say every 30 sec and exit if 0 and will it be any performance drop in doing this every 30 sec , it will be for a MP mission

Many thanks !

BTW did you ever finish your ParaReinforce - with Armour drops ?

Share this post


Link to post
Share on other sites

What would be the best way to check say every 30 sec and exit if 0 and will it be any performance drop in doing this every 30 sec , it will be for a MP mission

just use a while loop or something, should not affect FPS, not even with 1 sec delays..

while {true} do {
    _count = ["markerName1",civilian] call _checkMArker_fnc;
    if (_count != 0) then {
         ["markerName1"] execVM "roboCopPatrolScript.sqf";
    };
    _count = ["markerName2",west] call _checkMArker_fnc;
    if (_count != 0) then {
         ["markerName2"] execVM "ramboPatrolScript.sqf";
    };
    sleep 30;
};

BTW did you ever finish your ParaReinforce - with Armour drops ?

Not sure what was the latest test version you recieved.

Its been on the backburner awhile, ill see sunday if i can clean up latest version and send it to you, i had the drops working really nicely, maybe ill just add them in and release a new version just with that in it...

Still alot work left to do on it, just havent been fully motivated lately, someday ;)

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
Sign in to follow this  

×