Jump to content
Sign in to follow this  
onedigita

markers hidden or visible based on your side

Recommended Posts

Wanted to know if its possible to create markers that are only visible on say the west side and others only visible on the east

Share this post


Link to post
Share on other sites

Replace "somePositionToSpawnMarker" with something like "getPos unit/object", replace "someMarkerName" with the name of your choosing, as well as the other stuff like icon type and so forth, and where you see "SIDE" replace that with WEST/EAST/INDEPENDENT:

[
[
	[somePositionToSpawnMarker],
	{
		_mrk = createMarkerLocal ["someMarkerName", (_this select 0)]; 
		_mrk setMarkerShape "ICON"; 
		_mrk setMarkerType "hd_warning";  
		_mrk setMarkerColor "ColorRed"; 
		_mrk setMarkerText "Your Text Here"; 
	}
],
"BIS_fnc_call",
SIDE,
false,
false
] call BIS_fnc_MP;

Short description of the code: Will call some code (being all the marker creation stuff) on only on the side specified, and because the marker creation line is "createMarkerLocal" it will only create markers for those clients on that side, no one else in the server will see it unless they are on that side.

Edited by JShock

Share this post


Link to post
Share on other sites

big thanks J, this is to hide posted basic radio chans for all the squads and so opfor incase they got ahold of a radio and they havent previously written them down donot know our exact channels

Share this post


Link to post
Share on other sites

It is important to note that the precise code for JShock's solution is not persistent in its effect. In other words, were someone to join the mission at a later stage, they would not experience the effects of that code. While altering the isPersistent argument to true would run the code for all players that join the relevant team, you may find it difficult to manage map markers with such a solution. If you were to go down the route of having persistent map markers, you might therefore benefit from implementing a more sophisticated method for persistence.

Share this post


Link to post
Share on other sites
It is important to note that the precise code for JShock's solution is not persistent in its effect. In other words, were someone to join the mission at a later stage, they would not experience the effects of that code. While altering the isPersistent argument to true would run the code for all players that join the relevant team, you may find it difficult to manage map markers with such a solution. If you were to go down the route of having persistent map markers, you might therefore benefit from implementing a more sophisticated method for persistence.

Correct, thought of that, and there are two solutions:

//initPlayerLocal.sqf
[
   [
       [somePositionToSpawnMarker],
       {
		if (isNil "someMarkerName") then
		{
			_mrk = createMarkerLocal ["someMarkerName", (_this select 0)]; 
			_mrk setMarkerShape "ICON"; 
			_mrk setMarkerType "hd_warning";  
			_mrk setMarkerColor "ColorRed"; 
			_mrk setMarkerText "Your Text Here";
		};
       }
   ],
   "BIS_fnc_call",
   SIDE,
   true,
   false
] call BIS_fnc_MP; 


//or also in the initPlayerLocal.sqf

if (side player isEqualTo WEST) then
{
_mrk = createMarkerLocal ["someMarkerName", _somePosition]; 
_mrk setMarkerShape "ICON"; 
_mrk setMarkerType "hd_warning";  
_mrk setMarkerColor "ColorRed"; 
_mrk setMarkerText "Your Text Here";
}
else
{
if (side player isEqualTo EAST) then
{
	_mrk = createMarkerLocal ["someMarkerName", _somePosition]; 
	_mrk setMarkerShape "ICON"; 
	_mrk setMarkerType "hd_warning";  
	_mrk setMarkerColor "ColorRed"; 
	_mrk setMarkerText "Your Text Here";
};
};

The second is probably the better solution anyhow.

Share this post


Link to post
Share on other sites

Ok so I create a file called initPlayerLocal.sqf then add the code above, go to the editor and call it in the Init with what please?

Also how would I get the map marker position as above '_Someposition' from the editor or is this not relevant for me to add....sorry for the novice questions!

Share this post


Link to post
Share on other sites
Ok so I create a file called initPlayerLocal.sqf then add the code above, go to the editor and call it in the Init with what please?

Also how would I get the map marker position as above '_Someposition' from the editor or is this not relevant for me to add....sorry for the novice questions!

You don't need to call initPlayerLocal. It is a "magic" file that is executed by the game automatically. See https://community.bistudio.com/wiki/Event_Scripts

Share this post


Link to post
Share on other sites
You don't need to call initPlayerLocal. It is a "magic" file that is executed by the game automatically. See https://community.bistudio.com/wiki/Event_Scripts

Thank you Kingsley for the information, that's great :yay: Just one question how would I get the marker placement position would that be from the editor and what format would it be in, thanks in advance.

Share this post


Link to post
Share on other sites

In that code where it says _somePosition, it's referring to a position array, so that could be getPos player or getMarkerPos "myMarker"... The wiki has loads of documentation on the position stuff

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  

×