KF Need a fix for a Roll The Dice roll

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

[SM]TOPSGT

FNG / Fresh Meat
Jul 12, 2011
376
5
0
Colorado
slsnipers.enjin.com
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
}
 

matttthias

FNG / Fresh Meat
Mar 5, 2010
174
10
0
Austria
www.team-gmk.com
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:

[SM]TOPSGT

FNG / Fresh Meat
Jul 12, 2011
376
5
0
Colorado
slsnipers.enjin.com
Thank you so much that seems to be a nice simple fix and easy to apply. I know a lot of servers have this mut so a little tweak like this is welcomed. Is there any chance that you have tested it? I'm going to use it and I'll report back later.
 

***Stuxnet***

FNG / Fresh Meat
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
}