- Code: Select all • Expand view
// --------------------------------------------------------------------------
//
// Grenade launcher
//
// --------------------------------------------------------------------------
class GrenadeLauncher : FranticWeapon 14167
{
Default
{
Weapon.SelectionOrder 2500;
Weapon.AmmoUse 1;
Weapon.AmmoGive 2;
Weapon.AmmoType "RocketAmmo";
Weapon.SlotNumber 2;
+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_FireGrenade;
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 Grenade : Actor
{
Default
{
Radius 11;
Height 8;
Speed 50;
Damage 20;
Projectile;
-NOGRAVITY
+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;
}
}
//===========================================================================
//
// Code (must be attached to StateProvider)
//
//===========================================================================
extend class StateProvider
{
//===========================================================================
//
// A_FireMissile
//
//===========================================================================
action void A_FireGrenade()
{
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 ("Grenade");
}
}
I've followed all the information I can find, yet it still won't work. It doesn't appear in map editors nor can I use the give command to spawn it in. I don't understand what I'm doing wrong.