I have been working on a small weapons pack over the past few months, but have encountered some problems that haven't been solved even after staying up hours into the night and slamming my head against my computer without getting any better results.
1. I have a lightning gun-like weapon, based on Reelism's Thunderbolt (with Kinise's permission), that recharges ammo when the primary fire is released or the ammo reaches 0 after firing. However, I have been plauged by two particular bugs: A. Even though the current recharging method works (Having a A_GiveInventory("Battery", 1) in the Ready state), when the ammo reaches zero, the looping fire sound continues to play, the weapon deselects itself, and I am unable to select it again. B. The end sound doesn't play when Primary fire is released.
2. The assualt rifle weapon has been giving me the most touble. The main attributes I have been attempting to create are having the ability to cycle through the three modes, rifle-shotgun-rocket. The second is having two different ammo types (one for the rifle, the other for the shotgun and rocket) and correctly using their respective ammo pools. The ammo would be reloaded using magazines, but essentially be infinite. While cycling through the fire modes are successful through the use of an ACS script, the weapon cannot be reloaded and the shotgun mode takes ammo from the primary ammo as well as the secondary ammo, despite being specified not to do so.
NOTE: I know this is a little late to ask, but please don't steal this and redistribute it as your own work, if for any reason you are compelled to do so.
Here is the Assualt rifle code with the ACS Cycler
Code: Select all
Fire:
TNT1 A 0 A_JumpIfInventory("RifleMode", 1, "RifleFire")
TNT1 A 0 A_JumpIfInventory("ShotgunMode", 1, "ShotgunFire")
TNT1 A 0 A_JumpIfInventory("RocketMode", 1, "RocketFire")
Goto Ready
//------------------------------
// Rifle Mode
//------------------------------
RifleFire:
HARA A 1 A_FireBullets(2.5, 2.5, 1, 0, "BulletPuff", FBF_USEAMMO, 8192, "ARBullet", 8, 0)
HARA A 1 A_TakeInventory("RifleMag", 1)
HARA A 1 A_JumpIfNoAmmo("Reload")
HARA A 1 A_Refire
Goto Ready
//-----------------------
// Shotgun Mode
//-----------------------
ShotgunFire:
HARA A 1 A_PlaySound("weapons/shtgn", CHAN_WEAPON)
//HARA A 5 A_FireBullets(2.5, 2.5, 7, 0, "BulletPuff", FBF_USEAMMO, 8192, "Pellet", 8, 0)
TNT1 A 0 A_TakeInventory("OmniShot", 1)
TNT1 A 0 A_JumpIfNoAmmo("Reload")
Goto Ready
//---------------------------------
// Rocket Launcher Mode
//---------------------------------
RocketFire:
HARA A 1 A_Print("Malfuction")
Goto Ready
Reload:
HARA A 1 A_JumpIfInventory("RifleMag", 0, "RifleReload")
HARA A 1 A_JumpIfInventory("OmniShot", 0, "UnderslungReload")
Goto Ready
RifleReload:
HARA A 1 A_GiveInventory("RifleMag", 50)
Goto Ready
UnderslungReload:
HARA A 1 A_GiveInventory("OmniShot", 8)
Goto Ready
//Swap Modes
AltFire:
OICW A 1 ACS_NamedExecute("OICWCycler", 0, 0, 0, 0)
TNT1 A 0 A_PlaySound("weapons/shotgr", CHAN_AUTO, 50.0)
Goto Ready
}
Code: Select all
if (CheckWeapon("OICW") == 1)
{
if(CheckInventory("RocketMode")==1 && CheckInventory("RifleMode")==0)
//If Rocket Mode is ACTIVE and RifleMode is INACTIVE
{
TakeInventory("RocketMode", 1);
GiveInventory("RifleMode", 1);
Print(s:"Rifle Mode: ACTIVE.");
}
else if(CheckInventory("RifleMode")==1 && CheckInventory("ShotgunMode")==0)
//If Rifle Mode is ACTIVE and Shotgun Mode is INACTIVE
{
TakeInventory("RifleMode", 1);
GiveInventory("ShotgunMode", 1);
Print(s:"Shotgun Mode: ACTIVE.");
}
else if(CheckInventory("ShotgunMode")==1 && CheckInventory("RocketMode")==0)
//If Shotgun Mode is ACTIVE and RocketMode is INACTIVE
{
TakeInventory("ShotgunMode", 1);
GiveInventory("RocketMode", 1);
Print(s:"Rocket Mode: ACTIVE.");
}
NOTE: I know this is a little late to ask, but please don't steal this and redistribute it as your own work, if for any reason you are compelled to do so.