Classes:Archvile

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.
Arch-Vile
Actor type Monster Game MiniDoom2LogoIcon.png (Doom2)
DoomEd Number 64 Class Name Archvile
Spawn ID 111 Identifier T_VILE


Classes: Archvile
 →StealthArchvile


The Archvile's primary attack sends a huge flame into its target, which then punts it up into the air and knocking large amounts of health. The only way to dodge it is to get behind a wall fast, or hurt the Archvile before it can complete the attack. The Archvile can also resurrect it's hellish brethren. However, Archviles cannot resurrect the Cyberdemon, Spider Mastermind, Lost Soul, Pain Elemental, or fellow Archviles. The Archvile is lacking from the console versions of Doom.

The Archvile can only resurrect an actor if they have a Raise state in their actor definition. By default, the large enemies (listed above) do not have this state and so the Archvile won't attempt to resurrect them. If you want to create a new actor inherited from one with a Raise state, but don't want the new monster to be resurrectable, you can disable the Raise state using the following code in your actor:

Raise:
  Stop


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 Archvile : Actor
{
	Default
	{
		Health 700;
		Radius 20;
		Height 56;
		Mass 500;
		Speed 15;
		PainChance 10;
		Monster;
		MaxTargetRange 896;
		+QUICKTORETALIATE 
		+FLOORCLIP 
		+NOTARGET
		SeeSound "vile/sight";
		PainSound "vile/pain";
		DeathSound "vile/death";
		ActiveSound "vile/active";
		MeleeSound "vile/stop";
		Obituary "$OB_VILE";
		Tag "$FN_ARCH";
	}
	States
	{
	Spawn:
		VILE AB 10 A_Look;
		Loop;
	See:
		VILE AABBCCDDEEFF 2 A_VileChase;
		Loop;
	Missile:
		VILE G 0 BRIGHT A_VileStart;
		VILE G 10 BRIGHT A_FaceTarget;
		VILE H 8 BRIGHT A_VileTarget;
		VILE IJKLMN 8 BRIGHT A_FaceTarget;
		VILE O 8 BRIGHT A_VileAttack;
		VILE P 20 BRIGHT;
		Goto See;
	Heal:
		VILE [\] 10 BRIGHT;
		Goto See;
	Pain:
		VILE Q 5;
		VILE Q 5 A_Pain;
		Goto See;
	Death:
		VILE Q 7;
		VILE R 7 A_Scream;
		VILE S 7 A_NoBlocking;
		VILE TUVWXY 7;
		VILE Z -1;
		Stop;
	}
}

extend class Actor
{

	void A_VileStart()
	{
		A_StartSound ("vile/start", CHAN_VOICE);
	}
	
	//
	// A_VileTarget
	// Spawn the hellfire
	//
	void A_VileTarget(class<Actor> fire = "ArchvileFire")
	{
		if (target)
		{
			A_FaceTarget ();

			Actor fog = Spawn (fire, target.Pos, ALLOW_REPLACE);
			if (fog != null)
			{
				tracer = fog;
				fog.target = self;
				fog.tracer = self.target;
				fog.A_Fire(0);
			}
		}
	}
	
	void A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, double thrust = 1.0, name damagetype = "Fire", int flags = 0)
	{
		Actor targ = target;
		if (targ)
		{
			A_FaceTarget();
			if (!CheckSight(targ, 0)) return;
			A_StartSound(snd, CHAN_WEAPON);
			int newdam = targ.DamageMobj (self, self, initialdmg, (flags & VAF_DMGTYPEAPPLYTODIRECT)? damagetype : 'none');

			targ.TraceBleed (newdam > 0 ? newdam : initialdmg, self);
			
			Actor fire = tracer;
			if (fire)
			{
				// move the fire between the vile and the player
				fire.SetOrigin(targ.Vec3Angle(-24., angle, 0), true);
				fire.A_Explode(blastdmg, blastradius, XF_NOSPLASH, false, 0, 0, 0, "BulletPuff", damagetype);
			}
			if (!targ.bDontThrust)
			{
				targ.Vel.z = thrust * 1000 / max(1, targ.Mass);
			}
		}
	}
	
	void A_StartFire()
	{
		A_StartSound ("vile/firestrt", CHAN_BODY);
		A_Fire();
	}
	
	//
	// A_Fire
	// Keep fire in front of player unless out of sight
	//
	void A_Fire(double spawnheight = 0)
	{
		Actor dest = tracer;
		if (!dest || !target) return;
				
		// don't move it if the vile lost sight
		if (!target.CheckSight (dest, 0) ) return;

		SetOrigin(dest.Vec3Angle(24, dest.angle, spawnheight), true);
	}
	
	void A_FireCrackle()
	{
		A_StartSound ("vile/firecrkl", CHAN_BODY);
		A_Fire();
	}
}

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 Archvile
{
  Health 700
  Radius 20
  Height 56
  Mass 500
  Speed 15
  PainChance 10
  Monster
  MaxTargetRange 896
  +QUICKTORETALIATE
  +FLOORCLIP
  +NOTARGET
  SeeSound "vile/sight"
  PainSound "vile/pain"
  DeathSound "vile/death"
  ActiveSound "vile/active"
  MeleeSound "vile/stop"
  Obituary "$OB_VILE"
  States
  {
  Spawn:
    VILE AB 10 A_Look
    Loop
  See:
    VILE AABBCCDDEEFF 2 A_VileChase
    Loop
  Missile:
    VILE G 0 Bright A_VileStart
    VILE G 10 Bright A_FaceTarget
    VILE H 8 Bright A_VileTarget
    VILE IJKLMN 8 Bright A_FaceTarget
    VILE O 8 Bright A_VileAttack
    VILE P 20 Bright
    Goto See
  Heal:
    VILE "[\]" 10 Bright
    Goto See
  Pain:
    VILE Q 5   
    VILE Q 5 A_Pain
    Goto See
  Death:
    VILE Q 7
    VILE R 7 A_Scream
    VILE S 7 A_NoBlocking
    VILE TUVWXY 7
    VILE Z -1
    Stop
  }
}