Classes:SpectralMonster

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.
Spectral monster base class
Actor type Internal Game MiniStrifeLogoIcon.png (Strife)
DoomEd Number None Class Name SpectralMonster


Classes: SpectralMonster
 →AlienSpectre1
  →AlienSpectre2
  →AlienSpectre3
  →AlienSpectre4
  →AlienSpectre5
 →EntityBoss
 →EntitySecond
The base class for all Spectres and the Entity in Strife. Any monster of this type also has a special attribute where they deal 5 damage to any player who touches them.

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 SpectralMonster : Actor
{
	Default
	{
		Monster;
		+SPECIAL
		+SPECTRAL
		+NOICEDEATH
	}
	
	override void Touch (Actor toucher)
	{
		toucher.DamageMobj (self, self, 5, 'Melee');
	}
	

	//============================================================================

	void A_SpectreChunkSmall ()
	{
		Actor foo = Spawn("AlienChunkSmall", pos + (0, 0, 10), ALLOW_REPLACE);

		if (foo != null)
		{
			int t;

			t = random[SpectreChunk](0, 7);
			foo.Vel.X = t - random[SpectreChunk](0, 15);

			t = random[SpectreChunk](0, 7);
			foo.Vel.Y = t - random[SpectreChunk](0, 15);

			foo.Vel.Z = random[SpectreChunk](0, 15);
		}
	}

	void A_SpectreChunkLarge ()
	{
		Actor foo = Spawn("AlienChunkLarge", pos + (0, 0, 10), ALLOW_REPLACE);

		if (foo != null)
		{
			int t;

			t = random[SpectreChunk](0, 7);
			foo.Vel.X = t - random[SpectreChunk](0, 15);
			
			t = random[SpectreChunk](0, 7);
			foo.Vel.Y = t - random[SpectreChunk](0, 15);

			foo.Vel.Z = random[SpectreChunk](0, 7);
		}
	}

	void A_Spectre3Attack ()
	{
		if (target == null)
			return;

		Actor foo = Spawn("SpectralLightningV2", Pos + (0, 0, 32), ALLOW_REPLACE);
		if (foo != null)
		{
			foo.Vel.Z = -12;
			foo.target = self;
			foo.FriendPlayer = 0;
			foo.tracer = target;
		}

		Angle -= 90.;
		for (int i = 0; i < 20; ++i)
		{
			Angle += 9.;
			SpawnSubMissile ("SpectralLightningBall2", self);
		}
		Angle -= 90.;
	}
	
	//============================================================================
	//
	// A_SpotLightning
	//
	//============================================================================

	void A_SpotLightning()
	{
		if (target == null) return;

		Actor spot = Spawn("SpectralLightningSpot", (target.pos.xy, target.floorz), ALLOW_REPLACE);
		if (spot != null)
		{
			spot.threshold = 25;
			spot.target = self;
			spot.FriendPlayer = 0;
			spot.tracer = target;
		}
	}

}

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 SpectralMonster native
{
  Monster
  +SPECIAL
  +SPECTRAL
  +NOICEDEATH

  action native A_SpectreChunkSmall();
  action native A_SpectreChunkLarge();
  action native A_Spectre3Attack();
  action native A_SpotLightning();
}

See also