Code: Select all
actor NewPistol : Weapon
{
Weapon.AmmoType1 "NewPistolLoaded"
Weapon.AmmoUse1 1
Weapon.AmmoGive1 0
Weapon.AmmoType2 "9mmAmmo"
Weapon.AmmoUse2 0
Weapon.AmmoGive2 20
Weapon.SlotNumber 2
Inventory.Pickupmessage "Picked up a pistol."
+ Weapon.Ammo_Optional
+ Weapon.Ammo_CheckBoth
States
{
Ready:
PISG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
Loop
Deselect:
PISG A 1 A_Lower
Loop
Select:
PISG A 1 A_Raise
Loop
Fire:
PISG A 0 A_JumpIfNoAmmo("Reload")
PISG A 4
PISG B 6 A_FireBullets(4,4,-1,6,"BulletPuff",1)
PISG C 4
PISG B 5 A_ReFire
Goto Ready
Reload:
PISG A 0 A_JumpIfInventory("NewPistolLoaded", 12, 2)
PISG A 0 A_JumpIfInventory("9mmAmmo", 1, "ReloadWork")
PISG A 1
Goto Ready
ReloadWork:
PISG A 1 Offset(0,35) A_PlayWeaponSound("weapons/shotgr")
PISG A 1 Offset(0,38)
PISG A 1 Offset(0,44)
PISG A 1 Offset(0,52)
PISG A 1 Offset(0,62)
PISG A 1 Offset(0,72)
PISG A 1 Offset(0,82)
ReloadLoop: // Here's where the magic happens!
TNT1 A 0 A_TakeInventory("9mmAmmo", 1)
TNT1 A 0 A_GiveInventory("NewPistolLoaded", 1)
TNT1 A 0 A_JumpIfInventory("NewPistolLoaded", 12, "ReloadFinish")
TNT1 A 0 A_JumpIfInventory("9mmAmmo", 1, "ReloadLoop")
Goto ReloadFinish
ReloadFinish:
TNT1 A 8
PISG A 1 Offset(0,82)
PISG A 1 Offset(0,72)
PISG A 1 Offset(0,62)
PISG A 1 Offset(0,52)
PISG A 1 Offset(0,44)
PISG A 1 Offset(0,38)
PISG A 1 Offset(0,35)
PISG A 1 Offset(0,32)
Goto Ready
Flash:
PISF A 3 Bright A_Light2
PISF A 3 Bright A_Light1
PISF A 0 Bright A_Light0
Goto LightDone
Spawn:
PIST A -1
Stop
}
}
Code: Select all
ACTOR 9mmAmmo : Ammo replaces Clip
{
Inventory.Amount 10
Inventory.MaxAmount 150
Ammo.BackpackAmount 30
Ammo.BackpackMaxAmount 300
Inventory.Icon "CLIPA0"
Inventory.PickupMessage "Picked up some 9mm ammo."
States
{
Spawn:
CLIP A -1
Stop
}
}
ACTOR NewPistolLoaded : Ammo
{
Inventory.MaxAmount 12
+IGNORESKILL
}