• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code ServerPerks question

DewRitozz

FNG / Fresh Meat
Feb 21, 2023
1
0
Is there anyway I could implement individual player's armor digits to show up in score board next to HP? I have everything set up in SRScoreboard for armor, but its the player replication info that gives me headache. So, I'm trying to write-in PlayerArmor variable in SRPlayerReplicationInfo, by using code from KFPlayerReplicationInfo, where it used PlayerHealth. But The code there put me in a deadend, because as it says there, KFScoreboard uses ShieldStrength to display as health in original scoreboard apparently??? Is there any dark sorcery to make player armor to appear on scoreboard just like HP? Here is PlayerHealth bit from KFPlayerReplicationInfo code:
C++:
function Timer()
{
    local Controller C;

    SetTimer(0.5 + FRand(), False);
    UpdatePlayerLocation();
    C = Controller(Owner);
    if( C==None )
        Return;
    if( C.Pawn==None )
        PlayerHealth = 0;
    else PlayerHealth = C.Pawn.ShieldStrength;

    if( !bBot )
    {
        if ( !bReceivedPing )
            Ping = Min(int(0.25 * float(C.ConsoleCommand("GETPING"))),255);
    }
}

So far, I have no idea what to do in SRPlayerReplicationInfo, but what I tried is:
C++:
simulated function Timer()
{
    local Controller C;
       C = Controller(Owner);
       if(Role == ROLE_Authority)
    {
        
        if(C.Pawn == none) 
        {
            PlayerArmor = 0;           
        }
        else
        {
            PlayerArmor = C.Pawn.ShieldStrength ; 
        }
    }
      super.Timer(); 
}

Ofcourse, this doesnt work, and it just prints out 0, always, even if I or someone else has armor. See, in KFPlayerReplication info it uses ShieldStrength to somehow show up as Health in scoreboard which is blowing me away. Whats the variable for ARMOR then??