Talk:Specimen Mechanics

From Tripwire Interactive Wiki
Revision as of 21:20, 25 March 2012 by Scaryghost (talk | contribs) (Added flinching info)
Jump to navigation Jump to search

Decapitation

Decapitation damage bonus and bleed out timer: KFMonster.RemoveHead() [KFMonster.uc].

// Head explodes, causing additional hurty.
if( KFPawn(LastDamagedBy)!=None )
{
    TakeDamage( LastDamageAmount + 0.25 * HealthMax , LastDamagedBy, LastHitLocation, LastMomentum, LastDamagedByType);
}

if( Health > 0 )
{
   BleedOutTime = Level.TimeSeconds +  BleedOutDuration;
}

BleedOutTime usage: KFMonster.Tick() [KMonster.uc].

// If the Zed has been bleeding long enough, make it die
if ( Role == ROLE_Authority && bDecapitated )
{
    if ( BleedOutTime > 0 && Level.TimeSeconds - BleedOutTime >= 0 )
    {
        Died(LastDamagedBy.Controller,class'DamTypeBleedOut',Location);
        BleedOutTime=0;
    }
}

BleedOutDuration is set to 5 in KFMonster.uc, 6 in ZombieBloatBase.uc, ZombieHuskBase.uc, and ZombieScrakeBase.uc, and 7 in ZombieFleshpoundBase.uc

--Scaryghost 00:46, 24 March 2012 (EDT)

Stunning

Damage requirement for stunning: KFMonster.PlayHit() [KFMonster.uc]

if( Health>0 && Damage>(float(Default.Health)/1.5) )
    FlipOver();

FlipOver's actions: KFMonster.FlipOver() [KFMonster.uc]

// High damage was taken, make em fall over.
function bool FlipOver()
{
    if( Physics==PHYS_Falling )
    {
        SetPhysics(PHYS_Walking);
    }

    bShotAnim = true;
    SetAnimAction('KnockDown');
    Acceleration = vect(0, 0, 0);
    Velocity.X = 0;
    Velocity.Y = 0;
    Controller.GoToState('WaitForAnim');
    KFMonsterController(Controller).bUseFreezeHack = True;
    Return True;
}

Specimens with a blank FlipOver() function cannot be stunned. The ones that have it overloaded and blanked are:

  • Crawler
  • Bloat
  • Siren
  • Fleshpound
  • Patriarch

Husks have a second, alternate condition that can trigger a stun. The stun threshold is set to 200 if the weapon is an ebr, lar, or crossbow.

ZombieHusk.PlayHit() [ZombieHusk.uc]

if( Health>0 && Damage>(float(Default.Health)/1.5) )
{
    FlipOver();
}
else if( Health > 0 && (damageType == class'DamTypeCrossbow' || damageType == class'DamTypeCrossbowHeadShot' ||
        damageType == class'DamTypeWinchester' || damageType == class'DamTypeM14EBR')
        &&  Damage > 200 ) // 200 Damage will be a headshot with the Winchester or EBR, or a hit with the Crossbow
{
    FlipOver();
}


--Scaryghost 01:10, 24 March 2012 (EDT)

Flinching

Even though the variables are bSTUNNED and StunsRemaining, the resulting animation is a flinch, rather than what one would consider a stun. If any one of the conditions is false, a different, shorter hit animation is played, a mini flinch. It is still considered a flinch, but unlike normal flinching, it can be done multiple times to scrakes and fp on Suicidal+.

Flinching code: KFMonster.PlayDirectionalHit() [KFMonster.uc].

if ( Dir dot X > 0.7 || Dir == vect(0,0,0))
{
    if( LastDamagedBy!=none && LastDamageAmount>0 )
    {
        if ( StunsRemaining != 0 && (LastDamageAmount >= (0.5 * default.Health) ||
            (VSize(LastDamagedBy.Location - Location) <= (MeleeRange * 2) && ClassIsChildOf(LastDamagedbyType,class 'DamTypeMelee') &&
             KFPawn(LastDamagedBy) != none && LastDamageAmount > (0.10* default.Health))) )
        {
            SetAnimAction(HitAnims[Rand(3)]);
            bSTUNNED = true;
            SetTimer(StunTime,false);
            StunsRemaining--;
        }
        else
            SetAnimAction(KFHitFront);
    }
}

For scrakes, if he has already been flinched, you cannot perform mini flinches on him. That is because if StunsRemaining is 0, the above code is not called from the scrake code.

ZombieScrake.PlayTakeHit() [ZombieScrake.uc]

if( (Level.Game.GameDifficulty < 5.0 || StunsRemaining != 0) && (Damage>=150 || (DamageType.name=='DamTypeStunNade' && StunChance>3) || (DamageType.name=='DamTypeCrossbowHeadshot' && Damage>=200)) )
    PlayDirectionalHit(HitLocation);

--Scaryghost 17:20, 25 March 2012 (EDT)