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
}