Hello. I'm trying to recreate a mod I made for KF1 in KF2. It's rather simple, but I just want to set up a timer to take health and play a sound. Here's the code I have so far:
It's basically a rip from the KF1 mod. Right now I just want to modify every player's health all at once. I'm assuming this is pretty basic, but I have no idea how to address players or their health in KF2.
Code:
class MutNightmare extends Mutator
config(MutNightmare);
//#exec OBJ LOAD FILE="..\Sounds\NightmareSound.uax"
//var() globalconfig string NightmareTakeHealthSound; //the sound package and effect
var() globalconfig int TakeHealthInterval; //how often in seconds health is taken
var() globalconfig int HealthDamage; //how much health should be taken
var() globalconfig int HealthLimit; //how low the player's health will go before stopping
var localized string NightmareMutStr;
//var sound NightmareTakeHealthSoundEffect; //the sound effect to play when health is taken. different from the sound package itself.
//var sound NightmareGrowlEffect; //the growl effect
simulated function PostBeginPlay()
{
local Object O;
//local Controller C;
local KFPawn_Human Player;
SetTimer(TakeHealthInterval, true);
foreach DynamicActors(class 'KFPawn_Human', Player) // for each player
{
//PlaySound(NightmareGrowlEffect,,60.0);
}
}
function Timer()
{
local Controller C;
for (C = Level.ControllerList; C != None; C = C.NextController)
{
if ( C.bIsPlayer && (PlayerController(C)!=None || Bot(C)!=None) && KFPawn(C.Pawn)!=None && C.Pawn.Health>HealthLimit )
{
C.Pawn.Health = Max(C.Pawn.Health-HealthDamage,HealthLimit);
}
}
}
defaultproperties
{
bFullVolume=True
TakeHealthInterval = 5;
HealthDamage = 5;
HealthLimit = 25;
GroupName="KFMutNightmare"
FriendlyName="Nightmare!"
Description="Nightmare! mode, based on the Doom 3 difficulty setting. Player's health decreases over time. Highly configurable, multiplayer compatable, includes original Doom 3 Nightmare! sound. Version 1."
NightmareTakeHealthSound = "NightmareSound.st_takehealth"
NightmareMutStr="Nightmare"
}
It's basically a rip from the KF1 mod. Right now I just want to modify every player's health all at once. I'm assuming this is pretty basic, but I have no idea how to address players or their health in KF2.