Classes:BFG9000

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.
BFG 9000
Actor type Weapon Game MiniDoomLogoIcon.png (Doom)
DoomEd Number 2006 Class Name BFG9000
Spawn ID 31 Identifier T_BFG


Classes: InventoryWeaponDoomWeaponBFG9000


The BFG9000 is the deadliest and strongest weapon available in Doom. The weapon itself has a few effects not found in other weapons, such as the 40 hitscan tracers that fire out when the weapon hits a target, each doing 100 damage (cumulative with the damage from the projectile) to anything in the way. It uses 40 cell ammo per shot to function.

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 BFG9000 : DoomWeapon
{
	Default
	{
		Height 20;
		Weapon.SelectionOrder 2800;
		Weapon.AmmoUse 40;
		Weapon.AmmoGive 40;
		Weapon.AmmoType "Cell";
		+WEAPON.NOAUTOFIRE;
		Inventory.PickupMessage "$GOTBFG9000";
		Tag "$TAG_BFG9000";
	}
	States
	{
	Ready:
		BFGG A 1 A_WeaponReady;
		Loop;
	Deselect:
		BFGG A 1 A_Lower;
		Loop;
	Select:
		BFGG A 1 A_Raise;
		Loop;
	Fire:
		BFGG A 20 A_BFGsound;
		BFGG B 10 A_GunFlash;
		BFGG B 10 A_FireBFG;
		BFGG B 20 A_ReFire;
		Goto Ready;
	Flash:
		BFGF A 11 Bright A_Light1;
		BFGF B 6 Bright A_Light2;
		Goto LightDone;
	Spawn:
		BFUG A -1;
		Stop;
	OldFire:
		BFGG A 10 A_BFGsound;
		BFGG BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1 A_FireOldBFG;
		BFGG B 0 A_Light0;
		BFGG B 20 A_ReFire;
		Goto Ready;
	}
}

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 BFG9000 : DoomWeapon
{
  Height 20
  Weapon.SelectionOrder 2800
  Weapon.AmmoUse 40
  Weapon.AmmoGive 40
  Weapon.AmmoType "Cell"
  +WEAPON.NOAUTOFIRE
  Inventory.PickupMessage "$GOTBFG9000"
  Tag "$TAG_BFG9000"
  States
  {
  Ready:
    BFGG A 1 A_WeaponReady
    Loop
  Deselect:
    BFGG A 1 A_Lower
    Loop
  Select:
    BFGG A 1 A_Raise
    Loop
  Fire:
    BFGG A 20 A_BFGSound
    BFGG B 10 A_GunFlash
    BFGG B 10 A_FireBFG
    BFGG B 20 A_ReFire
    Goto Ready
  Flash:
    BFGF A 11 Bright A_Light1
    BFGF B 6 Bright A_Light2
    Goto LightDone
  Spawn:
    BFUG A -1
    Stop
  OldFire:
    BFGG A 10 A_BFGSound
    BFGG BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1 A_FireOldBFG
    BFGG B 0 A_Light0
    BFGG B 20 A_ReFire
    Goto Ready
  }
}

See also