Jump to content
Sign in to follow this  
1para{god-father}

Marker to show Only for EAST - not working

Recommended Posts

must be one of those days !

I need to place a marker but only for EAST side to see but cannot seems to get it to work


///spawn box etc......
TAG_ammobox = createVehicle ["Box_NATO_Ammo_F",getmarkerpos "marker_clear", [], 0, "NONE"];


////then place marker on Box for east side ONLY /////
if ((side player) == EAST) then {

_eastmaekerpos = createMarkerLocal ["east_ammomarker", getpos TAG_ammobox];
_eastmaekerpos setMarkerColorLocal "ColorBlack";
_eastmaekerpos setmarkershapelocal "icon";
_eastmaekerpos setMarkerTypeLocal "mil_dot";
_eastmaekerpos setmarkertextlocal "Ammo Box Location";

};

Share this post


Link to post
Share on other sites

probably need to post a bit more of the script to show what's run on the server and what is run on the client, because this looks like everything is running on the same machine.

Share this post


Link to post
Share on other sites

I just pasted that into a trigger and it works. Whats the problem is it not working in MP? If its just not working in the editor I'm guessing its the way your calling it that's the problem.

If its not working in MP try this in a trigger:

TAG_ammobox = createVehicle ["Box_NATO_Ammo_F",getmarkerpos "marker_clear", [], 0, "NONE"];
_eastmaekerpos = [];
if ((side player) == EAST) then {

_eastmaekerpos = createMarkerLocal ["east_ammomarker", getpos TAG_ammobox];
_eastmaekerpos setMarkerColorLocal "ColorBlack";
_eastmaekerpos setmarkershapelocal "icon";
_eastmaekerpos setMarkerTypeLocal "mil_dot";
_eastmaekerpos setmarkertextlocal "Ammo Box Location";

} else {};

Bad news useing a trigger with this is your gonna have a ammo box for every player connected :P

Edited by Big_Wilk

Share this post


Link to post
Share on other sites

Sorry i should have said it will not work on Dedi:-

///run this bit on server only//////
if (isserver) then {
sleep 5;
	_location = AO_locations call BIS_fnc_selectRandom;
	_pos = getmarkerpos _location;
	AO_locations = AO_locations - [_location];
	["clear","Locate and Destroy","Locate and Destoy the Ammo Crate that is somehwere in the town it should be within 150 meter of the marker",true,["MissionAO",_pos,"mil_objective","ColorYellow"]] call SHK_Taskmaster_add;
	////////PATROL MARKER/////////////
	_mrk1= createmarker ["marker_clear",_pos];
	_mrk1 setmarkershape "ELLIPSE";
	_mrk1 setmarkersize [180,180];
	_mrk1 setMarkerColor "ColorRed";
	"marker_clear" setMarkerAlpha 0;
	sleep .2;
	TAG_ammobox = createVehicle ["Box_NATO_Ammo_F",getmarkerpos "marker_clear", [], 0, "NONE"];  		
	TAG_ammobox lock true;
	//TAG_ammobox addEventHandler ["HandleDamage", {      if ((_this select 4) == "SatchelCharge_Remote_Ammo") then [{_this select 2},{0}];  }]; 
	[TAG_ammobox,150,2] execvm "buildingpos.sqf";
	MainAO setPos (getpos TAG_ammobox); 
	sleep 2;
	/////DEBUG/////////
	if ((paramsarray select 0) == 1) then { 
	 	_cid = floor(random 10000);
		_t = format["ammo is here%1",_cid];
		[_t, TAG_ammobox, "Icon", [1,1], "TEXT:", _t, "TYPE:", "mil_dot", "COLOR:", "ColorGreen", "GLOBAL", "PERSIST"] call CBA_fnc_createMarker;

	};
};

//////run on client////////////

if ((side player) == EAST) then {

_eastmaekerpos = createMarkerLocal ["ammo_locationmarker", getpos TAG_ammobox];
_eastmaekerpos setMarkerColorLocal "ColorBlack";
_eastmaekerpos setmarkershapelocal "icon";
_eastmaekerpos setMarkerTypeLocal "mil_dot";
_eastmaekerpos setmarkertextlocal "Ammo Box Location";

};

Share this post


Link to post
Share on other sites

First make sure the player variable can be used. This is how I would do it.

if (!isDedicated) then {
  waitUntil {!isNull player && {time > 1}}; //use a time check aswell, as JIP players will auto default to side west until they have control over the unit.

     if ((side player) == EAST) then {

         _eastmaekerpos = createMarkerLocal ["ammo_locationmarker", getpos TAG_ammobox];
         _eastmaekerpos setMarkerColorLocal "ColorBlack";
         _eastmaekerpos setmarkershapelocal "icon";
         _eastmaekerpos setMarkerTypeLocal "mil_dot";
         _eastmaekerpos setmarkertextlocal "Ammo Box Location";

     };
};

Edited by Iceman77

Share this post


Link to post
Share on other sites

Works fine on MP but as soon as I test on Dedi it will not show?

Just trying to get a marker over the ammo crate that only East can see

Share this post


Link to post
Share on other sites

Yeah I realize the problem you are having. :) What I posted was an untested solution. Sorry it didn't work. Though I don't know why it wouldn't.

Share this post


Link to post
Share on other sites

the player likely doesn't know where or what TAG_ammobox is, as it was created remotely on the dedi.

You can either publicVariable the vehicleVarName, create the client marker on the global "marker_clear" marker or publicVariable another variable, that just contains the position, so the client can create his marker on it.

You can give this a try maybe, this "should" create the marker on the "marker_clear" position (but didnt test it)

///run this bit on server only//////
if (isserver) then {
sleep 5;
	_location = AO_locations call BIS_fnc_selectRandom;
	_pos = getmarkerpos _location;
	AO_locations = AO_locations - [_location];
	["clear","Locate and Destroy","Locate and Destoy the Ammo Crate that is somehwere in the town it should be within 150 meter of the marker",true,["MissionAO",_pos,"mil_objective","ColorYellow"]] call SHK_Taskmaster_add;
	////////PATROL MARKER/////////////
	_mrk1= createmarker ["marker_clear",_pos];
	_mrk1 setmarkershape "ELLIPSE";
	_mrk1 setmarkersize [180,180];
	_mrk1 setMarkerColor "ColorRed";
	"marker_clear" setMarkerAlpha 0;
	sleep .2;
	TAG_ammobox = createVehicle ["Box_NATO_Ammo_F",getmarkerpos "marker_clear", [], 0, "NONE"];  		
	TAG_ammobox lock true;
	//TAG_ammobox addEventHandler ["HandleDamage", {      if ((_this select 4) == "SatchelCharge_Remote_Ammo") then [{_this select 2},{0}];  }]; 
	[TAG_ammobox,150,2] execvm "buildingpos.sqf";
	MainAO setPos (getpos TAG_ammobox); 
	sleep 2;
	/////DEBUG/////////
	if ((paramsarray select 0) == 1) then { 
	 	_cid = floor(random 10000);
		_t = format["ammo is here%1",_cid];
		[_t, TAG_ammobox, "Icon", [1,1], "TEXT:", _t, "TYPE:", "mil_dot", "COLOR:", "ColorGreen", "GLOBAL", "PERSIST"] call CBA_fnc_createMarker;

	};
};

//////run on client////////////

waitUntil{!isNull player};
if (playerSide == EAST) then {
waitUntil{markerColor "marker_clear" != ""};
_eastmaekerpos = createMarkerLocal ["ammo_locationmarker", markerPos "marker_clear"];
_eastmaekerpos setMarkerColorLocal "ColorBlack";
_eastmaekerpos setmarkershapelocal "icon";
_eastmaekerpos setMarkerTypeLocal "mil_dot";
_eastmaekerpos setmarkertextlocal "Ammo Box Location";

};

Share this post


Link to post
Share on other sites

Ahh yes. Client doesn't realize the variable. Didn't even read the top of the script :p

Share this post


Link to post
Share on other sites

Meh nvm. Did you try what conroy suggested?

Edited by Iceman77

Share this post


Link to post
Share on other sites
LOL any work around ?

Yes mate, public variables it would seem. Here is a working example that I've tested on a dedicated server (some of the top lines arn't needed I just forgot to delte them).

https://www.dropbox.com/s/jjr57kwyjbyj1ln/Intel%40JipMarker5.Stratis.rar

That took me alot of messing around for something so simple, but as Iceman77 / Conroy said the problem was the clients did not know about the location of the box.

Edited by Big_Wilk

Share this post


Link to post
Share on other sites
LOL any work around ?

All you need is a PV so that clients know TAG_ammoBox exists. Then you can simply create the marker onto the ammo box. JIP players will receive the values / state of TAG_ammoBox aswell (of the last time it was PV).

Example:

if (isServer) then {
   TAG_ammobox = createVehicle ["Box_NATO_Ammo_F",getMarkerPos "marker_clear", [], 0, "CAN_COLLIDE"]; 
   TAG_ammobox lock true;
   [color=#ff0000]publicVariable "TAG_ammoBox";[/color]
};

waitUntil {!isNull player && {time > 1}};

   if ((side player) == EAST) then {
       _eastmaekerpos = createMarkerLocal ["east_ammoMarker", getPosATL TAG_ammobox];
       _eastmaekerpos setMarkerColorLocal "ColorBlack";
       _eastmaekerpos setmarkershapelocal "icon";
       _eastmaekerpos setMarkerTypeLocal "mil_dot";
       _eastmaekerpos setmarkertextlocal "Ammo Box Location";
   };

Edited by Iceman77
Changed variable names in the example to match OP's variable names, as I was using my own names for testing.

Share this post


Link to post
Share on other sites

Haha nice I actually tried the exact same thing as that Iceman and it didn't work. . . for some reason though I can see why.

I got it working after my 5th attempt, I made the script in my example demo I linked above, it looks like this:

TAG_ammobox =[];
eastmaekerpos = [];
publicVariable "TAG_ammobox";
publicVariable "eastmaekerpos";

if (isServer) then {
TAG_ammobox = createVehicle ["Box_NATO_Ammo_F",getmarkerpos "marker_clear", [], 0, "NONE"];
Hopefullythiswillleteveryoneknow = getpos TAG_ammobox;
publicVariable "Hopefullythiswillleteveryoneknow";
};

if (side player == EAST) then {
hint "ok";
eastmaekerpos = createMarker ["east_ammomarker", Hopefullythiswillleteveryoneknow];
eastmaekerpos setMarkerColor "ColorBlack";
eastmaekerpos setmarkershape "icon";
eastmaekerpos setMarkerType"mil_dot";
eastmaekerpos setmarkertext "Ammo Box Location";
};

One thing I diden't add was:

waitUntil {!isNull player && {time > 1}};

Is that for makeing it really safe for JIP? or.. - Never mind I re read the last page, question answered.

(off topic This: http://forums.bistudio.com/showthread.php?144954-Dialog-Tutorial-For-Noobs-By-A-Noob was the most helpful arma things I've read thanks for makeing it )

Edited by Big_Wilk

Share this post


Link to post
Share on other sites

What I posted is tested and works. Not sure why it wouldn't work for you. Copy and paste the code into init.sqf and test it. Just don't forget to place the "east_ammoMarker". You don't need the empty arrays, or to define the position or extra PVs. :)

Edited by Iceman77

Share this post


Link to post
Share on other sites

Yeah that top mess is legacy from previous ideas.

waitUntil {!isNull player && {time > 1}};

That last post was me wonder why you did that then realizing then reason why had been stated in your previous posted.

Cool stuff.

Share this post


Link to post
Share on other sites
Yeah that top mess is legacy from previous ideas.

waitUntil {!isNull player && {time > 1}};

That last post was me wonder why you did that then realizing then reason why had been stated in your previous posted.

Cool stuff.

Yeah, after alot of time struggling to figure out why a side check I was doing was failing fir JIP players, I ran into a post which claimed JIP players default to side west initially. I added the time check and it solved the issue.

note: It's a good idea to always check if player variable is valid before using it

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  

×