• 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 Need a fix for a Roll The Dice roll

A bit of an issue here, hopefully someone has an easy fix/suggestion. The following is the code to win an armor vest in the first instance and win a vest for all players in the second instance in the rtd(Roll The Dice) app. The problem is that if someone has greater than 100pts armor this code will take it away and leave the player with 100 points armor. It needs to be able to see/check/allow for the armor points a player has and do nothing if a player has more than 100 armor. In general terms I understand what must be done but could someone please offer an actual direct code fix?


Code:
class RTDWinVest extends RTDFaceBase;
// The function gets triggered when a player gets this face
// up
static simulated function ModifyPawn(Pawn Other)
{
    // Check if we are running on the server side
    if (Other.Role != ROLE_Authority)
        return;
    Other.ShieldStrength = 100;
    // Set the message to be shown in the chat box
    SetMessage(default.Message);
    // Set the message to be shown in the center of the screen
    // of the triggering player
    SetPersonalMessage(default.PersonalMessage);
}
// Override the properties
defaultproperties
{
     Message="Found a vest."
     PersonalMessage="You found a vest!"
     FaceType=2
}

Code:
class RTDWinVestToAll extends RTDFaceBase;
// The function gets triggered when a player gets this face
// up
static simulated function ModifyPawn(Pawn Other)
{
    local PlayerController P;
 
    // Check if we are running on the server side
    if (Other.Role != ROLE_Authority)
        return;
 
        ForEach Other.DynamicActors(class'PlayerController', P)
    {
        if ((P.Pawn != None) && (KFHumanPawn(P.Pawn) != None) && (P.Pawn.PlayerReplicationInfo != None) && (P.Pawn.Health > 0))
        {
            P.pawn.ShieldStrength = 100;
        }
    }
    // Set the message to be shown in the chat box
    SetMessage(default.Message);
    // Set the message to be shown in the center of the screen
    // of the triggering player
    SetPersonalMessage(default.PersonalMessage);
}
// Override the properties
defaultproperties
{
     Message="Invaded the trader room and stole vest's for everyone."
     PersonalMessage="You shared vest's with everyone!"
     FaceType=7
}
 
Code:
class RTDWinVest extends RTDFaceBase;
// The function gets triggered when a player gets this face
// up
static simulated function ModifyPawn(Pawn Other)
{
    // Check if we are running on the server side
    if (Other.Role != ROLE_Authority)
        return;
    Other.ShieldStrength = [COLOR=DarkOrange]Max(100,Other.ShieldStrength)[/COLOR];
    // Set the message to be shown in the chat box
    SetMessage(default.Message);
    // Set the message to be shown in the center of the screen
    // of the triggering player
    SetPersonalMessage(default.PersonalMessage);
}
// Override the properties
defaultproperties
{
     Message="Found a vest."
     PersonalMessage="You found a vest!"
     FaceType=2
}
Code:
class RTDWinVestToAll extends RTDFaceBase;
// The function gets triggered when a player gets this face
// up
static simulated function ModifyPawn(Pawn Other)
{
    local Controller C;
 
    // Check if we are running on the server side
    if (Other.Role != ROLE_Authority)
        return;
  
    For(C = Level.ControllerList; C!=None; C = C.NextController)
    {
        if (KFHumanPawn(C.Pawn) != None && C.Pawn.Health > 0)
            C.Pawn.ShieldStrength = [COLOR=DarkOrange]Max(100,C.Pawn.ShieldStrength)[/COLOR];
    }
    // Set the message to be shown in the chat box
    SetMessage(default.Message);
    // Set the message to be shown in the center of the screen
    // of the triggering player
    SetPersonalMessage(default.PersonalMessage);
}
// Override the properties
defaultproperties
{
     Message="Invaded the trader room and stole vest's for everyone."
     PersonalMessage="You shared vest's with everyone!"
     FaceType=7
}
 
Last edited:
Upvote 0
Need Fix

Need Fix

I have error after compil need fix please!!

C:\Program Files (x86)\Steam\SteamApps\common\KillingFloor\KFModsRTD\Classes\RTD
WinVestToAll.uc(12) : Error, Bad or missing expression in '='
Compile aborted due to errors.
Failure - 1 error(s), 0 warning(s)
Code:
class RTDWinVestToAll extends RTDFaceBase;
// The function gets triggered when a player gets this face
// up
static simulated function ModifyPawn(Pawn Other)
{
    local Controller C;
 
    // Check if we are running on the server side
    if (Other.Role != ROLE_Authority)
        return;
  
    For(C = Level.ControllerList; C!=None; C = C.NextController)
    {
        if (KFHumanPawn(C.Pawn) != None && C.Pawn.Health > 0)
            C.Pawn.ShieldStrength = Max(100,C.Pawn.ShieldStrength);
    }
    // Set the message to be shown in the chat box
    SetMessage(default.Message);
    // Set the message to be shown in the center of the screen
    // of the triggering player
    SetPersonalMessage(default.PersonalMessage);
}
// Override the properties
defaultproperties
{
     Message="Invaded the trader room and stole vest's for everyone."
     PersonalMessage="You shared vest's with everyone!"
     FaceType=7
}
 
Upvote 0