Try this.
Code:
function bool MonstersDead()
{
local Monster M;
local bool bAllDead;
bAllDead=true;
ForEach AllActors(class'Monster', M)
{
if (M != None)
{
bAllDead=false;
break;
}
}
return bAllDead;
}
function ScoreKill(Controller Killer, Controller Other)
{
local Controller C;
local PlayerReplicationInfo Winner;
Super.ScoreKill(Killer,Other);
if (MonstersDead())
{
for ( C=Level.ControllerList; C!=None; C=C.NextController )
if ( (C.PlayerReplicationInfo != None) && C.bIsPlayer)
{
if ((Winner !=None) && (Winner !=C.PlayerReplicationInfo)
&& (C.PlayerReplicationInfo.Score > Winner.Score) )
Winner=C.PlayerReplicationInfo;
}
EndGame(Winner,"triggered");
}
}
You may get an overtime bug when two players have same score but that needs more work in the checkendgame function.
Bookmarks