Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
GRS

Local markers for three sides. (Multiplayer, PvP)

Recommended Posts

Guys, I need help. I am going mad with this one, because I know it's something *I* am doing wrong. Probably something stupid too. I'm putting the finishing touches on a multiplayer PvPvP mission, and I want to add markers that only Bluefor can see, others that only Opfor can see, and others that only Independent can see. Let's just say, for example, that I want only Independent to see the marker named "buy1".

I've searched and searched and found plenty of threads on various boards about this, the frustrating thing is that not a single example I have found has worked/I'm doing something wrong. I've tried creating local markers, deleting local markers, setting the alpha on local markers, and making them "empty" but every time it either does nothing or does the same thing for all sides.

I'm sure that the problem exists between the keyboard and chair, but I just cannot figure out where I went wrong with four different examples. Unfortunately I scrapped all of my examples in rage, but I used examples like:

if (playerSide == GUER) then 
_markerstr = createMarkerLocal["markername",[_Xpos,_Ypos]];
_markerstr setMarkerShapeLocal "ICON";
"markername" setMarkerTypeLocal "DOT";
"markername" setMarkerColorLocal "ColorRed";

That is the basic Idea I'd like to use. The independent unit that is player controlled is named "dealer", I want the marker to be named "buy1", and I want it to create at "buy1a"'s position.

I've tried many things like:

if (dealer Side == GUER) then 
_markerstr = createMarkerLocal["buy1",position buy1a];
_markerstr setMarkerShapeLocal "ICON";
"buy1" setMarkerTypeLocal "DOT";
"buy1" setMarkerColorLocal "ColorRed";

As well of a few others I have since deleted. I just cannot get it to work for some reason and was hoping someone could school me on what I'm doing wrong. If you need any other info, just ask.

Thanks in advance!

Share this post


Link to post
Share on other sites

Not got much time to look but can suggest the following:

That 1st line should be (however you define the caller is up to you):

[player] execVM "buy.sqf";

_unit = _this select 0;

if (side _unit == west) then { ..code here.. };

if (side _unit == east) then { ..code here.. };

if (side _unit == guer) then { ..code here.. };

You should also probably create different marker names each time the script is run to avoid running code on markers already created with same name, define var_buy somewhere - you may need 3 differnet variables - 1 for each side to keep track of things? eg var_buy_guer etc:

var_buy_guer = 0;
publicVariable "var_buy_guer";

if (isdedicated) exitWith {};
if (side _unit == guer) then {
var_buy_guer = var_buy_guer +1;
publicVariable "var_buy_guer";
_pos = [getPosATL _unit select 0, getPosATL _unit select 1];
_mkr = createMarkerLocal [format["mkr%1", var_buy_guer], _pos]; // creates different marker names depending on value of var_buy at current position of _unit.
_mkr setMarkerShapeLocal "ICON";
_mkr setMarkerTypeLocal "DOT";
_mkr setMarkerTextLocal format["buy%1",var_buy_guer];
};

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

I tried something like this. The way I did it was to set all the markers alpha to 0 so they are invisible. And then run the code for each player to check side and set marker alpha to 1 for them.

Share this post


Link to post
Share on other sites

Name of the marker should not matter when it's local.

You can either create the markers

if (!isDedicated) then 
{
waitUntil {!isNull player};
switch (side player) do 
{
	case WEST: 
	{
		_m = createMarkerLocal ["buy1",position buy1a];
		_m setMarkerShapeLocal "ICON";
		_m setMarkerTypeLocal "DOT";
		_m setMarkerColorLocal "ColorRed";
	};
	case GUER: 
	{
		_m = createMarkerLocal ["buy2",position buy2a];
		_m setMarkerShapeLocal "ICON";
		_m setMarkerTypeLocal "DOT";
		_m setMarkerColorLocal "ColorGreen";
	};
};
};

or place them in the editor and then do something like this

if (!isDedicated) then 
{
{_x setMarkerAlphaLocal 0} forEach ["buy1","buy2","buy3","buy4",",buy5","buy6"];
waitUntil {!isNull player};
switch (side player) do 
{
	case WEST: 
	{
		{_x setMarkerAlphaLocal 1} forEach ["buy1","buy2"];
	};
	case EAST: 
	{
		{_x setMarkerAlphaLocal 1} forEach ["buy3","buy4"];
	};
	case GUER: 
	{
		{_x setMarkerAlphaLocal 1} forEach ["buy5","buy6"];
	};
};
};

in init.sqf

Share this post


Link to post
Share on other sites
Sign in to follow this  

×