Jump to content
Sign in to follow this  
SWATrus

Marking Enemys\Friendly troops

Recommended Posts

Need a little script for mission that will show your teammates on the map(all time),and if they are closer than 100 meters to enemy,enemy markers will be shown on map too.(Didnt found any script like this one).Thanks if what.:)

Share this post


Link to post
Share on other sites

adjust the difficulty settings ingame to easy and i think markers are automatic.

EDit: tested in SP editor, fixed errors, working fine.

Scripted solution:

Place in init.sqf

player execVM "trackMarker.sqf";

Save this below as trackMarker.sqf

waitUntil {!isNull _this};
if (_this != player OR !isNil "trackingPlayerMarkers") exitWith {};
trackingPlayerMarkers = true;  // not sure if this is really needed, combined with the OR part above.

_friend = side _this;

_marker_fnc = {
_mkrNr = _this select 0;
_unit = _this select 1;
_color = _this select 2;
_mkrName = format["unitMarker_%1",_mkrNr];
_mkr = createMarkerLocal [_mkrName, position _unit];
_mkr setMarkerTypeLocal "Dot";
_mkr setMarkerColorLocal _color;
_mkr setMarkerSizeLocal [0.6,0.6];
       //_mkr setMarkerTextLocal Name _unit;  // remove the // in front of this line to have names on units.
_mkr
};

_mrkNr = 0;
_mrkArr = [];
while {true} do {
{
	_unit = _x;
	if ( ({_unit in _x} count _mrkArr) == 0 ) then {
		_callMarker = false;
		_color = "ColorBlue";
		if (_friend == side _unit) then {
			_callMarker = true;
		} else {
			if ( ({(_unit distance _x) < 100 AND side _x == _friend} count allUnits) > 0 ) then {
				_color = "ColorRed";
				_callMarker = true;					
			};
		};
		if (_callMarker) then {
			_mrkNr = _mrkNr + 1;
			_mkr = [_mrkNr,_unit,_color] call _marker_fnc;
			_mrkArr = _mrkArr + [[_unit,_mkr]];
		};
	};
} foreach allUnits;

_cnt = 0;
{
	_unit = _x select 0;
	_mkr = _x select 1;
	_delete = true;
	if (!isNull _unit AND alive _unit) then {
		_delete = false;
		_type = "b_armor";
		if ((vehicle _unit) isKindOf "Man") then {
			_type = "man";
		};
		if ((getMarkerType _mkr) != _type) then {
			_mkr setMarkerType _type;
		};
		_mkr setMarkerPos (getpos _unit);
		_mkr setMarkerDir (getDir (vehicle _unit));
	};

	if (side _unit != _friend AND ({(_unit distance _x) < 200 AND side _x == _friend} count allUnits) == 0) then {
		_delete = true;
	};

	if (_delete) then {
		deleteMarker _mkr;
		_mkr = Nil;
		_mrkArr set [_cnt,-1];
		_mrkArr = _mrkArr - [-1];
	};
	_cnt = _cnt + 1;
} foreach _mrkArr;
sleep 1;
};

Untested code, but should work, most likely for JIP aswell.

Will mark any friendly units no matter where they are, and will mark any enemys within 100 meter of friendlys, enemys marked will be unmarked once they are 200 or more away from all friendlys.

Edited by Demonized
fixed scope error, tested in SP editor.

Share this post


Link to post
Share on other sites

Hey I need help with a scrip like this if someone would be so kind? I don't need a scrip to show all friendly units on the map but just one unit? Can anyone come up with a scrip maybe i could put in a units init line? Thank you in advance

Hoofin

Share this post


Link to post
Share on other sites

I found this out a few days ago, Place a military symbols module, it does exactly what you want, you need to place this in the module init

setGroupIconsVisible [true,true];

Where the first true is marker on maps and the 2nd is for symbols in game.

Share this post


Link to post
Share on other sites
Hey I need help with a scrip like this if someone would be so kind? I don't need a scrip to show all friendly units on the map but just one unit? Can anyone come up with a scrip maybe i could put in a units init line? Thank you in advance

Hoofin

1: place one marker of your choise and name it.

2: place this in tracked unit init:

_null = [this,nameOfMarker] spawn {
while {true} do {
	(_this select 1) setMarkerPos (_this select 0);
	sleep 1;
};
};

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  

×