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

Faction specific map markers?

Recommended Posts

I've read up on its wiki on using the createMarkerLocal script to create map markers that only a certain faction can see. But I don't understand its implementation or anything else about it. I've only started using scripts.

reptilian-aliens-galaxy-quest-sarris-3.jpg Explain as you would to a child...

Share this post


Link to post
Share on other sites

Ok, first of all take a look at these two pages:

https://community.bistudio.com/wiki/createMarker

https://community.bistudio.com/wiki/createMarkerLocal

Notice the icons at the top?

effects_global.gif

effects_local.gif

Those tell you if a command is automatically propagated over the net and effects all clients, or.... not.

When you have a global command, you have to make sure that the part of script that you use it in only runs on one client (or the server). Otherwise, the command will be executed multiple times (once for each client), that can be especially bad with commands like "createVehicle".

On the other hand, some commands have only local effect but you would like all players to see them. Then you'll have to make sure that command is transmitted (with its parameters) and executed on every client.

BIS_fnc_MP is very useful for that.

-> The best way to do so is by using pre-defined functions.

Now in your case, the latter can also be used to send the command only to a select few.

There are two ways for that:

1. Send the script to everyone but include a condition in the script.

This is useful when the effect of the script depends on several factors that have to be checked locally on each client to determine what should happen.

2. Pre-select which clients the script should run on and use BIS_fnc_MP to send the script individually to each of them.

The advantage is that the call isn't needlessly transmitted to the clients who don't need to run it.

In your specific case, I would create a special function that includes all possible parameters for a marker and also checks the side.

That way you can use this function for everything.

fnc_createMarkerSide = {
private ["_name","_position","_side","_par","_options","_option","_forEachIndex","_x"];

_name = _this select 0;
_position = _this select 1;
_side = _this select 2;
_par = _this select 3;

if (side player != _side) exitWith {};

createMarkerLocal [_name, _position];
_options = ["setMarkerBrushLocal","setMarkerColorLocal","setMarkerDirLocal","setMarkerShapeLocal","setMarkerSizeLocal","setMarkerTextLocal","setMarkerTypeLocal","setMarkerAlphaLocal"];

if (typeName _par != "ARRAY") exitWith {};
{
	_option = _options select _forEachIndex;
	if ( format['%1',_x] != "" ) then {
		[] call compile format['%1 %2 %3', _name, _option, _x];
	};
} forEach _par;
};

Now you could use it like this:

[  ["myMarker", somePosition, west, ["Solid","ColorBlue",90,"ICON",[10,10],"","mil_dot",1]  ],"fnc_killFire",true,true] call BIS_fnc_MP;

Share this post


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

×