Jump to content
Sign in to follow this  
Vegatry

Randomly spawn marker in certain area with only visible/local to specific side?[JIP?]

Recommended Posts

I just comes up an idea where a mp mission involve in 3 sides, which Opfor and independent wants to meet in a randomly generated marker in a specific area, while Blufor have no idea where they meets and have to search for them.

So how do I make the marker only visible to East and IND?

I also wants this marker visible to any player JIP.

I make a little head start, then I went clueless on what should I do next...

If (!IsDedicated) Then {

MkrJIP = {

private ["_mkr1", "_mkr2", "_mkr3"]; //three position I want to randomized it

  };
};

Another problem I encounter was when testing with my resent MP mission, most player have access to a unit which it should be, but some of them went into spectator mode even they tried to rejoin.

Share this post


Link to post
Share on other sites

:butbut: stupid question but... why are you using the private command? :confused:

You can use BIS_FNC_SelectRandom to select stuff (markers, objects, integers etc etc) randomly. Regarding rendering the marker for certain sides...

maybe something like this:

If (!IsDedicated) Then {
  waitUntil {!isNull player && {time > 1}}; // JIP
  if (side player == opfor || {side player == independent}) then {
       "my_marker1" setMarkerAlphaLocal 1; 
  } else {
       "my_marker1" setMarkerAlphaLocal 0; 
  };
};  

OR

private "_mrk";
If (!IsDedicated) Then {
  waitUntil {!isNull player && {time > 1}}; //JIP
  if (side player == opfor || {side player == independent}) then {
      _mrk = createMarkerLocal ["mrkName", getPosATL somePos];
      _mrk setMarkerShapeLocal "ICON";
      _mrk setMarkerTypeLocal "mil_objective";
      _mrk setMarkerSizeLocal [0.5,0.5];
      _mrk setMarkerColorLocal "ColorBlue";
  };
};  

/*
Private is used in the above because _mrk is defined in an entirely different scope and if we needed to work with _mrk outside of the scope it was defined in we would need to use the private command.
*/

Should be JIP compatible.

Edited by Iceman77

Share this post


Link to post
Share on other sites
:butbut: stupid question but... why are you using the private command? :confused:

You can use BIS_FNC_SelectRandom to select stuff (markers, objects, integers etc etc) randomly. Regarding rendering the marker for certain sides...

maybe something like this:

If (!IsDedicated) Then {
  waitUntil {!isNull player && {time > 1}}; // JIP
  if (side player == opfor || {side player == independent}) then {
       "my_marker1" setMarkerAlphaLocal 1; 
  } else {
       "my_marker1" setMarkerAlphaLocal 0; 
  };
};  

OR

private "_mrk";
If (!IsDedicated) Then {
  waitUntil {!isNull player && {time > 1}}; //JIP
  if (side player == opfor || {side player == independent}) then {
      _mrk = createMarkerLocal ["mrkName", getPosATL somePos];
      _mrk setMarkerShapeLocal "ICON";
      _mrk setMarkerTypeLocal "mil_objective";
      _mrk setMarkerSizeLocal [0.5,0.5];
      _mrk setMarkerColorLocal "ColorBlue";
  };
};  



/*
Private is used in the above because _mrk is defined in an entirely different scope and if we needed to work with _mrk outside of the scope it was defined in we would need to use the private command.
*/

Should be JIP compatible.

:D Thanks for your help but I still didn't get the script working...

I successfully generate a single marker with method2, but failed to implied BIS_fnc_selectRandom into the script.

I tried several attempts but all ends in fail.

private "_mkr";

_c = [_pos1,_pos2,_pos3] call BIS_fnc_selectRandom;

if (side player == opfor) then {
      _c = createMarkerLocal ["mrkName", getPosATL ];
      _c setMarkerShapeLocal "ICON";
      _c setMarkerTypeLocal "mil_dot";
      _c setMarkerSizeLocal [5,5];
      _c setMarkerColorLocal "ColorBlue";

  };
}; 

Then tried method 1.

_met =  [_pos1,_pos2,_pos3] call BIS_fnc_selectRandom;

If (!IsDedicated) Then {
  waitUntil {!isNull player && {time > 1}}; // JIP
  if (side player == opfor || {side player == independent}) then {
       "_met" setMarkerAlphaLocal 1; 
  } else {
       "_met" setMarkerAlphaLocal 0; 
  };
};  

:j: Sorry for my shitty scripting, perhaps a sample mission could help me figure it out.

Edited by Vegatry

Share this post


Link to post
Share on other sites

Unless you would like to put it in another script and call that script. The init.sqf script is called automatically and so putting it in there will work. If you put it in another file you will need to execute that file from somewhere, like init.sqf.

Share this post


Link to post
Share on other sites

Example Mission containing both methods at the same time.

Note: I like working with editor placed markers. They seem more friendly in MP for JIP, easier and faster to deal with too.. imo. Though, they may have fixed any jip issues with created markers.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Example Mission containing both methods at the same time.

Note: I like working with editor placed markers. They seem more friendly in MP for JIP, easier and faster to deal with too.. imo. Though, they may have fixed any jip issues with created markers.

;) Works perfectly, thanks!

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  

×