|
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
- You do not need to copy that actor, since it is already defined.
- In fact, it's not just useless, it's actually harmful as it can cause problems.
- If you want to modify it, or use a modified version, using inheritance is the way to go.
- The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
- There is only one exception: if what you want is changing Ammo capacity, you need to create a new type from Ammo.
|
Rocket launcher
|
Actor type
|
Weapon
|
Game
|
(Doom)
|
DoomEd Number
|
2003
|
Class Name
|
RocketLauncher
|
Spawn ID
|
29
|
Identifier
|
T_ROCKETLAUNCHER
|
Classes: Inventory→Weapon→DoomWeapon→RocketLauncher
The rocket launcher. It fires projectiles which cause splash damage. Not recommended for close range. Uses rockets for ammo.
|
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 RocketLauncher : DoomWeapon
{
Default
{
Weapon.SelectionOrder 2500;
Weapon.AmmoUse 1;
Weapon.AmmoGive 2;
Weapon.AmmoType "RocketAmmo";
+WEAPON.NOAUTOFIRE
Inventory.PickupMessage "$GOTLAUNCHER";
Tag "$TAG_ROCKETLAUNCHER";
}
States
{
Ready:
MISG A 1 A_WeaponReady;
Loop;
Deselect:
MISG A 1 A_Lower;
Loop;
Select:
MISG A 1 A_Raise;
Loop;
Fire:
MISG B 8 A_GunFlash;
MISG B 12 A_FireMissile;
MISG B 0 A_ReFire;
Goto Ready;
Flash:
MISF A 3 Bright A_Light1;
MISF B 4 Bright;
MISF CD 4 Bright A_Light2;
Goto LightDone;
Spawn:
LAUN A -1;
Stop;
}
}
class Rocket : Actor
{
Default
{
Radius 11;
Height 8;
Speed 20;
Damage 20;
Projectile;
+RANDOMIZE
+DEHEXPLOSION
+ROCKETTRAIL
+ZDOOMTRANS
SeeSound "weapons/rocklf";
DeathSound "weapons/rocklx";
Obituary "$OB_MPROCKET";
}
States
{
Spawn:
MISL A 1 Bright;
Loop;
Death:
MISL B 8 Bright A_Explode;
MISL C 6 Bright;
MISL D 4 Bright;
Stop;
BrainExplode:
MISL BC 10 Bright;
MISL D 10 A_BrainExplode;
Stop;
}
}
// --------------------------------------------------------------------------
//
// Grenade -- Taken and adapted from Skulltag, with MBF stuff added to it
//
// --------------------------------------------------------------------------
class Grenade : Actor
{
Default
{
Radius 8;
Height 8;
Speed 25;
Damage 20;
Projectile;
-NOGRAVITY
+RANDOMIZE
+DEHEXPLOSION
+GRENADETRAIL
BounceType "Doom";
Gravity 0.25;
SeeSound "weapons/grenlf";
DeathSound "weapons/grenlx";
BounceSound "weapons/grbnce";
Obituary "$OB_GRENADE";
DamageType "Grenade";
}
States
{
Spawn:
SGRN A 1 Bright;
Loop;
Death:
MISL B 8 Bright A_Explode;
MISL C 6 Bright;
MISL D 4 Bright;
Stop;
Grenade:
MISL A 1000 A_Die;
Wait;
Detonate:
MISL B 4 A_Scream;
MISL C 6 A_Detonate;
MISL D 10;
Stop;
Mushroom:
MISL B 8 A_Mushroom;
Goto Death+1;
}
}
//===========================================================================
//
// Code (must be attached to StateProvider)
//
//===========================================================================
extend class StateProvider
{
//===========================================================================
//
// A_FireMissile
//
//===========================================================================
action void A_FireMissile()
{
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, 1))
return;
}
SpawnPlayerMissile ("Rocket");
}
//===========================================================================
//
// A_FireSTGrenade: not exactly backported from ST, but should work the same
//
//===========================================================================
action void A_FireSTGrenade(class<Actor> grenadetype = "Grenade")
{
if (grenadetype == null)
return;
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, 1))
return;
}
// Temporarily raise the pitch to send the grenadetype slightly upwards
double savedpitch = pitch;
pitch -= 6.328125;
SpawnPlayerMissile(grenadetype);
pitch = SavedPitch;
}
}
|
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 RocketLauncher : DoomWeapon
{
Weapon.SelectionOrder 2500
Weapon.AmmoUse 1
Weapon.AmmoGive 2
Weapon.AmmoType "RocketAmmo"
+WEAPON.NOAUTOFIRE
Inventory.PickupMessage "$GOTLAUNCHER"
Tag "$TAG_ROCKETLAUNCHER"
States
{
Ready:
MISG A 1 A_WeaponReady
Loop
Deselect:
MISG A 1 A_Lower
Loop
Select:
MISG A 1 A_Raise
Loop
Fire:
MISG B 8 A_GunFlash
MISG B 12 A_FireMissile
MISG B 0 A_ReFire
Goto Ready
Flash:
MISF A 3 Bright A_Light1
MISF B 4 Bright
MISF CD 4 Bright A_Light2
Goto LightDone
Spawn:
LAUN A -1
Stop
}
}