How to find out the average perk level of all players in the game
function bool TeamIsStrong()
{
local Controller C;
local int levelSum;
local int N;
for( C = Level.ControllerList; C != None; C = C.nextController )
{
if( C.IsA('PlayerController') && C.Pawn!=None && C.PlayerReplicationInfo.PlayerID>0 && C.Pawn.Health>0)
{
levelSum+=KFPlayerReplicationInfo(C.PlayerReplicationInfo).ClientVeteranSkillLevel;
N++;
}
}
if(levelSum/N>=11) return true;
return false;
}
If on the client, then it’s much better to use
var() array<PlayerReplicationInfo> PRIArray;
from GameReplicationInfo
If this is some kind of GUI element, then you can do this
local GameReplicationInfo GRI;
local PlayerReplicationInfo PRI;
GRI = PlayerController(PlayerOwner()).GameReplicationInfo;
for ( i = 0; i < GRI.PRIArray.Length; i++)
{
PRI = GRI.PRIArray[i];
...
}
If this is SRScoreBoard, then there is already a GRI there (obtained from the great-great-grandparent of ScoreBoard from Engine) If not GUI, then the local controller can be obtained from here: Level.GetLocalPlayerController()