How can I end a game when a team is eliminated?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Dexter13

The Coding Machine
Dec 18, 2001
111
0
0
Visit site
How can I have a counterstrike style scoring system where players spawn once per round and the team wins if the other team are all dead?
 

Shiit

Shiit
Dec 19, 2000
168
0
0
Let's see... I figure this would be pretty complicated to do. Mostly tedious though. I'm guessing you are using a new GameType? Anyway, in the Killed function you'll have to place the killed player in some safe state (PlayerSpectating is good), and you should check for one of the team to be wiped out after every kill. When it is thusly, you can end the match, or give them one teamscore and respawn everyone.
Remember that you can cycle through all pawns (players/bots) by using

local Pawn P;
for( P=Level.PawnList; P!=None; P=P.nextPawn )
{
}

between the brackets you'd have to count everyone on each team, and count everyone that is in the PlayerSpectating state on a team. (remember that the team is stored in P.PlayerReplicationInfo.Team) If the total amount of people in Spectator mode on one team is equal to the team's size, it's game over for them.
 

Dexter13

The Coding Machine
Dec 18, 2001
111
0
0
Visit site
hi!

You're right, I am using a new gametype. but how would I get a killed player to go to a spectating state (sorry)?
 

Shiit

Shiit
Dec 19, 2000
168
0
0
To be more exact: This might be a good way to do it:

function Killed( pawn Killer, pawn Other, name damageType )
{
local int Team0Size, Team1Size, Team0Dead, Team1Dead;
local Pawn P;

Super.Killed (Killer, Other, damageType);
Other.PlayerPawn.GotoState('PlayerSpectating');

for( P=Level.PawnList; P!=None; P=P.nextPawn )
{
if (P.PlayerReplicationInfo.Team==0)
Team0Size++;
if ((P.PlayerReplicationInfo.Team==0)&&(P.Isinstate('PlayerSpectating') ))
Team0Dead++;

if (Team0Dead==Team0Size)
{
Add code to make Team1 (blue) win the match
}
}

Just a quick idea this function. There might be some problems (like, Team0 can't win yet ;)) but this is the general idea.
 

2COOL4-U

New Member
Mar 17, 2001
505
0
0
37
dot NL
2cool.free.fr
It's not that hard, I coded a similar system in a few hours, with spectating and stuff. Take a look at the LastManStanding code to see how to make a player spectate.
 

Dexter13

The Coding Machine
Dec 18, 2001
111
0
0
Visit site
help!

I have done what you said, but it makes no difference, I just respawn as usual, as do the bots. btw: I have put the 'function killed' in my gametype.
Any ideas?
 

butto

Red Orchestra Coder
Making a CS style gameplay mode is cake. gooseman is a ****ty coder, so there's your proof that it isn't hard. You do have to understand the game rules class thoroughly though in order to pull it off and getting into this is a major project that nobody can guide you through step by step. You have to know what you're doing.