Jump to content
Sign in to follow this  
Cold Evil

How to only show marker fo a specific Unit?

Recommended Posts

Hi!

I'm am currently trying to make unit markers that follows units. Invisible for all other players except certain named key units. This what i have done so far.

This scrip do the following at the moment: when a unit is existing a named marker will follow the unit. BUT! i want it to IF your are Air Traffic Control marker Helo1, Helo2 and Plane1 will be shown. How do i do that? This is the experiment so far: (Used a type of player cause i did not know how to use unit name)

while {true} do
{
if (typeOf player == "B_officer_F") then {

	_marker setMarkerAlpha 1;
	while {alive _unit} do 
	{
		_marker setMarkerPosLocal getPos _unit;
		sleep _delay;
	};
	_marker setMarkerAlpha 0;
	waitUntil {alive _unit};
};
};

(A changed invade & annex script)

Share this post


Link to post
Share on other sites

Awesome it works exactly like i wanted it to do.

One question tho is it possible for other officers to not see the marker?

Share this post


Link to post
Share on other sites
Awesome it works exactly like i wanted it to do.

One question tho is it possible for other officers to not see the marker?

Sorry it took so long for me to get back to you....

Sure thing, you can change the defines around so that rather than looking for a class its looking for specific named units.

So if we change this:

#define atcPlayerClasses 	["B_officer_F"]

#define isATC	(typeOf player in atcPlayerClasses)

To this:

#define atcPlayerSTR 	["atc"]

#define isATC	(str player in atcPlayerSTR)

That should do the trick.

Haven't had a chance to check it yet as I am away from my machine that has A3 on it, but it should work.

-Simon

Share this post


Link to post
Share on other sites
hello I'm looking for something like this that look just by the side amrcadores west, east, independent labels like this in blue, only sees his side some script like this

http://www.comunidadcassual.es/Errorarma3/localizadorequipo.png (513 kB)

Holy thread necro Zona.... lol

Anyway, if you want to use the script example I did above you will want to add in the proper defines and alter a couple that are there so that you are making a clear separation of each side.

Adding in the defines for each side:

#define eastPlayerClasses ["east_classname1"."east_classname2"]
#define isEast (type of player in eastPlayerClasses)
#define indePlayerClasses ["independent_classname1","independentclassname2"]
#define isInde (type of player in indePlayerClasses)

You'll also want to change the playerSTR define to a side and add in additional defines for each side:

#define westPlayerSTR ["unitname1","unitname2"]
#define eastPlayerSTR ["unitname1,"unitname2"]
#define indePlayerSTR ["unitname1,"unitname2"]

You wan to do the same for any vehicle defines you have as well:

Note: The reason they are separate is so that you can have specific vehicle type markers set for each vehicle class, as found in CfgMarkers.

#define westVehSTR ["west_unitname1","west_unitname2"]
#define eastVehSTR ["east_unitname1","east_unitname2"]
#define indeVehSTR ["independent_unitname1","independent_unitname2"]

#define westHelis ["west_unitname1","west_unitname2"]
#define westJets ["west_unitname1","west_unitname2"]
#define westArmor ["west_unitname1","west_unitname2"]
#define westTrk ["west_unitname1","west_unitname2"]

Once you have your defines all squared away you will need to update the createMarkers.sqf file so that the markers for each side and are created as needed. As we are using true commands here the markers are only created for the player for the side they are on. Be sure to include all the markers you want to create for each side under that sides section.

if (isWest) then {
{ 
	_mkr = createMarkerLocal[_x, spawnPos]; 
	_mkr setMarkerTypeLocal "mil_triangle"; 
	_mkr setMarkerSizeLocal [0.4,0.6]; 	
} forEach westPlayerSTR;
{	
               _mkr = createMarkerLocal[_x, spawnPos];
	_mkr setMarkerTypeLocal "b_air";
	_mkr setmarkerSizeLocal [0.7,0.7];
} forEach westHelis;
       {
	_mkr = createMarkerLocal[_x, spawnPos];
	_mkr setMarkerTypeLocal "b_plane";
	_mkr setmarkerSizeLocal [0.7,0.7];
} forEach westJets;
};

We then want to change the functions.sqf to be side specific. You should be able to just copy/paste the code and change the side.

westPlayerMarkers = { 	
private ["_colour","_plr","_vcl"];

   { 		
	if !isNil _x then {
		_plr = call compile _x;
		if(isNull _plr) exitWith { _x setMarkerPosLocal spawnPos; _x setMarkerTextLocal ""; };
		_vcl = vehicle _plr;
		if (_vcl != _plr) exitWith { _x setMarkerPosLocal spawnPos; };
		_colour = "ColorBlue";
		if (!alive _plr) then { _colour = "ColorBlack"; };
		if (lifeState _plr == "UNCONSCIOUS") then { _colour = "ColorRed"; };
		_x setMarkerColorLocal _colour;
		_x setMarkerPosLocal getPosATL _plr;
		_x setMarkerDirLocal getDir _plr; 
	} else { _x setMarkerPosLocal spawnPos; _x setMarkerTextLocal ""; };
} forEach westPlayerSTR;
};

westVehicleMarkers = { 		
   private ["_mkr","_vcl","_crew","_type"];

   {
	if !isNil _x then {
		_mkr = _x;
		_vcl = call compile _x;	
		_mkr setMarkerPosLocal getPosATL _vcl;
		_crew = crew _vcl;
		_type = typeOf _vcl;
		if (!alive _vcl) then { _mkr setMarkerColorLocal "ColorBlack"} else {
			if (count _crew == 0) then { _mkr setMarkerColorLocal "ColorYellow"; } else {
				_mkr setMarkerColorLocal "ColorBlue";
			}; 
		};
	};
} forEach westVehSTR;
};

Finally we can update the mainLoop.sqf so be side specific as well. This is where the above functions will be called per player using while statements. Just be careful to wrap your 'while' statements in 'if' statements so that you don't have issues with the loop not functioning.

if (isWest) then {
while { isWest } do {
	call westPlayerMarkers;
	call westVehicleMarkers;
	sleep 2;
};
};

All in all it will be more an issue of just entering all the data needed, but is should allow you to separate the markers so that they only show for the side the player is on. I have done a quick example mission here that has West, East, and Independent along with vehicles and such as well. It appears to work for me but that is just one person testing the mission, I didn't have anyone else that could join on the other teams to make sure, so you will want to test that. Also this doesn't do any area makers at all, such as a base marker or anything, this can be added in the createMarkers.sqf for each side by having the marker spawn to a specific location rather than the one set in the defines.

Example Mission: https://dl.dropboxusercontent.com/u/7196743/marker_test_VR_v2.VR.zip

I included the .pbo in there as well, just place it in your MPMissions folder and you can load it right up with some friends and test that the markers are working as intended.

Hope this helps!

Simon

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  

×