Jump to content

Recommended Posts

Hello again,

 

I'm working on a 1 versus 1 deathmatch mission (There's a closer description in another Forum-Topic). The respawn is working as well as the rest of it.

 

The last thing I want to add is a scoreboard with the remaining tickets but not like the one when you press 'P' (at least in my case). At first I wanted an always shown indicator like in Tom Clancy's - Rainbow Six Siege at the top middle of the screen.

After a while I found this script (Steam-Source). It's not a permanent indicator (which I would prefer) but it shows at least after every respawn a count.

 

This is for the client

 

Spoiler

player addEventHandler ["Killed",
{
	_sideDead = side (_this select 0);
	_sideShooter = side (_this select 1);
	toServer = [_sideDead, _sideShooter];
	publicVariableServer "toServer";
}];

 

 and this is for the server

 

Spoiler

bluforTickets = 50;
opforTickets = 50;

"toServer" addPublicVariableEventHandler 
{
	_deadSide = (toServer select 0);
	_killerSide = (toServer select 1);
	
	if (_deadSide == _killerSide) exitWith {};
	if (_deadSide != _killerSide) then
	{
		if (_deadSide == WEST) then
		{
			bluforTickets = bluforTickets - 1;
		}
		else
		{
			opforTickets = opforTickets - 1;
		};
		format ["BluFor Tickets = %1     OpFor Tickets = %2", bluforTickets, opforTickets] remoteExec ["hint", 0, true];
	};
};

 

 

It could be my mistake but I didn't manage to get this to work and I find the following problem:

 

A dead player is always seen as an civilian. Because of that the script just always runs the "else" path. So the scoreboard shows not the real remaining tickets.

 

As a "fix" of this I found this on steam (Steam-Source) but I didn't manage to do this.

 

Can someone help me fixing the bug for the scoreboard I found?

Or is someone able to script a scoreboard like the one in Rainbow Six?

 

Thank you very much for your help!

Share this post


Link to post
Share on other sites

You just have to refer to the side of the group instead of the killed (even if just a single unit in this group). The side of the group is persistent til the group shifts to null.

So:

player addEventHandler ["Killed", {
  params ["_dead","_shooter"];
  _sideDead = side group _dead;
  _sideShooter = side _shooter;
  toServer = [_sideDead, _sideShooter];
  publicVariableServer "toServer";
}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Ah okey, I see. Thank you very much!

 

It's working quite well. Hopefully you're having a blessed time.

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

×