do damage to all zeds in map?

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

Prodigy

FNG / Fresh Meat
Feb 28, 2010
239
4
0
Umbrella Corp. HQ
hey this is my code so far

class ZombieEmpathy extends Mutator;


function PostBeginPlay()
{
Super.PostBeginPlay();
SetTimer(1, true);

}

function Timer()
{

local KFHumanPawn Player;
local int enemydamage;

foreach DynamicActors(class 'KFHumanPawn', Player)
{

enemydamage = ( Player.HealthMax - Player.Health ) * 10;
Enemy.Damage(enemydamage);
}
}

defaultproperties
{
GroupName="KFEmpathyMut"
FriendlyName="Empathy Mut"
Description="Get the difference between your health and max health, multiply by 10, and do this damage to zeds every second."
}

i know that enemy isnt declared, but how do i make it so it damages all zombies in teh map?
 

Benjamin

Grizzled Veteran
May 17, 2009
3,650
635
113
France
Code:
foreach DynamicActors(class'KFMonster', KFM)
{
	KFM.[URL="http://wiki.beyondunreal.com/Legacy:Actor/Methods#Damage_.26_Kills"]TakeDamage[/URL](...);
}

I think it's necessary to specify the hit coordinates in TakeDamage, in which case I'd suggest simply passing the enemy's location.
 

rickyhorror

FNG / Fresh Meat
May 25, 2010
459
67
0
from what Benjamin provided, i've gathered this

Code:
class KFEmpathy extends Mutator;

function PostBeginPlay()
{
    Super.PostBeginPlay();
    SetTimer(1, true);
}

function Timer()
{
    local KFHumanPawn Player;
    local KFMonster KFM;
    
    foreach DynamicActors(class'KFMonster', KFM)
    {
        KFM.TakeDamage( Player.HealthMax - Player.Health * 10 )
    }
}

defaultproperties
{
    GroupName="KFEmpathy"
    FriendlyName="Empathy"
    Description="Get the difference between your health and max health, multiply by 10, and do this damage to zeds every second."
}
i was looking into TakeDamage and i couldn't really figure how to specify the hit coordinates >_<
parameter 2 is bad, but it's a shot at it

hope you get it down
this would be pretty tight
 

rickyhorror

FNG / Fresh Meat
May 25, 2010
459
67
0
i think i've found a solution for you

Code:
class KFEmpathy extends Mutator;

function PostBeginPlay()
{
    Super.PostBeginPlay();
    SetTimer(1, true);
}

function Timer()
{
    local KFHumanPawn Player;
    local KFMonster KFM;
    
    foreach DynamicActors(class'KFMonster', KFM)
    {
        KFM.Health -= ( Player.HealthMax - Player.Health * 10 );
    }
}

defaultproperties
{
    GroupName="KFEmpathy"
    FriendlyName="Empathy"
    Description="Get the difference between your health and max health, multiply by 10, and do this damage to zeds every second."
}
this actually compiled for me with no issues, so we'll see how it goes
i'll take some damage, then just out run a clot til he dies
if he doesn't ever die, then it no worky ]:
it he does die, it worked xD

EDIT: no go ]:
 
Last edited:

Benjamin

Grizzled Veteran
May 17, 2009
3,650
635
113
France
Code:
function Timer()
{
	local KFHumanPawn Player;
	local KFMonster KFM;
	
	Player = KFHumanPawn(Level.GetLocalPlayerController().Pawn);
	if (Player == None) return;
    
	foreach DynamicActors(class'KFMonster', KFM)
	{
		KFM.TakeDamage((Player.HealthMax - Player.Health) * 2, Player, KFM.Location, vect(0,0,0), Class'KFMod.DamTypeDualies');
	}
}

Note that all specimens will play the "take damage" animation every second, which might not be desired. If not, use a hybrid of our ideas - reduce the health manually but do not let it drop below 1, and then to finish it off call TakeDamage.
 

rickyhorror

FNG / Fresh Meat
May 25, 2010
459
67
0
Code:
function Timer()
{
    local KFHumanPawn Player;
    local KFMonster KFM;
    
    Player = KFHumanPawn(Level.GetLocalPlayerController().Pawn);
    if (Player == None) return;
    
    foreach DynamicActors(class'KFMonster', KFM)
    {
        KFM.TakeDamage((Player.HealthMax - Player.Health) * 2, Player, KFM.Location, vect(0,0,0), Class'KFMod.DamTypeDualies');
    }
}
Note that all specimens will play the "take damage" animation every second, which might not be desired. If not, use a hybrid of our ideas - reduce the health manually but do not let it drop below 1, and then to finish it off call TakeDamage.

AHH! i see. [:
i get it now
i was just typing in the standard text and adding the damage, vectors, class, etc under the takedamage >_<
and i know what you're saying about not letting the health go under 1 [:
you could always to this to prevent that:
Code:
function Timer()
{
    local KFHumanPawn Player;
    local KFMonster KFM;
    
    Player = KFHumanPawn(Level.GetLocalPlayerController().Pawn);
    if (Player == None) return;
    
    foreach DynamicActors(class'KFMonster', KFM)
    {
        if (KFM.Health <= 1)
            SetTimer(1, true);
        else KFM.TakeDamage((Player.HealthMax - Player.Health) * 2, Player,  KFM.Location, vect(0,0,0), Class'KFMod.DamTypeDualies');
    }
}
that way once their health hits 1, it won't stop the timer, but also won't go to the else unless they're manually killed :p
once killed, it's move on the the else and continue the "Empathy" and damage the specimens
 

rickyhorror

FNG / Fresh Meat
May 25, 2010
459
67
0
Okay, so I've done some editing to the code portion and compiled this and played around with it a few times.

the original dame amount you wanted was insane!
Code:
(Player.HealthMax - Player.Health) * 10
i ran around with 97 health and they dropped FAST and the wave was over in well under a minute

so i changed
Code:
(Player.HealthMax - Player.Health) * 10
to
Code:
(Player.HealthMax - Player.Health)
so it's just whatever health you're missing
if you're at 85 health, they take 15 damage a second, so on

i also changed the class from
Code:
Class'KFMod.DamTypeDualies'
to
Code:
Class'KFMod.DamTypeZombieAttack'
so it's more like they're killing themselves from your lack of health
also adds that sweet taste of bitter irony

other changes where made aswell

here's a video of how it turned out

YouTube - Empathy (Mutator) [Killing Floor]

funwut.gif


now as you can see, it's still WAY too easy

so i also suggest changing the timer
i used your original timer of
Code:
    SetTimer(1, true);
i suggest changing it from 1 second, to something more like 5
Code:
    SetTimer(5, true);
that way it isn't WAY too easy and they still have a bit of a chance of fighting back
 
Last edited: