The CheckMaxLives Function playing twice?

  • 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.

EggXzaB

BinaryZero Error maker .. o_O
Jul 15, 2003
69
0
0
Can anyone tell me why the STANDARD function checkmaxlives() in ut2k3 plays twice? This has to check if you have any lives left, and if everbody died or not ...
Put a Log in it, and play with it, you'll see it shows twice ...
And it SHOULD be in the function, cause it's called only once

Code:
function bool CheckMaxLives(PlayerReplicationInfo Scorer)
{
    local Controller C;
    local PlayerReplicationInfo Living;
    local bool bNoneLeft;

    if ( MaxLives > 0 )
    {
		if ( (Scorer != None) && !Scorer.bOutOfLives )
			Living = Scorer;
        bNoneLeft = true;
        for ( C=Level.ControllerList; C!=None; C=C.NextController )
            if ( (C.PlayerReplicationInfo != None) && C.bIsPlayer
                && !C.PlayerReplicationInfo.bOutOfLives )
            {
				if ( Living == None )
					Living = C.PlayerReplicationInfo;
				else if ( (C.PlayerReplicationInfo != Living) &&
 (C.PlayerReplicationInfo.Team != Living.Team) )
			   	{
    	        	bNoneLeft = false;
	            	break;
				}
            }
        if ( bNoneLeft )
        {
			if ( Living != None )
				EndGame(Living,"LastMan");
			else
				EndGame(Scorer,"LastMan");
			return true;
		}
    }
    return false;
}

I'm using the

Code:
if ( Living != None )
EndGame(Living,"LastMan");
else
EndGame(Scorer,"LastMan");

part currently as :

Code:
if ( Living != None )
{
Living.Team.Score += 1;
Endround();
}
else
{
log("Else");
Endround();
}
But here it gives my team 2 points when everyone died :(

My thoughts are with the "For" loop..

Help plz?
thx :)
 
Last edited:

BlackHornet

Global Warzone Project Leader
Apr 24, 2002
76
0
0
43
Aachen - Germany
www.hornet-maps.de
maybe it is replicated and called on the server and on the client......or check the the gametype class where the CheckMaxLives function is called....would be the better way first.

Maybe it is called on every kill and at roundend
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
As a GameInfo function it's hardly replicated anywhere.

Like the name suggests it's a function that checks something for a certain player. There is no way to figure out, how often it's executed. Try finding a different function for your code that is really executed only once for a certain event.
 

EggXzaB

BinaryZero Error maker .. o_O
Jul 15, 2003
69
0
0
Yeah, but I can't find a function that checks if someone is really dead, only the died() in the xPawn, but thats not useable in what I do ..
I'm trying to make a round system like in TO/CS, so when your dead, you spectate, and when everybody in a team is dead, a new round starts and the winning team gets a point...
 
Last edited:

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
EggXzaB said:
Yeah, but I can't find a function that checks if someone is really dead, only the died() in the xPawn, but thats not useable in what I do ..
I'm trying to make a round system like in TO/CS, so when your dead, you spectate, and when everybody in a team is dead, a new round starts and the winning team gets a point...
I don't know what you did wrong but I've done something siimilar and it's working okay.
I use checkmaxLives and it doesn't seem to be called twice for me.
 

EggXzaB

BinaryZero Error maker .. o_O
Jul 15, 2003
69
0
0
hmm, put a log in one of the lines, the showlog, you'll see..
Or I did something stupid :p
 

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
maybe you put a bracket at the wrong place.If you are testing the gametype with two players ineach team then it's very likely that it's a bracket in a wrong spot.
post the whole function so tha we can better see.
Also make sure the endround() function doesn't call checkmaxlives again.
FYI chekmaxlives is supposed to be called every seconds or so during match.
 

Doc_EDo

LEFT
Jan 10, 2002
755
0
0
There already is a round system in ....INVASION!! :eek:
For the team round based you need to write your own function and just delete checkmaxlives. Flankly it's confusing and sucks.
 
Last edited: