Jump to content
gc8

MARTA Reveal question

Recommended Posts

Hi

I'm using the MARTA in my mission but a question rise regarding the multiplayer.

 

This line:

 

player setvariable ["MARTA_reveal",_enemyGroups];

 

Does not appear to be too multiplayer friendly as player does not even exist on server. So my question is how to properly reveal the units so that ALL players see the markers? I assume I just have to do MARTA_reveal on all clients?

 

But that leads to another question, what determines what BIS_Marta_getVisibleGroups returns? Is that different for each client too?

 

I hope some one can shed some light on this :)

 

thx!

 

Share this post


Link to post
Share on other sites

sure, on all clients.

Did you place the module in editor?

is _enemyGroups defined on each PC?

You can have different displays for players if they don't belong to the same side but you need to define what you want to reveal, in some defined variable for each client.

Share this post


Link to post
Share on other sites
4 minutes ago, pierremgi said:

sure, on all clients.

Did you place the module in editor?

is _enemyGroups defined on each PC?

You can have different displays for players if they don't belong to the same side but you need to define what you want to reveal, in some defined variable for each client.

 

I created the module via script. i would actually want the server to know if the groups are visible so I can run some commander AI code on the server. I'd assume there's no problem using "MARTA_reveal" on server but have no clue what to pass as argument instead of the player?

Share this post


Link to post
Share on other sites

You should post what you scripted and where. The Military symbol module (Martha) works fine for all players. You can't script that on server only.

Use the module and run your line when you need it, for players you want:

For example, in initPlayerLocal.sqf

 

setGroupIconsVisible[true,false]; // mandatory command
player setVariable [ "MARTA_REVEAL", allGroups select {side _x == playerSide}];

 

or even:

player setVariable [ "MARTA_REVEAL", allGroups select {side _x != playerSide}];

player setVariable [ "MARTA_HIDE", allGroups select {side _x == playerSide}];

 

Share this post


Link to post
Share on other sites

@pierremgi Thanks, I'm mainly concerned getting this work on server... clients should be easier.

 

Here's my code so far, it's just a simple test:

 

 "MartaManager" createUnit [[0,0,0], createGroup civilian];
 
 setGroupIconsVisible [true,true];
 
 
 sleep 1;
 
 #define DETECT_GROUP_RANGE 300
 _group = group player;
 
 while { true } do
 {
  scopename "revealGroups";
  
 _ldr = leader _group;
 _side = side _group;
 
 _knownGroups = [getpos _ldr, DETECT_GROUP_RANGE] call BIS_Marta_getVisibleGroups;
 
  _enemyGroups = allgroups select { _side != (side _x) && (side _x) != civilian && ((leader _x) distance2D (getpos _ldr)) < DETECT_GROUP_RANGE && !(_x in _knownGroups) };
 
  if(count _enemyGroups > 0) then
  {
   systemchat format["Revealing groups! %1", _enemyGroups];
   
   player setvariable ["MARTA_reveal",_enemyGroups];
   breakout "revealGroups";
  };
  
   sleep 3;
 };

 

 

 

Share this post


Link to post
Share on other sites

No!

- place the Marta module via editor.

 in initPlayerLocal.sqf:
 

setGroupIconsVisible[true,true];
[] spawn {
  while {true} do { // for "relative conditions", here distance
    sleep 2;
    player setVariable [ "MARTA_REVEAL", allGroups select {side _x != playerSide && leader _x distance2D player < 300}]
  }
};
player setVariable [ "MARTA_HIDE", allGroups select {side _x == playerSide && side _x != civilian}]; // just example for "absolute conditions", no need to be in loop

 

Nothing more.

Share this post


Link to post
Share on other sites

 

13 minutes ago, pierremgi said:

[] spawn { while {true} do { // for "relative conditions", here distance sleep 2; player setVariable [ "MARTA_REVEAL", allGroups select {side _x != playerSide && leader _x distance2D player < 300}] } };

 

There's actually a problem with this code because when you pass already visible groups to "MARTA_REVEAL" variable over again and again it makes the icons flicker on the map

That's why I'm also using BIS_Marta_getVisibleGroups

Or was that my code?

 

What's wrong with placing marta via script?

 

Edited by gc8
addition

Share this post


Link to post
Share on other sites

Also if anyone knows why BIS_marta_mainscope setvariable ["duration",5]; is not working please let me know. I tried it with and without the  "MARTA_REVEAL" code but no matter how far I get from the enemy group it does not disappear. 

Share this post


Link to post
Share on other sites

module in editor,

initPlayerLocal.sqf


 

setGroupIconsVisible[true,true];
//  BIS_marta_mainscope setvariable ["duration",30];  // overridden by the distance condition.
[] spawn {
   while {true} do {
     sleep 2;
    player setVariable [ "MARTA_REVEAL", allGroups select {side _x != playerSide && leader _x distance2D player < 300}];
    player setVariable [ "MARTA_HIDE", allGroups select {side _x == playerSide or side _x == civilian or (leader _x distance2D player >= 300)}];
  }
};

 

Tested with 2 players. No flickering. Out.

Share this post


Link to post
Share on other sites

But shouldn't there be automatic hide too?

the "duration"

?

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

×