actor "Glock 18" : RGUWeapon
{
  obituary "%k sprayed %o with the G18."
  inventory.pickupmessage "You got the Glock 18. Spray'em."
  //attacksound "ump45/fire6"
  weapon.selectionorder 14
  weapon.ammotype "G18Clip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "G18Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  -NOAUTOFIRE
  states
  {
  Ready:
    M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    GRNA L 0 A_TakeInventory("weapondropper",2)
    G18A A 0 A_PlaySoundEx("weapon/draw","SoundSlot5")
    G18A BC 2 A_WeaponReady(WRF_NOPRIMARY|WRF_ALLOWZOOM)
	G18A DEFGH 2 A_WeaponReady(WRF_ALLOWZOOM)
	G18A I 0 A_JumpIfInventory("G18Token",1,"Reload")
    G18A I 0 A_JumpIfNoAmmo("Reload")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    G18A I 0 A_JumpIfInventory("Aiming",1,5)
    G18A I 0 A_JumpIfInventory("Reloading",1,"Reload")
    G18A I 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    G18A I 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18A I 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+12
    G18C F 0 A_JumpIfInventory("Reloading",1,"Reload")
  ReadyAim:
    G18C F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    G18C F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
    G18C F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+18
  Deselect:
    G18A I 0 A_PlaySoundEx("weapon/down","SoundSlot5")
    G18A I 0 A_TakeInventory("Aiming",1)
    G18A I 0 A_TakeInventory("Reloading",1)
    G18A I 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    G18A I 0 A_ZoomFactor(1.0)
    G18A I 0 A_Lower
    G18A I 1 A_Lower
    Goto Deselect+5
  Select:
    G18A A 0 A_Raise
    Loop
  Fire:
    G18B A 0 A_JumpIfInventory("Aiming",1,"FireAim")
    G18B A 0 A_JumpIfNoAmmo("ReloadStart")
    G18B A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    G18B A 0 A_PlayWeaponSound("g18/fire")
    G18B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,9,4)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18B A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-7.00,7.00), 1, 0, 4, 0, frandom(-7.00,7.00))
	G18B A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,11,39-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18B B 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18B A 0 A_JumpIfNoAmmo("FireEmpty")
    G18B B 1 BRIGHT A_GunFlash
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18B A 0 A_JumpIfInventory("G18Ammo",1,3)
    G18B CD 1 A_ReFire
    Goto Ready+12
    G18B A 0 A_JumpIfNoAmmo("ReloadStart")
    G18B CD 1 A_ReFire
    Goto Ready+12
  Hold:
    G18B A 0 A_JumpIfInventory("Aiming",1,"HoldAim")
    G18B A 0 A_JumpIfNoAmmo("ReloadStart")
    G18B A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Hold_SteadyAim")
    G18B A 0 A_PlayWeaponSound("g18/fire")
    G18B A 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,9,4)
    G18B A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-10.00,10.00), 1, 0, 4, 0, frandom(-10.00,10.00))
	G18B A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,11,39-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18B A 0 A_JumpIfNoAmmo("FireEmpty")
    G18B B 1 BRIGHT A_GunFlash
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18B B 0 A_JumpIfInventory("G18Ammo",1,3)
    G18B CD 1 A_ReFire
    Goto Ready+12
    G18B B 0 A_JumpIfNoAmmo("ReloadStart")
    G18B CD 1 A_ReFire
    Goto Ready+12
  FireEmpty:
    G18B B 1 BRIGHT A_GunFlash
    G18B CD 1 A_GiveInventory("G18Bolt",1)
    G18B A 0 A_JumpIfInventory("G18Ammo",1,2)
    G18B A 0 A_ReFire
    Goto Ready+12
    G18B A 0 A_JumpIfNoAmmo("ReloadStart")
    G18B A 0 A_ReFire
    Goto Ready+12
  FireAim:
    G18C G 0 A_PlayWeaponSound("g18/fire")
    G18C G 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,7)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18C G 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-1.40,1.40), 1, 0, 4, 0, frandom(-1.40,1.40))
	G18C G 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,0,42-(Sin(Pitch)*28),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18C G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18C G 0 A_JumpIfNoAmmo("FireAimEmpty")
    G18C H 1 BRIGHT A_GunFlash
    G18C H 0 A_JumpIfInventory("G18Ammo",1,3)
    G18C IJ 1 A_ReFire
    Goto Ready+18
    G18C H 0 A_JumpIfNoAmmo("ReloadStart")
    G18C IJ 1 A_ReFire
    Goto Ready+18
  HoldAim:
    G18C G 0 A_PlayWeaponSound("g18/fire")
    G18C G 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,0,7)
    G18C G 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-4.20,4.20), 1, 0, 4, 0, frandom(-4.20,4.20))
	G18C G 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,0,42-(Sin(Pitch)*28),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18C G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18C G 0 A_JumpIfNoAmmo("FireAimEmpty")
    G18C H 1 BRIGHT A_GunFlash
    G18C H 0 A_JumpIfInventory("G18Ammo",1,3)
    G18C IJ 1 A_ReFire
    Goto Ready+18
    G18C H 0 A_JumpIfNoAmmo("ReloadStart")
    G18C IJ 1 A_ReFire
    Goto Ready+18
  FireAimEmpty:
    G18C H 1 BRIGHT A_GunFlash
    G18C IJ 1 A_GiveInventory("G18Bolt",1)
    G18C A 0 A_JumpIfInventory("G18Ammo",1,2)
    G18C A 0 A_ReFire
    Goto Ready+18
    G18C A 0 A_JumpIfNoAmmo("ReloadStart")
    G18C A 0 A_ReFire
    Goto Ready+18
  Reload: //AltFire:
    G18C A 0 A_JumpIfInventory("G18Clip",33,2)
    G18C A 0 A_JumpIfInventory("G18Ammo",1,"ReloadStart")
    G18C A 0 A_TakeInventory("Reloading",1)
    G18C A 0 A_JumpIfInventory("Aiming",1,"ReadyAim")
    Goto Ready+15
  ReloadStart:
    G18E H 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    G18E H 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    G18E H 0 A_JumpIfInventory("G18Bolt",1,"ReloadStartBolt")
    G18E H 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
	G18E H 0 A_JumpIfInventory("G18Token",1,"Reload2")
    G18E H 3 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18E IJKLM 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18E M 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
	G18E M 0 A_GiveInventory("G18Token",1)
	G18E NOP 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    G18E QRSTU 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18E VWXY 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18E Z 3 A_TakeInventory("Reloading",1)
    G18E Z 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmo
  ReloadAmmo:
    G18E Z 0 A_JumpIfInventory("G18Clip",33,"ReloadEnd")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18E Z 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEnd
    G18E Z 0 A_GiveInventory("G18Clip",1)
    G18E Z 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    G18F ABCD 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18F EFG 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18F G 0 A_ReFire
    Goto Ready+12
  ReloadStartBolt:
    G18D A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStartBolt_SOH")
	G18E H 0 A_JumpIfInventory("G18Token",1,"Reload3")
    G18D A 3 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18D BCDEFGHIJ 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18E J 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
	G18E M 0 A_GiveInventory("G18Token",1)
	G18D KLM 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload3
  Reload3:
    G18D NOPQR 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18D S 3 A_TakeInventory("Reloading",1)
    G18D S 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmoBolt
  ReloadAmmoBolt:
    G18D S 0 A_JumpIfInventory("G18Clip",33,"ReloadEndBolt")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18D S 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEndBolt
    G18D S 0 A_GiveInventory("G18Clip",1)
    G18D S 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmoBolt
  ReloadEndBolt:
    G18D S 0 A_TakeInventory("G18Bolt",1)
    G18D TUVWXY 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18D Z 3 A_PlaySoundEx("g18/bolt","SoundSlot5")
    G18E ABCDEFG 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18E G 0 A_ReFire
    Goto Ready+12
  Zoom:
  PostReloadAlt:
    G18A I 0 A_JumpIfInventory("G18Token",1,"Reload")
    G18C E 0 A_ZoomFactor(1.15)
    G18C D 0 A_GiveInventory("Aiming",1)
	G18C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    G18C ABCDE 1
    Goto AltHold
  AltFireHoldAim:
    "####" "#" 0 A_JumpIfInventory("G18Clip",1,1)
	Goto Reload
    G18C G 0 A_PlayWeaponSound("g18/fire")
	GRNA L 0 A_TakeInventory("G18Clip",1)
    G18C G 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,0,7)
	"####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18C G 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-3.20,3.20), 1, 0, 4, 0, frandom(-3.20,3.20))
	G18C G 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,0,42-(Sin(Pitch)*28),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18C G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18C H 1 BRIGHT A_GunFlash
	"####" "#" 0 A_JumpIfInventory("G18Clip",1,1)
	Goto Reload
    G18C IJ 1 A_ReFire
    Goto Ready+18
  AltHold:
    G18C F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
	M4CA C 0 A_JumpIfInventory("FireHeld",1,"AltFireHoldAim")
	M4CA C 0 A_JumpIfInventory("Reloading",1,"Reload")
	U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
	M4CA F 0 A_Refire("AltHold")
	M4CA C 0 A_JumpIfInventory("Aiming",1,"AltFire2")
	Goto Ready+18
  AltFire:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    G18A I 0 A_JumpIfInventory("G18Token",1,"Reload")
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"AltHold")
    G18C A 0 A_ZoomFactor(1.15)
    G18C A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    G18C AB 1
    G18C B 0 A_GiveInventory("Aiming",1)
    G18C CDE 1
    G18C E 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    G18C E 0 A_Refire
    Goto Ready+18
  AltFire2:
    G18C E 0 A_ZoomFactor(1.0)
    G18C ED 1
    G18C D 0 A_TakeInventory("Aiming",1)
    G18C CBA 1
    G18C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	G18A IIII 1
    M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+12
  AltFire3:
    G18C A 0 A_ZoomFactor(1.0)
    G18C EDCBA 1
    G18C A 0 A_TakeInventory("Aiming",1)
    G18C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    G18C G 0 A_Refire
    goto DropWeapon
  ReloadStartAim:
    G18C E 0 A_ZoomFactor(1.0)
    G18C ED 1
    G18C D 0 A_TakeInventory("Aiming",1)
    G18C CBA 1
    G18C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    Goto ReloadStart+2
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP Q 0
    WEAP Q 0 A_SpawnItem("G18Drop")
    stop
  Fire_SteadyAim:
    G18B A 0 A_PlayWeaponSound("g18/fire")
    G18B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,9,4)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18B A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-5.00,5.00), 1, 0, 4, 0, frandom(-5.00,5.00))
	G18B A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,11,39-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18B A 0 A_JumpIfNoAmmo("FireEmpty")
    G18B B 1 BRIGHT A_GunFlash
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18B B 0 A_JumpIfInventory("G18Ammo",1,3)
    G18B CD 1 A_ReFire
    Goto Ready+12
    G18B B 0 A_JumpIfNoAmmo("ReloadStart")
    G18B CD 1 A_ReFire
    Goto Ready+12
  Hold_SteadyAim:
    G18B A 0 A_PlayWeaponSound("g18/fire")
    G18B A 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,9,4)
    G18B A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
	G18B A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,11,39-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18B A 0 A_JumpIfNoAmmo("FireEmpty")
    G18B B 1 BRIGHT A_GunFlash
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18B B 0 A_JumpIfInventory("G18Ammo",1,3)
    G18B CD 1 A_ReFire
    Goto Ready+12
    G18B B 0 A_JumpIfNoAmmo("ReloadStart")
    G18B CD 1 A_ReFire
    Goto Ready+12
  ReloadStart_SOH:
    G18E H 0 A_JumpIfInventory("G18Token",1,"Reload4")
    G18E H 2 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18E IJKLM 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18E M 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18E M 0 A_GiveInventory("G18Token",1)
	G18E NOP 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    G18E QRSTU 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18E VWXY 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18E Z 2 A_TakeInventory("Reloading",1)
    G18E Z 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    G18E Z 0 A_JumpIfInventory("G18Clip",33,"ReloadEnd_SOH")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18E Z 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEnd_SOH
    G18E Z 0 A_GiveInventory("G18Clip",1)
    G18E Z 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    G18F ABCD 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18F EFG 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18F G 0 A_ReFire
    Goto Ready+12
  ReloadStartBolt_SOH:
    G18E H 0 A_JumpIfInventory("G18Token",1,"Reload5")
    G18D A 2 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18D BCDEFGHIJ 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18D J 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18E M 0 A_GiveInventory("G18Token",1)
	G18D KLM 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload5
  Reload5:
    G18D NOPQR 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18D S 2 A_TakeInventory("Reloading",1)
    G18D S 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    G18D S 0 A_JumpIfInventory("G18Clip",33,"ReloadEndBolt_SOH")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18D S 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEndBolt_SOH
    G18D S 0 A_GiveInventory("G18Clip",1)
    G18D S 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmoBolt_SOH
  ReloadEndBolt_SOH:
    G18D S 0 A_TakeInventory("G18Bolt",1)
    G18D TUVWX 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18D Y 2 A_PlaySoundEx("g18/bolt","SoundSlot5")
    G18D Z 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18E ABCDEFG 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18E G 0 A_ReFire
    Goto Ready+12
  FragGrenade:
    U45F A 0 ACS_NamedExecuteAlways("RefSpeak",0,1,0,0)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	M4CA J 0 A_JumpIfInventory("ThrowingStun",1,"StunGrenade")
	M4CA J 0 A_JumpIfInventory("ThrowingIncd",1,"IncGrenade")
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  FragGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"KnifeAttack_SOH")
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  StunGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"StunGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  IncGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"IncGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  StunGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  IncGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  DropWeapon:
    G18A IHGFEDCBA 2 A_WeaponReady(WRF_NOPRIMARY)
    G18A A 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CC F 0 A_JumpIfInventory("weapondropper",2,"ThrowWeapon")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",1)
	M4CB A 0 A_FireCustomMissile("G18Dropped",0,0,7,2)
	stop
  ThrowWeapon:
    GRNA IKMN 1
	KNFA B 0 A_PlaySound("knife/swing")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",2)
	M4CB A 0 A_FireCustomMissile("G18Thrown",0,0,7,2)
	stop
  }
}

actor G18Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 33
    ammo.backpackamount 0
    ammo.backpackmaxamount 33
    +IGNORESKILL
}

actor G18Bolt : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor "Glock 18 Ex Mags" : "Glock 18"
{
  obituary "%k sprayed %o with the G18."
  inventory.pickupmessage "You got the Glock 18. Spray'em."
  //attacksound "ump45/fire6"
  weapon.selectionorder 14
  weapon.ammotype "G18Clip2"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "G18Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  -NOAUTOFIRE
  states
  {
  Ready:
    M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    GRNA L 0 A_TakeInventory("weapondropper",2)
    G18A A 0 A_PlaySoundEx("weapon/draw","SoundSlot5")
    G18A BC 2 A_WeaponReady(WRF_NOPRIMARY|WRF_ALLOWZOOM)
	G18A DEFGH 2 A_WeaponReady(WRF_ALLOWZOOM)
	G18A I 0 A_JumpIfInventory("G18Token",1,"Reload")
    G18A I 0 A_JumpIfNoAmmo("Reload")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    G18A I 0 A_JumpIfInventory("Aiming",1,5)
    G18A I 0 A_JumpIfInventory("Reloading",1,"Reload")
    G18A I 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    G18A I 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18A I 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+12
    G18C F 0 A_JumpIfInventory("Reloading",1,"Reload")
  ReadyAim:
    G18C F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    G18C F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
    G18C F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+18
  Reload: //AltFire:
    G18C A 0 A_JumpIfInventory("G18Clip2",50,2)
    G18C A 0 A_JumpIfInventory("G18Ammo",1,"ReloadStart")
    G18C A 0 A_TakeInventory("Reloading",1)
    G18C A 0 A_JumpIfInventory("Aiming",1,"ReadyAim")
    Goto Ready+15
  ReloadStart:
    G18E H 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    G18E H 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    G18E H 0 A_JumpIfInventory("G18Bolt",1,"ReloadStartBolt")
    G18E H 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
	G18E H 0 A_JumpIfInventory("G18Token",1,"Reload2")
    G18E H 3 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18E IJKLM 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18E M 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18E M 0 A_GiveInventory("G18Token",1)
	G18E NOP 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    G18E QRSTU 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18E VWXY 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18E Z 3 A_TakeInventory("Reloading",1)
    G18E Z 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmo
  ReloadAmmo:
    G18E Z 0 A_JumpIfInventory("G18Clip2",50,"ReloadEnd")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18E Z 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEnd
    G18E Z 0 A_GiveInventory("G18Clip2",1)
    G18E Z 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    G18F ABCD 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18F EFG 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18F G 0 A_ReFire
    Goto Ready+12
  ReloadStartBolt:
    G18D A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStartBolt_SOH")
	G18E H 0 A_JumpIfInventory("G18Token",1,"Reload3")
    G18D A 3 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18D BCDEFGHIJ 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18D J 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18E M 0 A_GiveInventory("G18Token",1)
	G18D KLM 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload3
  Reload3:
    G18D NOPQR 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18D S 3 A_TakeInventory("Reloading",1)
    G18D S 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmoBolt
  ReloadAmmoBolt:
    G18D S 0 A_JumpIfInventory("G18Clip2",50,"ReloadEndBolt")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18D S 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEndBolt
    G18D S 0 A_GiveInventory("G18Clip2",1)
    G18D S 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmoBolt
  ReloadEndBolt:
    G18D S 0 A_TakeInventory("G18Bolt",1)
    G18D TUVWXY 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18D Z 3 A_PlaySoundEx("g18/bolt","SoundSlot5")
    G18E ABCDEFG 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18E G 0 A_ReFire
    Goto Ready+12
  ReloadStartAim:
    G18C E 0 A_ZoomFactor(1.0)
    G18C ED 1
    G18C D 0 A_TakeInventory("Aiming",1)
    G18C CBA 1
    G18C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    Goto ReloadStart+2
  ReloadStart_SOH:
    G18E H 0 A_JumpIfInventory("G18Token",1,"Reload4")
    G18E H 2 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18E IJKLM 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18E M 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18E M 0 A_GiveInventory("G18Token",1)
	G18E NOP 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    G18E QRSTU 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18E VWXY 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18E Z 2 A_TakeInventory("Reloading",1)
    G18E Z 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    G18E Z 0 A_JumpIfInventory("G18Clip2",50,"ReloadEnd_SOH")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18E Z 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEnd_SOH
    G18E Z 0 A_GiveInventory("G18Clip2",1)
    G18E Z 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    G18F ABCD 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18F EFG 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18F G 0 A_ReFire
    Goto Ready+12
  ReloadStartBolt_SOH:
    G18E H 0 A_JumpIfInventory("G18Token",1,"Reload5")
    G18D A 2 A_PlaySoundEx("g18/clipout","SoundSlot5")
    G18D BCDEFGHIJ 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18D J 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18E M 0 A_GiveInventory("G18Token",1)
	G18D KLM 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload5
  Reload5:
    G18D NOPQR 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18D S 2 A_TakeInventory("Reloading",1)
    G18D S 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    G18D S 0 A_JumpIfInventory("G18Clip2",50,"ReloadEndBolt_SOH")
	G18E Z 0 A_TakeInventory("G18Token",1)
    G18D S 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEndBolt_SOH
    G18D S 0 A_GiveInventory("G18Clip2",1)
    G18D S 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmoBolt_SOH
  ReloadEndBolt_SOH:
    G18D S 0 A_TakeInventory("G18Bolt",1)
    G18D TUVWX 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18D Y 2 A_PlaySoundEx("g18/bolt","SoundSlot5")
    G18D Z 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18E ABCDEFG 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    G18E G 0 A_ReFire
    Goto Ready+12
  PostReloadAlt:
    G18A I 0 A_JumpIfInventory("G18Token",1,"Reload")
    G18C E 0 A_ZoomFactor(1.15)
    G18C D 0 A_GiveInventory("Aiming",1)
	G18C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    G18C ABCDE 1
    Goto AltHold
  AltFireHoldAim:
    "####" "#" 0 A_JumpIfInventory("G18Clip2",1,1)
	Goto Reload
    G18C G 0 A_PlayWeaponSound("g18/fire")
	GRNA L 0 A_TakeInventory("G18Clip2",1)
    G18C G 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,0,7)
	"####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18C G 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-3.20,3.20), 1, 0, 4, 0, frandom(-3.20,3.20))
	G18C G 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,0,42-(Sin(Pitch)*28),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18C G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18C H 1 BRIGHT A_GunFlash
	"####" "#" 0 A_JumpIfInventory("G18Clip2",1,1)
	Goto Reload
    G18C IJ 1 A_ReFire
    Goto Ready+18
  }
}

actor G18Clip2 : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 50
    ammo.backpackamount 0
    ammo.backpackmaxamount 50
    +IGNORESKILL
}

actor G18ExMags : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}

actor "Glock 18 Akimbo" : "Glock 18"
{
  obituary "%k sprayed %o with some G18s."
  inventory.pickupmessage "You got the Glock 18. Spray'em."
  //attacksound "ump45/fire6"
  weapon.selectionorder 14
  weapon.ammotype "G18Clip3"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "G18Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  -NOAUTOFIRE
  states
  {
  Ready:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    G18G A 2 A_PlaySoundEx("weapon/draw","SoundSlot5")
    G18G BCDEFGH 2 A_WeaponReady(WRF_NOFIRE)
	G18A I 0 A_JumpIfInventory("G18Token",1,"Reload")
    G18G I 0 A_JumpIfNoAmmo("Reload")
    G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    G18G I 0 A_JumpIfInventory("Reloading",1,"Reload")
    G18G I 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    G18G I 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18G I 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Goto Ready+11
  Deselect:
    G18G I 0 A_PlaySoundEx("weapon/down","SoundSlot5")
    G18G I 0 A_TakeInventory("Aiming",1)
    G18G I 0 A_TakeInventory("Reloading",1)
    G18G I 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    G18G I 0 A_Lower
    G18G I 1 A_Lower
    Goto Deselect+4
  Select:
    G18G A 0 A_Raise
    Loop
  Fire:
    G18H A 0 A_JumpIfInventory("Aiming",1,"FireAim")
    G18H A 0 A_JumpIfNoAmmo("ReloadStart")
    G18H A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    G18H A 0 A_PlayWeaponSound("g18/fire")
    G18H A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,19,2)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18H A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
	G18H A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H A 0 BRIGHT A_GunFlash
    G18H A 0 A_GiveInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H B 0 A_PlaySoundEx("g18/fireak","SoundSlot6")
    G18H B 0 A_FireCustomMissile("WeaponSmokePuff",0,0,-20,6)
    G18H B 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
	G18H B 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,-19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H B 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H B 0 A_TakeInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H A 0 A_JumpIfInventory("G18Ammo",1,4)
    G18H DE 1 A_ReFire
    Goto Ready+11
    G18H A 0 A_JumpIfNoAmmo("ReloadStart")
    G18H DE 1 A_ReFire
    Goto Ready+11
  Hold:
    G18H A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Hold_SteadyAim")
    G18H A 0 A_PlayWeaponSound("g18/fireak")
    G18H A 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,19,2)
    G18H A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-11.00,11.00), 1, 0, 4, 0, frandom(-11.00,11.00))
	G18H A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H A 0 BRIGHT A_GunFlash
    G18H A 0 A_GiveInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H B 0 A_PlaySoundEx("g18/fireak","SoundSlot6")
    G18H B 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,-20,6)
    G18H B 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-11.00,11.00), 1, 0, 4, 0, frandom(-11.00,11.00))
	G18H B 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,-19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H B 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H B 0 A_TakeInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H A 0 A_JumpIfInventory("G18Ammo",1,4)
    G18H CDE 1 A_ReFire
    Goto Ready+11
    G18H A 0 A_JumpIfNoAmmo("ReloadStart")
    G18H CDE 1 A_ReFire
    Goto Ready+11
  FireEmpty:
    G18H B 1
    G18H CDE 1 A_GiveInventory("G18Bolt",1)
    G18H A 0 A_JumpIfInventory("G18Ammo",1,2)
    G18H A 0 A_ReFire
    Goto Ready+11
    G18H A 0 A_JumpIfNoAmmo("ReloadStart")
    G18H CDE 1 A_ReFire
    Goto Ready+11
  Reload: //AltFire:
    G18I A 0 A_JumpIfInventory("G18Clip3",66,2)
    G18I A 0 A_JumpIfInventory("G18Ammo",1,"ReloadStart")
    G18I A 0 A_TakeInventory("Reloading",1)
    Goto Ready+14
  ReloadStart:
    G18I H 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    G18I H 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    G18I H 0 A_JumpIfInventory("G18Bolt",1,"ReloadStartBolt")
    G18I H 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
	G18E H 0 A_JumpIfInventory("G18Token",1,"Reload2")
    G18I A 3 A_PlaySoundEx("g18/clipout","SoundSlot7")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18I B 3 A_PlaySoundEx("g18/clipout","SoundSlot5")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
	G18E M 0 A_GiveInventory("G18Token",1)
	goto Reload2
  Reload2:
    G18I CDEFGHIJKL 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    TNT1 AAAAAA 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    TNT1 AAAAAA 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 3 A_TakeInventory("Reloading",1)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmo
  ReloadAmmo:
    TNT1 A 0 A_JumpIfInventory("G18Clip3",66,"ReloadEnd")
	G18E Z 0 A_TakeInventory("G18Token",1)
    TNT1 A 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEnd
    TNT1 A 0 A_GiveInventory("G18Clip3",1)
    TNT1 A 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    TNT1 AA 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18G ABCDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18G FGHI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18G G 0 A_ReFire
    Goto Ready+11
  ReloadStartBolt:
    G18J A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStartBolt_SOH")
	G18E H 0 A_JumpIfInventory("G18Token",1,"Reload3")
    G18J A 3 A_PlaySoundEx("g18/clipout","SoundSlot7")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18I B 3 A_PlaySoundEx("g18/clipout","SoundSlot5")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
	G18E M 0 A_GiveInventory("G18Token",1)
	goto Reload3
  Reload3:
    G18J CDEFGHIJK 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    TNT1 AAAAAA 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    TNT1 AAAAAA 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 3 A_TakeInventory("Reloading",1)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmoBolt
  ReloadAmmoBolt:
    TNT1 A 0 A_JumpIfInventory("G18Clip3",66,"ReloadEndBolt")
	G18E Z 0 A_TakeInventory("G18Token",1)
    TNT1 A 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEndBolt
    TNT1 A 0 A_GiveInventory("G18Clip3",1)
    TNT1 A 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmoBolt
  ReloadEndBolt:
    G18J O 0 A_TakeInventory("G18Bolt",1)
    TNT1 AAAA 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18J LMN 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18J O 3 A_PlayWeaponSound("g18/bolt")
    G18J P 3 A_PlaySoundEx("g18/bolt","SoundSlot5")
    G18J QRST 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18J G 0 A_ReFire
    Goto Ready+11
  AltFire:
    G18G I 1 A_WeaponReady(WRF_NOSECONDARY)
    Goto Ready+11
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP Q 0
    WEAP Q 0 A_SpawnItemEx("G18Drop")
    stop
  ReloadStart_SOH:
    G18E H 0 A_JumpIfInventory("G18Token",1,"Reload4")
    G18I A 2 A_PlaySoundEx("g18/clipout","SoundSlot7")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18I B 2 A_PlaySoundEx("g18/clipout","SoundSlot5")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
	G18E M 0 A_GiveInventory("G18Token",1)
	goto Reload4
  Reload4:
    G18I CDEFGHIJKL 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    TNT1 AAAAAA 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    TNT1 AAAAAA 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 2 A_TakeInventory("Reloading",1)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    TNT1 A 0 A_JumpIfInventory("G18Clip3",66,"ReloadEnd_SOH")
	G18E Z 0 A_TakeInventory("G18Token",1)
    TNT1 A 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEnd_SOH
    TNT1 A 0 A_GiveInventory("G18Clip3",1)
    TNT1 A 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    TNT1 AAA 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18G ABCDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18G FGHI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18G G 0 A_ReFire
    Goto Ready+11
  ReloadStartBolt_SOH:
    G18E H 0 A_JumpIfInventory("G18Token",1,"Reload5")
    G18J A 2 A_PlaySoundEx("g18/clipout","SoundSlot7")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
    G18J B 2 A_PlaySoundEx("g18/clipout","SoundSlot5")
	G18I A 0 A_FireCustomMissile("G18EmptyMagSpawner",0,0,0,1)
	G18E M 0 A_GiveInventory("G18Token",1)
	goto Reload5
  Reload5:
    G18J CDEFGHIJK 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    TNT1 AAAAAA 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    TNT1 AAAAAA 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    TNT1 A 2 A_TakeInventory("Reloading",1)
    TNT1 A 0 A_PlaySoundEx("g18/clipin","SoundSlot5")
    Goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    TNT1 A 0 A_JumpIfInventory("G18Clip3",66,"ReloadEndBolt_SOH")
	G18E Z 0 A_TakeInventory("G18Token",1)
    TNT1 A 0 A_JumpIfInventory("G18Ammo",1,1)
    Goto ReloadEndBolt_SOH
    TNT1 A 0 A_GiveInventory("G18Clip3",1)
    TNT1 A 0 A_TakeInventory("G18Ammo",1)
    Goto ReloadAmmoBolt_SOH
  ReloadEndBolt_SOH:
    G18J O 0 A_TakeInventory("G18Bolt",1)
    TNT1 AAAAAA 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18J LMN 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    G18J O 2 A_PlayWeaponSound("g18/bolt")
    G18J P 2 A_PlaySoundEx("g18/bolt","SoundSlot5")
    G18J QRST 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    G18J G 0 A_ReFire
    Goto Ready+11
  Fire_SteadyAim:
    G18H A 0 A_PlayWeaponSound("g18/fire")
    G18H A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,19,2)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    G18H A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	G18H A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H A 0 BRIGHT A_GunFlash
    G18H A 0 A_GiveInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H B 0 A_PlaySoundEx("g18/fireak","SoundSlot6")
    G18H B 0 A_FireCustomMissile("WeaponSmokePuff",0,0,-20,6)
    G18H B 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	G18H B 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,-19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H B 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H B 0 A_TakeInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H A 0 A_JumpIfInventory("G18Ammo",1,4)
    G18H DE 1 A_ReFire
    Goto Ready+11
    G18H A 0 A_JumpIfNoAmmo("ReloadStart")
    G18H DE 1 A_ReFire
    Goto Ready+11
  Hold_SteadyAim:
    G18H A 0 A_PlayWeaponSound("g18/fireak")
    G18H A 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,19,2)
    G18H A 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-9.00,9.00))
	G18H A 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H A 0 BRIGHT A_GunFlash
    G18H A 0 A_GiveInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H B 0 A_PlaySoundEx("g18/fireak","SoundSlot6")
    G18H A 0 A_FireCustomMissile("WeaponSmokePuffLight",0,0,-20,6)
    G18H B 1 BRIGHT A_FireCustomMissile("HHCBG18", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-9.00,9.00))
	G18H B 0 A_SpawnItemEx("BulletCasing",Cos(Pitch)*30,-19,32-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    G18H B 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    G18H B 0 A_TakeInventory("FireSwitch",1)
    G18H A 0 A_JumpIfNoAmmo("FireEmpty")
    G18H A 0 A_JumpIfInventory("G18Ammo",1,4)
    G18H CDE 1 A_ReFire
    Goto Ready+11
    G18H A 0 A_JumpIfNoAmmo("ReloadStart")
    G18H CDE 1 A_ReFire
    Goto Ready+11
  FragGrenade:
    U45F A 0 ACS_NamedExecuteAlways("RefSpeak",0,1,0,0)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	M4CA J 0 A_JumpIfInventory("ThrowingStun",1,"StunGrenade")
	M4CA J 0 A_JumpIfInventory("ThrowingIncd",1,"IncGrenade")
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
    Goto Ready+2
  FragGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
    Goto Ready+2
  KnifeAttack:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"KnifeAttack_SOH")
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  KnifeAttack_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  StunGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"StunGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
    Goto Ready+2
  IncGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"IncGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
    Goto Ready+2
  StunGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
    Goto Ready+2
  IncGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
    Goto Ready+2
  DropWeapon:
    G18G IHGFEDCB 2 A_WeaponReady(WRF_NOPRIMARY)
	G18G A 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CC F 0 A_JumpIfInventory("weapondropper",2,"ThrowWeapon")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",1)
	M4CB A 0 A_FireCustomMissile("G18Dropped",0,0,7,2)
	stop
  ThrowWeapon:
    GRNA IKMN 1
	KNFA B 0 A_PlaySound("knife/swing")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",2)
	M4CB A 0 A_FireCustomMissile("G18Thrown",0,0,7,2)
  }
}

actor G18Clip3 : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 66
    ammo.backpackamount 0
    ammo.backpackmaxamount 66
    +IGNORESKILL
}
actor G18Akimbo : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}

actor G18Pickup : CustomInventory
{
  inventory.pickupmessage "You got the Glock 18. Spray'em."
  inventory.pickupsound "deagle/bolt"
  +INVENTORY.AUTOACTIVATE
  //inventory.respawntics 70
  scale 0.09
  States
  {
  Spawn:
    WEAP Q -1
    stop
  Pickup:
    WEAP Q 0
    WEAP Q 0 A_JumpIf((ACS_NamedExecuteWithResult("RefCheckVar",0,0,0)) == 1, "PickupStay")
    WEAP Q 0 A_JumpIfInventory("Glock 18",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP Q 0 A_JumpIfInventory("Glock 18 Ex Mags",1,"AmmoPickup")
    WEAP Q 0 A_JumpIfInventory("Glock 18 Akimbo",1,"AmmoPickup")
    WEAP Q 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP Q 0 A_JumpIfInventory("MaxWeaponsFilled",90,"FailPickup2")
	WEAP Q 0 A_GiveInventory("MaxWeaponsFilled",11)
    WEAP Q 0 ACS_NamedExecuteWithResult("RefPickU",15,0,0)
    stop
  PickupStay:
    WEAP Q 0
    WEAP Q 0 A_JumpIfInventory("Glock 18",1,"FailPickup") // If the player already has this weapon, they get more ammo for it
    WEAP Q 0 A_JumpIfInventory("Glock 18 Ex Mags",1,"FailPickup")
    WEAP Q 0 A_JumpIfInventory("Glock 18 Akimbo",1,"FailPickup")
    WEAP Q 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP Q 0 A_JumpIfInventory("MaxWeaponsFilled",90,"FailPickup2")
	WEAP Q 0 A_GiveInventory("MaxWeaponsFilled",11)
    WEAP Q 0 ACS_NamedExecuteWithResult("RefPickU",15,0,0)
    WEAP Q 0 ACS_NamedExecuteWithResult("RefPickC",15,0,0)
    WEAP Q 0 A_PlaySound("deagle/bolt")
    fail
  AmmoPickup:
    WEAP Q 0
    WEAP Q 0 A_JumpIfInventory("G18Ammo",0,"FailPickup")
    WEAP Q 0 A_GiveInventory("G18Ammo",33)
    stop
  OneManArmy:
    WEAP Q 0
	WEAP Q 0 A_JumpIfInventory("MaxWeaponsFilled",127,"FailPickup2")
	WEAP Q 0 A_GiveInventory("MaxWeaponsFilled",11)
	WEAP Q 0 ACS_NamedExecuteWithResult("RefPickU",15,0,0)
	stop
  FailPickup:
    WEAP Q 1
    fail
  FailPickup2:
    WEAP Q 1
    WEAP Q 0 ACS_NamedExecuteAlways("RefSlots",0,6,0,0)
    fail
  }
}

actor G18Drop : G18Pickup
{
  States
  {
  Spawn:
    WEAP Q -1
    stop
  Pickup:
    WEAP Q 0
    WEAP Q 0 A_JumpIfInventory("Glock 18",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP Q 0 A_JumpIfInventory("Glock 18 Ex Mags",1,"AmmoPickup")
    WEAP Q 0 A_JumpIfInventory("Glock 18 Akimbo",1,"AmmoPickup")
    WEAP Q 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP Q 0 A_JumpIfInventory("MaxWeaponsFilled",90,"FailPickup2")
	WEAP Q 0 A_GiveInventory("MaxWeaponsFilled",11)
    WEAP Q 0 ACS_NamedExecuteWithResult("RefPickU",15,0,0)
    stop
  }
}

actor G18Drop2 : G18Drop
{
  States
  {
  Spawn:
    WEAP Q -1
    stop
  Pickup:
    WEAP Q 0
    WEAP Q 0 A_JumpIfInventory("Glock 18",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP Q 0 A_JumpIfInventory("Glock 18 Ex Mags",1,"AmmoPickup")
    WEAP Q 0 A_JumpIfInventory("Glock 18 Akimbo",1,"AmmoPickup")
    WEAP Q 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP Q 0 A_JumpIfInventory("MaxWeaponsFilled",90,"FailPickup2")
	WEAP Q 0 A_GiveInventory("MaxWeaponsFilled",11)
    WEAP Q 0 ACS_NamedExecuteWithResult("RefPickU",15,0,0)
    stop
  AmmoPickup:
    WEAP Q 0
    stop
  }
}

actor HHCBG18 : HHBullet
{
  damage (random(13,19))
  Speed 300
  States
  {
  Spawn:
    TNT1 A 10
    TNT1 A 5 A_ScaleVelocity(0.67)
    stop
  Death:
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  XDeath:
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 5 A_PlaySound("generic/ricochets")
    stop
  Crash:
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff_2", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  }
}