- Code: Select all • Expand view
Reload:
TNT1 A 0 A_Takeinventory("ZoomIn",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_GiveInventory("ShotgunReloading",1)
BOOM BEH 1
BOOM FG 1
BOOM GY 1
Goto ReloadWork1
ReloadWork1:
TNT1 A 0 A_JumpIfInventory("LoadedShell",1,"ReloadWork2") // Check if there is still at least one shell still loaded.
TNT1 A 0 A_GiveInventory ("ChamberLoading",1) // If not, set a marker saying we will pump to chamber first shell so we'll be able to load 8 more and have 9 shots total.
ReloadWork2:
TNT1 A 0 A_PlayWeaponSound("weapons/trenchgun/load")
TNT1 A 0 A_TakeInventory("Shell",1)
TNT1 A 0 A_GiveInventory("LoadedShell",1)
BOMR ABCCCD 1
BOMR EFGH 1
BOMR II 1 A_WeaponReady(1)
TNT1 A 0 A_JumpIfInventory("LoadedShell",9,"ReloadEnd") // Fully loaded? Back into action!
TNT1 A 0 A_JumpIfInventory("ChamberLoading",1,"ReloadPump") // Are we loading first shell into completely gun if so? Pump!
TNT1 A 0 A_JumpIfInventory("Shell",1,"ReloadWork2") // If not, keep inserting additional shells without pumping until the magtube's full.
//TNT1 A 0 A_JumpIfInventory("Shell",1,1)
CSHT A 0 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH|WRF_ALLOWRELOAD)
Goto ReloadEnd
ReloadPump:
BOOM G 2 A_PlayWeaponSound("weapons/trenchgun/cock")
BOOM Y 2
BOOM Y 2 offset(1,36)
BOOM Y 2 offset(2,38)
BOOM Y 1 offset(2,40)
BOOM G 3 offset(5,36)
BOOM F 6 offset(0,32)
TNT1 A 0 A_TakeInventory("ChamberLoading", 1) // First shell's chambered, so we clear our marker that says we're loading first shell.
TNT1 A 0 A_JumpIfInventory("Shell",1,"ReloadWork2") // Still got ammo? If so, now to load 8 more in it.
Goto ReloadEnd
ReloadEnd:
TNT1 A 0 A_Takeinventory("Aiming",1)
BOOM HEB 2 A_TakeInventory("ShotgunReloading",1)
BOOM A 1 A_WeaponReady(1)
TNT1 A 0 A_ReFire
Goto Ready
To see how this system works for real, load up 'Accessories to Murder' and give yourself the pump shotgun. The reloading mechanics you see is code basically exactly like this in action. My inspiration for this was GZDA Advanced Weapons, in that the pump shotgun in that one worked the same way, in that the first shell loaded into an empty weapon is first chambered by pumping, and then the rest of the shells are simply inserted. This is actually much more closer to reality to how a shotgun would be used by the pros in tactical firefights.
EDIT: Oh, BTW, you need to create a new dummy inventory item as well:
- Code: Select all • Expand view
ACTOR ChamberLoading : Inventory
{
inventory.maxamount 1
}