Classes:BFG9000
Classes: Inventory→Weapon→DoomWeapon→BFG9000
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
|
BFG 9000 | |||
---|---|---|---|
Actor type | Weapon | Game | ![]() |
DoomEd Number | 2006 | Class Name | BFG9000 |
Spawn ID | 31 | Identifier | T_BFG |
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.
Note: The BFGBall class contains the obituary for the direct hit. For the tracers' obituary, you may add this line to the weapon's definition.
Obituary "$OB_MPBFG_SPLASH" // "%o couldn't hide from %k's BFG"
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;
}
}
extend class StateProvider
{
action void A_BFGsound()
{
A_StartSound("weapons/bfgf", CHAN_WEAPON);
}
//
// A_FireBFG
//
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);
}
//
// A_FireOldBFG
//
// This function emulates Doom's Pre-Beta BFG
// By Lee Killough 6/6/98, 7/11/98, 7/19/98, 8/20/98
//
// This code may not be used in other mods without appropriate credit given.
// Code leeches will be telefragged.
action void A_FireOldBFG()
{
bool doesautoaim = false;
if (player == null)
{
return;
}
Weapon weap = player.ReadyWeapon;
if (invoker != weap || stateinfo == null || stateinfo.mStateType != STATE_Psprite) weap = null;
if (weap != null)
{
if (!weap.DepleteAmmo (weap.bAltFire, true, 1))
return;
doesautoaim = weap.bNoAutoaim;
weap.bNoAutoaim = true;
}
player.extralight = 2;
// Save values temporarily
double SavedPlayerAngle = angle;
double SavedPlayerPitch = pitch;
for (int i = 0; i < 2; i++) // Spawn two plasma balls in sequence
{
angle += random[OldBFG](-64, 63) * (90./768);
pitch += random[OldBFG](-64, 63) * (90./640);
SpawnPlayerMissile (i == 0? (class<Actor>)("PlasmaBall1") : (class<Actor>)("PlasmaBall2"));
// Restore saved values
angle = SavedPlayerAngle;
pitch = SavedPlayerPitch;
}
// Restore autoaim setting
if (weap != null) weap.bNoAutoaim = doesautoaim;
}
}
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 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 } }
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.