Jump to content
Sign in to follow this  
bezzzy

TitleText appear only to certain players?

Recommended Posts

I'm working on a multiplayer mission where there are two operations being completed simultaneously on opposite sides of the map (Everyone is on blufor). At the beginning I have the sideRadio Command used to communicate between the groups working on separate missions, this works fine and the message is broadcasted to all players. However, after this I want messages to be broadcasted to only certain players. For example, I want the TitleText command to appear to only players doing mission A, while players doing mission B will get something different said to them using TitleText.

I know I could just use the DirectSay command for this when players are close to each other, but I'd rather the format of TitleText. How can this be achieved?

One more thing, how can one get sideChat to be broadcasted to all players? http://community.bistudio.com/wiki/sideChat

Any help is appreciated, thanks in advance.

Share this post


Link to post
Share on other sites

Use publicVariable to broadcast the message, and add a addPublicVariableEventHandler to the clients that reacts to a change. For much communications, long strings, many players, you might want to broadcast only an index value (less net traffic), and have each client look up what it is supposed to say when index is received.

As for who gets what message, just check players position distance to A or B position. Are you trying to make players "say" something to each other, or is it supposed to be a message coming from HQ? You might want to check out the kbTell system, but it can be a bit on the complex side. Not recommended for those new to scripting.

Share this post


Link to post
Share on other sites

Thanks for the reply. I'll look into adding a publicVariable. As for who gets what message, I'm not really trying to make players say something to each other, it's just random text I want to appear in the middle of the screen which doesn't have to originate from anyone in particular, which is why I chose TitleText. How would I get it to check players position?

And yes I am generally new to scripting, just getting to grips with this stuff. Thanks again.

Edited by bezzzy

Share this post


Link to post
Share on other sites

Hi,

You dont need the position of the players to show a titleText effect.

The following will only run on players machines:

if (!isDedicated) then
{
  titleText ["My text", "PLAIN DOWN", 1];
};

But, lets say you have two groups and want to show a different message to each of them:

if (!isDedicated) then
{
  if (group player == _myGroup1) then
  {
     titleText ["My text for group 1", "PLAIN DOWN", 1];
  }
  else
  {
     titleText ["My text for group 2", "PLAIN DOWN", 1];
  };
};

Using distance to an objective or something:

if (!isDedicated) then
{
  if ((player distance (getMarkerPos "mrk_obj1")) <= 250) then
  {
     titleText ["You are near obj 1", "PLAIN DOWN", 1];
  }
  else
  {
     titleText ["Get you ass to obj 1", "PLAIN DOWN", 1];
  };
};

_neo_

Edited by neokika

Share this post


Link to post
Share on other sites

Hey thanks for the reply neokika. Regarding the second bit of coding you got there, does the text that show for groups depend on what group the player is in?

I have a sniper team and an infantry team who I want to always be shown their own separate unique text regardless of what group the player is in. For example, I always want the sniper team to see the text "Scout the area", while the infantry team see "Take the town", regardless of what team the player wants to play in.

Thanks again for that code, I'll try it tomorrow when I get the chance.

Edited by bezzzy

Share this post


Link to post
Share on other sites
I have a sniper team and an infantry team who I want to always be shown their own separate unique text regardless of what group the player is in. For example, I always want the sniper team to see the text "Scout the area", while the infantry team see "Take the town", regardless of what team the player wants to play in.

Hi,

So to do that you can use one of the above examples:

First you name the groups, this can be easily done on the units init line.

[color="Red"]MY_sniperTeam[/color] = group [color="Blue"]this[/color];

And then, show the text to the units in the group you want.

if (!isDedicated) then   //Does not need to run on dedicated machines since it has no player
{
  if (group player == [color="Red"]MY_sniperTeam[/color]) then   //Is the player in the sniper team?
  {
     titleText ["Scout the area.", "PLAIN DOWN", 1];  //Player is in sniper team
  }
  else
  {
     titleText ["Take the town.", "PLAIN DOWN", 1];  //Player is in infantry team
  };
};

Share this post


Link to post
Share on other sites

Hey thanks for that. I gave it ago, but I think I'm doing something wrong. I put the Code in an SQS script

if (!isDedicated) then   //Does not need to run on dedicated machines since it has no player
{
  if (group player == snipers) then   //Is the player in the sniper team?
  {
     titleText ["Scout the area.", "PLAIN DOWN", 1];  //Player is in sniper team
  }
  else
  {
     titleText ["Take the town.", "PLAIN DOWN", 1];  //Player is in infantry team
  };
};

Called the sniper group snipers, and the infantry group gunners. Then used a trigger to exec the script. But no matter what team I join, I always get the bottom most TitleText, which is "Take the Town". I fiddled around with it a bit, and it seems that both TitleText's are being executed, but since "Take the town" is at the bottom, its the one I see. I must be missing something but I can't work it out.

Share this post


Link to post
Share on other sites

I put the Code in an SQS script

to exec the script

The code is written in SQF, which should be executed with execvm instead of exec.

Share this post


Link to post
Share on other sites

Ahh I see thank you very much, I'm not to good with coding. It seems to work fine, I'll test it in multiplayer soon.

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  

×