Jump to content
Sign in to follow this  
wiggum2

Update marker color on dedicated server for all players & JIP

Recommended Posts

Hi !

I create markers in my init.sqf with:

if (isServer) then {
 _markerRe1 = ["re22", [getPos respawn1 select 0, getPos respawn1 select 1], "Icon", [1, 1], "COLOR:", "Color2_FD_F", "TYPE:", "respawn_inf", "PERSIST"] call CBA_fnc_createMarker;
};

That works, but what if i later would like to change color and let all players and JIP players see the new color ?

Would a trigger with OnAct:

"re22" setMarkerColor "ColorBlack";

be enough or do i need a fancy script ?

Share this post


Link to post
Share on other sites

Thanks, will try it tomorrow.

Share this post


Link to post
Share on other sites

As far as I know, activation field of triggers executing on every machine. So even if you use local command (not in your case), it will work fine.

As for JIP, I'm pretty sure you wouldn't have any problems with marker colors. But it's always better to try such things.

Share this post


Link to post
Share on other sites

Try without the "":

re22 setMarkerColor "ColorBlack";  

Share this post


Link to post
Share on other sites

@ Champ-1

If you create a marker via editor and later change the color via editor trigger then the changed color will not be seen by ANY player on a dedicated server and a JIP player most likely not.

As far as i understand CBA_fnc_createMarker, it will always keep the marker updated with "PERSIST".

@ whiztler

Why ?

Share this post


Link to post
Share on other sites

I don't know anything about dedi servers, and you didn't ask about that.

Share this post


Link to post
Share on other sites

The title makes it clear i think, Update marker color on dedicated server for all players & JIP

So does anyone know what would work on a dedicated server ?

Share this post


Link to post
Share on other sites

Ok, really why is this so complicated ?

I want (on a dedicated server):

  • Place marker in editor and give it a name and set a color lets say green
  • if player is near marker a trigger fires and changes the color of the marker to blue for ALL PLAYERS ON THE SERVER AND JIP PLAYERS

I thought if i create the marker with call CBA_fnc_createMarker; it will be updated but thats not the case...

Can someone help please ?

Share this post


Link to post
Share on other sites

Try this. Its a slightly modified method from eos.

// init.sqf
if (isServer) then
{
call compile preprocessFile "server_fncs.sqf";		
};

if (isServer) then
{
[] spawn {
waitUntil{!(isNil "BIS_fnc_init")};
onplayerConnected {[] spawn {sleep 30; call JIPmkr_updateClient_fnc;};};
};
};

// server_fncs.sqf
JIPmkr_updateServer_fnc = {
private ["_JIPmkr","_coloredMarkers"];

_JIPmkr = ["mkr1","mkr2","mkr3","mkr4","mkr5"];// all markers that could possibly change color durring mission
{
	if (isNil {server getVariable "ZoneMarkers"}) then 
	{
		_coloredMarkers=[];	
		_coloredMarkers set [count _coloredMarkers,_x];
		server setvariable ["ZoneMarkers",_coloredMarkers,true];
	}
	else
	{
		_coloredMarkers=server getvariable "ZoneMarkers";
		if (isnil "_coloredMarkers") then {_coloredMarkers=[];};
		_coloredMarkers set [count _coloredMarkers,_x];
		server setvariable ["ZoneMarkers",_coloredMarkers,true];
	};	
}foreach _JIPmkr;
};
JIPmkr_updateClient_fnc = {
_coloredMarkers=server getvariable "ZoneMarkers";

{_x setMarkerAlpha (MarkerAlpha _x);
_x setMarkercolor (getMarkercolor _x);
}foreach _coloredMarkers;
};

Place a game logic and name it server.

Add this to your trigger activation. Add/remove marker names that will change color when trigger activated as you see fit.

{_x setMarkercolor "ColorRed"} foreach ["mkr2","mkr3","mkr4","mkr5"]; call JIPmkr_updateServer_fnc;

Edited by Jigsor

Share this post


Link to post
Share on other sites

Thanks, will try it.

Works...thanks !

Edited by Wiggum

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  

×