help with random health regen mutator

can someone tell me what im doing wrong with my code im still a beginner so its harder for me to figure it out. i get a 1 unrecognized member ‘Health’ in class ‘UTPlayercontroller’ error here is my code:

class HealthRegenMutator extends UTMutator;

var int HealthMax;
var array <UTPlayerController> AllControllers;

simulated event PostBeginPlay()
SetTimer(30.0, True, ‘RegenPlayer’ );
function RegenPlayer()
local UTPlayerController Player;
local int PlayerCount;
local int RandomPlayerNumber;

	foreach WorldInfo.AllControllers(class 'UTPlayerController', Player)

if (Player.Health + 2 <= Player.HealthMax)
Player.Health += 2;

	PlayerCount = PlayerCount + 1;
	RandomPlayerNumber = Rand(PlayerCount);
	RandomPlayerNumber = RandomPlayerNumber - 1;

If (RandomPlayerNumber < 0);
Player.Health = Player.HealthMax;




Since your code is obviously UnrealScript (and derived from a UT class, at that), you need to be using this code in UT3 (and asking about it on the UT3 forums, not a UE4 C++ subforum). You can’t use that code in UE4.

Health is a member of UTPawn, you need to access it through UTPlayerController, UTPawn(Player.Pawn).Health, like so :cool: