A_FireBFG

From ZDoom Wiki
Jump to navigation Jump to search
Ktip.png This page describes a function made for one of the natively supported games. These functions are made with very specific purpose and provide no flexibility, so using them in custom projects is not recommended. Authors are encouraged to use one of the more generalized functions in custom projects. For example: A_FireProjectile.

StateProvider

action void A_FireBFG()

Usage

Fires a BFGBall from the current weapon.

Autoaim is disabled by default through the "Allow BFG aiming" DMFlag. This can be circumvented by spawning it manually:

   A_FireProjectile("BFGBall", 0, 1);

Examples

This is taken directly from the BFG9000.

	Fire:
		BFGG A 20 A_BFGsound;
		BFGG B 10 A_GunFlash;
		BFGG B 10 A_FireBFG;
		BFGG B 20 A_ReFire;
		Goto Ready;

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.
	action void A_FireBFG()
	{
		if (player == null)
		{
			return;
		}
		Weapon weap = player.ReadyWeapon;
		if (weap != null && invoker == weap && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
		{
			if (!weap.DepleteAmmo (weap.bAltFire, true, deh.BFGCells))
				return;
		}

		SpawnPlayerMissile("BFGBall", angle, nofreeaim:sv_nobfgaim);
	}

See also