Classes:HellKnight

From ZDoom Wiki
Jump to navigation Jump to search
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
  1. This actor is already defined in GZDoom, there's no reason to define it again.
  2. In fact, trying to define an actor with the same name will cause an error (because it already exists).
  3. If you want to make your own version of this actor, use inheritance.
  4. Definitions for existing actors are put on the wiki for reference purpose only.
Hell Knight
Actor type Monster Game MiniDoom2LogoIcon.png (Doom2)
DoomEd Number 69 Class Name HellKnight
Spawn ID 113 Identifier T_HELLKNIGHT


Classes: BaronOfHellHellKnight
 →StealthHellKnight


Hell Knights are a satyr-like monster similar to the Baron of Hell. Like the Baron, their primary attack is a green fireball. However, they only have half as much health as their big brothers.

ZScript definition

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
class HellKnight : BaronOfHell
{
	Default
	{
		Health 500;
		-BOSSDEATH;
		SeeSound "knight/sight";
		ActiveSound "knight/active";
		PainSound "knight/pain";
		DeathSound "knight/death";
		HitObituary "$OB_KNIGHTHIT";
		Obituary "$OB_KNIGHT";
		Tag "$FN_HELL";
	}
	States
	{
	Spawn:
		BOS2 AB 10 A_Look;
		Loop;
	See:
		BOS2 AABBCCDD 3 A_Chase;
		Loop;
	Melee:
	Missile:
		BOS2 EF 8 A_FaceTarget;
		BOS2 G 8 A_BruisAttack;
		Goto See;
	Pain:
		BOS2 H  2;
		BOS2 H  2 A_Pain;
		Goto See;
	Death:
		BOS2 I  8;
		BOS2 J  8 A_Scream;
		BOS2 K  8;
		BOS2 L  8 A_NoBlocking;
		BOS2 MN 8;
		BOS2 O -1;
		Stop;
	Raise:
		BOS2 O 8;
		BOS2 NMLKJI  8;
		Goto See;
	}
}

A_BruisAttack is defined only once in GZDoom (since both Baron of Hell and Hell Knight are in the same file), this is repeated here for illustration purposes.

extend class Actor
{
	void A_BruisAttack()
	{
		let targ = target;
		if (targ)
		{
			if (CheckMeleeRange())
			{
				int damage = random[pr_bruisattack](1, 8) * 10;
				A_StartSound ("baron/melee", CHAN_WEAPON);
				int newdam = target.DamageMobj (self, self, damage, "Melee");
				targ.TraceBleed (newdam > 0 ? newdam : damage, self);
			}
			else
			{
				// launch a missile
				SpawnMissile (target, "BaronBall");
			}
		}
	}
}

DECORATE definition

Note: This is legacy code, kept for archival purposes only. DECORATE is deprecated in GZDoom and is completely superseded by ZScript. GZDoom internally uses the ZScript definition above.
ACTOR HellKnight : BaronOfHell
{
  Health 500
  -BOSSDEATH
  SeeSound "knight/sight"
  ActiveSound "knight/active"
  PainSound "knight/pain"
  DeathSound "knight/death"
  HitObituary "$OB_KNIGHTHIT"
  Obituary "$OB_KNIGHT"
  States
  {
  Spawn:
    BOS2 AB 10 A_Look
    Loop
  See:
    BOS2 AABBCCDD 3 A_Chase
    Loop
  Melee:
  Missile:
    BOS2 EF 8 A_FaceTarget
    BOS2 G 8 A_BruisAttack
    Goto See
  Pain:
    BOS2 H 2
    BOS2 H 2 A_Pain
    Goto See
  Death:
    BOS2 I 8
    BOS2 J 8 A_Scream
    BOS2 K 8
    BOS2 L 8 A_NoBlocking
    BOS2 MN 8
    BOS2 O -1
    Stop
  Raise:
    BOS2 O 8
    BOS2 NMLKJI 8
    Goto See
  }
}