Jump to content
Sign in to follow this  
thecoolsideofthepillow

Hide Editor Placed Markers for Side?

Recommended Posts

I was just wondering if there was a simple way I could take all the markers I already set down in the editor and hide them for the teams that should not see them, without having to delete and replace them via scripts.

 

I tried making them all hidden at start and then re-show them to the appropriate teams, but while they hide just fine, they won't un-hide when I want them to.

 

I forgot that placing the markers in the editor makes them visible to everyone by default and I don't want to have to redo the whole marker system if there's a way around it.

 

Share this post


Link to post
Share on other sites
private ["_mrkrs"];
_westMrkrs = ["mrkrName","mrkrName","mrkrName"];
_eastMrkrs = ["mrkrName","mrkrName","mrkrName"];
_sideplr = side player;
switch (_sideplr) do
{
	case "WEST": {_mrks = _eastMrkrs};
	case "EAST": {_mrks = _westMrkrs};
};
{_x setMarkerAlphaLocal 0;}forEach _mrkrs;

Untested but should be good.

Share this post


Link to post
Share on other sites

Question:

7. case "WEST": {_mrks = _eastMrkrs};
8. case "EAST": {_mrks = _westMrkrs};
1. private ["_mrkrs"];
10. {_x setMarkerAlphaLocal 0;}forEach _mrkrs;

Should the "_mrks" in the switch lines actually be "_mrkrs" in this example or are they meant to be two separate variables?

 

Also where do I call this? In like the init.sqf or on each player's init?
 

Share this post


Link to post
Share on other sites

should be the same just a typo. Should all read _mrkrs. Can be called in script from plrs init or in initplayerlocal.sqf

Share this post


Link to post
Share on other sites
Guest

Or

Name your markers life w_westmarker1 e_eastmarker1 ...

and use allMarkers + Kron string librairy to find the starting letter easily

Share this post


Link to post
Share on other sites

Alright, here is what I have used. Again, it hides everything properly, but it won't make the ones I want to see visible again.

private ["_mrkrs"];

_westMrkrs = ["mkr_B_Fireteam","mkr_B_Fireteam_1","mkr_B_Dock","mkr_B_Hangar","mkr_B_Helipads","mkr_B_Helipads_1","mkr_B_Depot","mkr_B_Depot_1","mkr_B_ServiceStation","mkr_B_ServiceStation_1","mkr_B_ServiceStation_2"];
_eastMrkrs = ["mkr_O_Barracks","mkr_O_Barracks_1","mkr_O_Hangar","mkr_O_Arsenal","mkr_O_ServiceStation","mkr_O_ServiceStation_1"];
_indMrkrs = ["mkr_I_Barracks","mkr_I_Arsenal","mkr_I_ServiceStation"];
_civMrkrs = ["mkr_Airport","mkr_Airport_1","mkr_Docks_1","mkr_Docks_2"];

{_x setMarkerAlphaLocal 0;} forEach allMapMarkers;

_sideplr = side player;

switch (_sideplr) do
{
    case "WEST": {_mrkrs = _westMrkrs};
    case "EAST": {_mrkrs = _eastMrkrs};
    case "INDEPENDENT": {_mrkrs = _indMrkrs};
    case "CIVILIAN": {_mrkrs = _civMrkrs};
};

{_x setMarkerAlphaLocal 1;}forEach _mrkrs;

This *should* be hiding all the markers (including the area ones which now in EDEN are visible when in the 2D editor they are not), then displaying the team related ones only to players on the team; but the markers never re-appear.

 

All I changed was adding in the other arrays for the 2 other sides, hiding all the map markers and then making the team side visible to each side instead of only hiding the other team's. It's as if setMarkerAlphaLocal only works one way.

 

Is it just going too fast? Should I put a sleep in there between hiding them and unhiding them again?

Share this post


Link to post
Share on other sites

Well it's not that the command isn't working to make them visible again. It has to do with the timing, I think. If I make the code only work for one team, it works flawlessly; as soon as I put in two or more teams in a switch or if/else statement, it messes up when turning the markers that should be visible back on. Really weird... I mean, how do you put a break into a switch or if/else statement? O.o

 

 

EDIT: I just noticed that I got a scripting error when launching from the editor that was not appearing in the compiled version: When it gets to the last line, it's saying that _mrkrs is an undefined variable, so the switch isn't working.

 

EDIT 2: It was because the team sides should not be quotations for switch cases and the way it's declaring variables is unecessary:

_mrkrs = switch (_sideplr) do
{
    case WEST: {_westMrkrs};
    case EAST: { _eastMrkrs};
    case INDEPENDENT: { _indMrkrs};
    case CIVILIAN: { _civMrkrs};
};

Actually works as intended. :)

 

Now I can release this mission! :D

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  

×