A_Fire

From ZDoom Wiki
Jump to navigation Jump to search
DoomWiki.org
For more information on this article, visit the A_Fire page on the Doom Wiki.


Actor

void A_Fire(double spawnheight = 0)

Usage

Places the calling actor directly in front of its tracer, with a z offset of height. If height is not specified, it defaults to 0.

Essentially, this is a specific analog of A_Warp or SetOrigin functions.

Parameters

  • double spawnheight
How high above the actor's tracer the effect should appear. The default value is 0, which means it'll be warped to the tracer's bottom (legs).

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.
	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);
	}

See also:

Examples

The Arch-Vile from Doom uses this function in its fire attack's code to keep the fire placed on its target:

class ArchvileFire : Actor
{
	Default
	{
		+NOBLOCKMAP +NOGRAVITY +ZDOOMTRANS
		RenderStyle "Add";
		Alpha 1;
	}
	States
	{
	Spawn:
		FIRE A 2 BRIGHT  A_StartFire;
		FIRE BAB 2 BRIGHT  A_Fire;
		FIRE C 2 BRIGHT  A_FireCrackle;
		FIRE BCBCDCDCDEDED 2 BRIGHT  A_Fire;
		FIRE E 2 BRIGHT  A_FireCrackle;
		FIRE FEFEFGHGHGH 2 BRIGHT  A_Fire;
		Stop;
	}
}

See also

  • A_Warp — more flexible generalized variant of A_Fire.