Jump to content
Sign in to follow this  
Migal

sector control detect only unit on foot

Recommended Posts

Hi, I'm playing with sector control module.

I got spawn and remove modules by script but I want to count for sector conquer just unit on foot but I cannot find how.

 

here my script. It just need a marker "mrk_1".

 

if !(isNull sec_0) exitWith{systemChat "esiste"};

_pos = getMarkerPos "mrk_1";

_name = "Noa";
_sides = [west, east];

_trgSize = 50;


_logic = (createGroup sideLogic) createUnit ["ModuleSector_F", _pos, [], 0, "NONE"];

//Default setting,  which are optional
_logic setVariable ["DefaultOwner","-1"];
_logic setVariable ["OnOwnerChange",""];
_logic setVariable ["OwnerLimit","0"];
_logic setVariable ["ScoreReward","0"];
_logic setVariable ["TaskOwner","0"];
_logic setVariable ["Name", _name];

_logic setVariable ["CostInfantry", "1"];
_logic setVariable ["CostWheeled", "1"];
_logic setVariable ["CostTracked", "0"];
_logic setVariable ["CostWater", "0"];
_logic setVariable ["CostAir", "0"];
_logic setVariable ["CostPlayer", "1"];


//Set the sides for the sector
_logic setVariable ["sides", _sides];

_logic setVariable[ 'BIS_fnc_initModules_disableAutoActivation', false, true ];

_handle = [ _logic, _trgSize ] spawn {
				params[ '_logic', '_trgSize' ];
			
				waitUntil {
					!isNil { _logic getVariable [ 'finalized', nil ] } &&
					{ !( _logic getVariable [ 'finalized', true ] ) }
				};	
				
				_logic setVariable [ 'size', _trgSize ];
				[ _logic, [], true, 'area' ] call BIS_fnc_moduleSector;
		
				_trg = ( _logic getVariable 'areas' ) select 0;
				_mrk = ( _trg getVariable 'markers' ) select 0;
				_mrk setMarkerSize [ _trgSize, _trgSize ];
};
_logic setVehicleVarName "sec_0";
sec_0 = _logic;

 

Inside BIS_fnc_sectorModule there is a local function:

 

_fnc_threat = {

            private ["_veh","_coef","_scanCrew","_threat","_score"];

            _veh = _this select 0;

            _coef = _this select 1;

            _scanCrew = _this select 2;

            _threat = getarray (configfile >> "cfgvehicles" >> typeof _veh >> "threat");

 

            _score = 0.1; //--- Use non-zero value, so even objects with threat[]={0,0,0} can capture

            {_score = _score + _x} foreach _threat;

            _score = _score * _coef;

            if (isplayer _veh) then {_score = _score * _costPlayersLocal;};

 

            if (_scanCrew) then {

                {

                    _score = _score + ([_x,_costInfantry,false] call _fnc_threat);

                    if (isplayer _x) then {_score = _score * _costPlayersLocal;};

                } foreach (crew _veh - [_veh]);

            };

            _score

        };

 

called localy with third argument always true.

If I could define _scancrew to always false I could get the solution but I don't know if it's possibile.

 

One way would be to attach to the module a new function.

But I cannot get if working.

 

Any help?

 

 

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  

×