Jump to content
Elite IV

A way to allow players to enable / disable visible user defined map markers

Recommended Posts

Hey guys,

 

I know this probably far stretch but I don't see this as impossible at all. Pretty sure it can be done but wanted to know if there were any other ways.

 

So my idea (because my mission has so many damn markers and it gets messy when you zoom out...) I want to give my players the ability to toggle map markers of a sort on/off.

 

I was thinking as I don't think there are any specific functions to show/hide user defined map editor map markers,

 

How about instead of me placing map markers on the map, I just spawn them via code on the mission init in arrays and manipulate those arrays later?

 

 

I feel like it'll get messy. I'll need the coordinates of every map marker then on Show it'll spawn the markers and on Hide it'll delete them. (This will hopefully be client sided? Still learning - I feel like this will effect whole server).\

By default when the player loads into server, I'll spawn the map markers via init then later when a player clicks on a button via some dialog that i'll create later it will manipulate the arrays accordingly.

If hide is clicked it'll delete a specific array / group of map markers on the map or if show is clicked then it'll spawn them on map but I'll add a check to see if markers are already on the map (   !(isNull) ?? if they exist).

 

Would there be better way of doing this? Point me in right direction would be much appreciated.

 

I don't have any code to show yet, Would just like to know how would you guys approach this? Am i on the right path?

Share this post


Link to post
Share on other sites

It seems to me that there is no point in deleting all your markers. They can simply be made transparent under one condition and visible again under another.
Transparent:

{_x setMarkerAlphaLocal 0} forEach _array_of_markers;

Visible:

{_x setMarkerAlphaLocal 1} forEach _array_of_markers;

 

  • Like 1

Share this post


Link to post
Share on other sites

Just as idea,

what I would do is:

 

1) create initPlayerLocal.sqf in mission folder

It runs locally on player pc when he starts the mission

 

2) insert these in initPlayerLocal.sqf

// create local marker for each connected player 
// note: here some asssumed coordinates, but you can use also markers (trasparent) already on map and identify the position by a getMarkerPos "markerOnMap_1" (i.e. createMarkerLocal ["Mrk_1",getMarkerPos "markerOnMap_1"];
createMarkerLocal ["Mrk_1",[50,120,1]];
createMarkerLocal ["Mrk_2",[2,300,125]];
createMarkerLocal ["Mrk_3",[0,0,100]];

// define an array with markers
MarkArray = ["Mrk_1","Mrk_2","Mrk_3"]; // it is a global variable defined locally on the players pc 

//make markers transparent
for "_i" from 0 to (count MarkArray - 1) do 
    {    
        (MarkArray select _i) setMarkerAlphaLocal 0;
    };


// strings to activate the Show/Hide commands by the ACE self menu for each player
// show
 _actionMrkOn = {execVM "ShowMarkers.sqf";};
_showMkr = ['ShowMkr', 'Show markers', , _actionMrkOn, {true}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], _showMkr] call ace_interact_menu_fnc_addActionToObject;
// hide
_actionMrkOFF = {execVM "HideMarkers.sqf";};
_hideMkr = ['HideMkr', 'Hide markers', , _actionMrkOFF, {true}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], _hideMkr] call ace_interact_menu_fnc_addActionToObject;    

Here you can use the ACE command to allow the activation of Show/Hide commands by the players. So the player has the commands on his ACE menu.

 

3) create ShowMarkers.sqf in mission folder and insert this

for "_i" from 0 to (count MarkArray - 1) do 
    {    
        (MarkArray select _i) setMarkerAlphaLocal 1;
    };

 

4) create HideMarkers.sqf in mission folder and insert this

for "_i" from 0 to (count MarkArray - 1) do 
    {    
        (MarkArray select _i) setMarkerAlphaLocal 0;
    };

 

In this way each player can activate/deactivate markers locally on his pc by the ACE command whenever and as many times as he wants.

The only remark is that markers are transparent when mission starts and they have to activate them for the first time (tell them to do it). You cannot do it for them, because markers must be local on clients pc.

Not tested, but this is the idea, that of course can be improved.

 

cheers

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

×