Classes:Archvile

From ZDoom Wiki
Jump to navigation Jump to search
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
  1. You do not need to copy that actor, since it is already defined.
  2. In fact, it's not just useless, it's actually harmful as it can cause problems.
  3. If you want to modify it, or use a modified version, using inheritance is the way to go.
  4. The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
  5. There is only one exception: if what you want is changing Ammo capacity, you need to create a new type from Ammo.
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 here for reference only. DECORATE is still supported but no longer used by GZDoom. 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
  }
}