actor "Sears Ranger" : RGUWeapon
{
  obituary "%k blew %o away with the Ranger."
  inventory.pickupmessage "You got the Sears Ranger sawed-off shotgun."
  //attacksound "ranger/fire"
  weapon.selectionorder 7
  weapon.ammotype "RangerClip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "RangerAmmo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  -NOAUTOFIRE
  states
  {
  Ready:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    RNGA A 2 A_PlaySoundEx("weapon/draw","SoundSlot5")
    RNGA BCDEFG 2 A_WeaponReady(WRF_ALLOWZOOM)
    RNGA HIJ 3 A_WeaponReady(WRF_ALLOWZOOM)
    RNGA K 0 A_JumpIfNoAmmo("Reload")
    RNGA K 0 A_JumpIfInventory("Reloading",1,"Reload")
    RNGA K 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    RNGA K 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	RNGA K 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    RNGA K 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+12
  Deselect:
    RNGA K 0 A_PlaySoundEx("weapon/down","SoundSlot5")
    RNGA K 0 A_TakeInventory("Aiming",1)
    RNGA K 0 A_TakeInventory("Reloading",1)
    RNGA K 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    RNGA K 0 A_ZoomFactor(1.0)
    RNGA K 0 A_Lower
    RNGA K 1 A_Lower
    Goto Deselect+5
  Select:
    RNGA A 0 A_Raise
    Loop
  FireOne:
    RNGB A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"FireOne_SteadyAim")
    RNGB A 0 A_PlayWeaponSound("ranger/fire")
    RNGB A 0 A_TakeInventory("RangerClip",1)
	Goto Fire+4
  Fire:
    RNGC I 0 A_TakeInventory("RangerToken2",1)
    RNGA K 1 A_JumpIfNoAmmo("ReloadStart")
    RNGB A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    RNGB A 0 A_PlayWeaponSound("ranger/fire")
    RNGB A 0 A_JumpIfInventory("RangerClip",2,"FireTwo")
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,7,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,11,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,15,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,11,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-7.00,7.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-7.00,7.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-7.00,7.00))
  FireCont:
    RNGB A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    RNGB B 1 BRIGHT A_GunFlash
    RNGB CDE 1 BRIGHT
    RNGB E 0 A_JumpIfInventory("RangerAmmo",1,4)
    RNGB FGH 1 A_ReFire
    Goto Ready+12
    RNGB E 0 A_JumpIfInventory("RangerClip",1,1)
	Goto ReloadStart
    RNGB FGH 1 A_ReFire
    Goto Ready+12
  FireTwo:
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,3,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,7,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,11,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,7,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-7.00,7.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-7.00,7.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-7.00,7.00))
	Goto FireCont
  Zoom:
  AltFire:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    RNGC I 0 A_TakeInventory("RangerToken2",1)
    RNGA K 1 A_JumpIfInventory("RangerClip",2,3)
    RNGA K 1 A_JumpIfInventory("RangerClip",1,"FireOne")
    RNGA K 1 A_JumpIfInventory("RangerAmmo",1,"Reload")
    Goto Ready+12
    RNGB A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"AltFire_SteadyAim")
    RNGB A 0 A_PlayWeaponSound("ranger/fires")
    RNGB A 0 A_TakeInventory("RangerClip",1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,3,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,7,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,11,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,7,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-9.00,9.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-9.00,9.00))
    RNGB A 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-9.00,9.00))
    RNGB A 0 A_TakeInventory("RangerClip",1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,7,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,11,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,15,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,11,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-9.00,9.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-9.00,9.00))
    RNGB A 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-9.00,9.00))
    RNGB BB 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    RNGB B 2 BRIGHT A_GunFlash
    RNGB CDE 1 BRIGHT
    RNGB E 0 A_JumpIfInventory("RangerAmmo",1,4)
    RNGB FGH 1 A_ReFire
    Goto Ready+12
    RNGB FGH 1 A_ReFire
    Goto Reload
  Hold:
    RNGA K 2
    RNGA K 1 A_ReFire
    Goto Ready+12
  Reload:
    RNGB A 0 A_JumpIfInventory("RangerClip",2,2)
    RNGB A 0 A_JumpIfInventory("RangerAmmo",1,"ReloadStart")
    RNGB A 0 A_TakeInventory("Reloading",1)
    Goto Ready+14
  ReloadStart:
    RNGC A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
	RNGC A 0 A_JumpIfInventory("RangerToken",1,"Reload2")
	RNGC A 0 A_JumpIfInventory("RangerToken2",1,"Reload3")
    RNGC A 3 A_PlaySoundEx("ranger/open","SoundSlot5")
    RNGC BCD 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC E 0 A_JumpIfInventory("RangerAmmo",2,1)
	Goto ReloadStartSingle
    RNGC E 3 A_JumpIfInventory("RangerClip",1,"ReloadStartSingle")
	RNGC E 0 A_SpawnItemEx("ShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC A 0 A_JumpIfInventory("RangerToken3",1,"OneShell")
	RNGC E 0 A_SpawnItemEx("ShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
  OneShell:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
	RNGC E 0 A_GiveInventory("RangerToken",1)
    RNGC FG 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC HI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    RNGC JKLM 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC O 3 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC O 0 A_TakeInventory("Reloading",1)
    Goto ReloadAmmo
  ReloadAmmo:
    RNGC O 0 A_JumpIfInventory("RangerClip",1,"ReloadStart2")
    RNGC O 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadStart2
    RNGC O 0 A_GiveInventory("RangerClip",1)
    RNGC O 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
    Goto ReloadAmmo
  ReloadStart2:
    RNGC PQRS 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC T 3 A_PlaySoundEx("ranger/in","SoundSlot5")
    Goto ReloadAmmo2
  ReloadAmmo2:
    RNGC I 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd")
    RNGC I 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd
    RNGC I 0 A_GiveInventory("RangerClip",1)
    RNGC I 0 A_TakeInventory("RangerAmmo",1)
    Goto ReloadAmmo2
  ReloadStartSingle:
    RNGC E 0 A_SpawnItemEx("ShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC E 0 A_GiveInventory("RangerToken2",1)
	RNGC E 0 A_GiveInventory("RangerToken3",1)
    RNGE EFGH 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	goto Reload3
  Reload3:
    RNGE JK 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC PQ 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC R 3 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC T 3 A_TakeInventory("Reloading",1)
    Goto ReloadAmmoSingle
  ReloadAmmoSingle:
    RNGC T 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd")
    RNGC T 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd
    RNGC T 0 A_GiveInventory("RangerClip",1)
    RNGC T 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
	RNGC I 0 A_TakeInventory("RangerToken2",1)
  ReloadEnd:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
    RNGC UWXY 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC Z 3
    RNGD A 0 A_PlaySoundEx("ranger/close","SoundSlot5")
    RNGD ABC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGD C 0 A_ReFire
    Goto Ready+12
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP U 0
    WEAP U 0 A_SpawnItem("RangerDrop")
    stop
  ReloadStart_SOH:
    RNGC A 0 A_JumpIfInventory("RangerToken",1,"Reload4")
	RNGC A 0 A_JumpIfInventory("RangerToken2",1,"Reload5")
    RNGC A 2 A_PlaySoundEx("ranger/open","SoundSlot5")
    RNGC BCD 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC E 0 A_JumpIfInventory("RangerAmmo",2,1)
	Goto ReloadStartSingle_SOH
    RNGC E 2 A_JumpIfInventory("RangerClip",1,"ReloadStartSingle_SOH")
	RNGC E 0 A_SpawnItemEx("ShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC A 0 A_JumpIfInventory("RangerToken3",1,"OneShell2")
	RNGC E 0 A_SpawnItemEx("ShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
  OneShell2:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
	RNGC E 0 A_GiveInventory("RangerToken",1)
    RNGC FG 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC HI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    RNGC JKLM 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC O 2 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC O 0 A_TakeInventory("Reloading",1)
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    RNGC O 0 A_JumpIfInventory("RangerClip",1,"ReloadStart2_SOH")
    RNGC O 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadStart2_SOH
    RNGC O 0 A_GiveInventory("RangerClip",1)
    RNGC O 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
    Goto ReloadAmmo_SOH
  ReloadStart2_SOH:
    RNGC PQRS 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC T 2 A_PlaySoundEx("ranger/in","SoundSlot5")
    Goto ReloadAmmo2_SOH
  ReloadAmmo2_SOH:
    RNGC T 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd_SOH")
    RNGC T 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd_SOH
    RNGC T 0 A_GiveInventory("RangerClip",1)
    RNGC T 0 A_TakeInventory("RangerAmmo",1)
    Goto ReloadAmmo2_SOH
  ReloadStartSingle_SOH:
    RNGC E 0 A_SpawnItemEx("ShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC E 0 A_GiveInventory("RangerToken2",1)
	RNGC E 0 A_GiveInventory("RangerToken3",1)
    RNGE EFGH 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	goto Reload5
  Reload5:
    RNGE JK 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC PQ 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC R 2 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC T 2 A_TakeInventory("Reloading",1)
    Goto ReloadAmmoSingle_SOH
  ReloadAmmoSingle_SOH:
    RNGC T 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd_SOH")
    RNGC T 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd_SOH
    RNGC T 0 A_GiveInventory("RangerClip",1)
    RNGC T 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
	RNGC I 0 A_TakeInventory("RangerToken2",1)
  ReloadEnd_SOH:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
    RNGC UWXY 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC Z 2 A_PlaySoundEx("ranger/close","SoundSlot5")
    RNGD ABC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGD C 0 A_ReFire
    Goto Ready+12
  FireOne_SteadyAim:
    RNGB A 0 A_PlayWeaponSound("ranger/fire")
    RNGB A 0 A_TakeInventory("RangerClip",1)
	Goto Fire_SteadyAim+2
  Fire_SteadyAim:
    RNGB A 0 A_PlayWeaponSound("ranger/fire")
    RNGB A 0 A_JumpIfInventory("RangerClip",2,"FireTwo_SteadyAim")
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,7,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,11,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,15,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,11,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-6.00,6.00), 0, 0, 4, 0, frandom(-5.00,5.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-6.00,6.00), 0, 0, 4, 0, frandom(-5.00,5.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-5.00,5.00))
  FireCont_SteadyAim:
    RNGB A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    RNGB B 1 BRIGHT A_GunFlash
    RNGB CDE 1 BRIGHT
    RNGB E 0 A_JumpIfInventory("RangerAmmo",1,4)
    RNGB FGH 1 A_ReFire
    Goto Ready+12
    RNGB E 0 A_JumpIfInventory("RangerClip",1,1)
	Goto ReloadStart
    RNGB FGH 1 A_ReFire
    Goto Ready+12
  FireTwo_SteadyAim:
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,3,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,7,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,11,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,7,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-6.00,6.00), 0, 0, 4, 0, frandom(-5.00,5.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-6.00,6.00), 0, 0, 4, 0, frandom(-5.00,5.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER2", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-5.00,5.00))
	Goto FireCont_SteadyAim
  AltFire_SteadyAim:
    RNGB A 0 A_PlayWeaponSound("ranger/fires")
    RNGB A 0 A_TakeInventory("RangerClip",1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,3,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,7,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,11,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,7,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
    RNGB A 0 A_TakeInventory("RangerClip",1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,7,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,11,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,15,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,11,2)
    RNGB AAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB AAAAAAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB A 0 BRIGHT A_FireCustomMissile("HHCBRANGER3", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
    RNGB BB 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    RNGB B 2 BRIGHT A_GunFlash
    RNGB CDE 1 BRIGHT
    RNGB E 0 A_JumpIfInventory("RangerAmmo",1,4)
    RNGB FGH 1 A_ReFire
    Goto Ready+12
    RNGB FGH 1 A_ReFire
    Goto Reload
  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:
    RNGA JIHGFEDCB 2 A_WeaponReady(WRF_NOPRIMARY)
	RNGA 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("RangerDropped",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("RangerThrown",0,0,7,2)
  }
}

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

actor "Sears Ranger Dragon" : "Sears Ranger"
{
  obituary "%k toasted %o with the Ranger."
  inventory.pickupmessage "You got the Sears Ranger sawed-off shotgun."
  //attacksound "ranger/fire"
  weapon.selectionorder 7
  weapon.ammotype "RangerClip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "RangerAmmo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  -NOAUTOFIRE
  states
  {
  FireOne:
    RNGB A 0 A_PlayWeaponSound("ranger/fire")
    RNGB A 0 A_PlaySound("dragon/fire")
    RNGB A 0 A_TakeInventory("RangerClip",1)
	Goto Fire+4
  Fire:
    RNGC I 0 A_TakeInventory("RangerToken2",1)
    RNGA K 1 A_JumpIfNoAmmo("ReloadStart")
    RNGB A 0 A_PlayWeaponSound("ranger/fire")
    RNGB A 0 A_PlaySound("dragon/fire")
    RNGB A 0 A_JumpIfInventory("RangerClip",2,"FireTwo")
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,7,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,11,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,15,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,11,2)
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFire3",frandom(-11.00,13.00),0,11,random(-2,4),0,frandom(-8.00,9.00))
    RNGB AAAAAA 0 A_FireCustomMissile("FlameThrowerFire",frandom(-12.00,14.00),0,11,random(-3,5),0,frandom(-9.00,10.00))
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFire2",frandom(-12.00,14.00),0,11,random(-3,5),0,frandom(-9.00,10.00))
    RNGB AAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1D", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-6.00,6.00))
    RNGB AA 0 BRIGHT A_FireCustomMissile("HHCBRANGER2D", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-6.00,6.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER2D", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-6.00,6.00))
  FireCont:
    RNGB A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    RNGB B 1 BRIGHT A_GunFlash
    RNGB CDE 1 BRIGHT
    RNGB E 0 A_JumpIfInventory("RangerAmmo",1,4)
    RNGB FGH 1 A_ReFire
    Goto Ready+12
    RNGB E 0 A_JumpIfInventory("RangerClip",1,1)
	Goto ReloadStart
    RNGB FGH 1 A_ReFire
    Goto Ready+12
  FireTwo:
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,3,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,7,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,11,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,7,2)
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFire3",frandom(-11.00,13.00),0,7,random(-2,4),0,frandom(-8.00,9.00))
    RNGB AAAAAA 0 A_FireCustomMissile("FlameThrowerFire",frandom(-12.00,14.00),0,7,random(-3,5),0,frandom(-9.00,10.00))
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFire2",frandom(-12.00,14.00),0,7,random(-3,5),0,frandom(-9.00,10.00))
    RNGB AAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1D", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-6.00,6.00))
    RNGB AA 0 BRIGHT A_FireCustomMissile("HHCBRANGER2D", frandom(-8.00,8.00), 0, 0, 4, 0, frandom(-6.00,6.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER2D", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	Goto FireCont
  Zoom:
  AltFire:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    RNGC I 0 A_TakeInventory("RangerToken2",1)
    RNGA K 1 A_JumpIfInventory("RangerClip",2,3)
    RNGA K 1 A_JumpIfInventory("RangerClip",1,"FireOne")
    RNGA K 1 A_JumpIfInventory("RangerAmmo",1,"Reload")
    Goto Ready+12
    RNGB A 0 A_PlayWeaponSound("ranger/fires")
    RNGB A 0 A_PlaySound("dragon/fire")
    RNGB A 0 A_TakeInventory("RangerClip",1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,3,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,7,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,11,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,7,2)
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFire3",frandom(-15.00,17.00),0,7,random(-2,4),0,frandom(-10.00,11.00))
    RNGB AAAAAA 0 A_FireCustomMissile("FlameThrowerFire",frandom(-16.00,18.00),0,7,random(-3,5),0,frandom(-11.00,12.00))
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFire2",frandom(-16.00,18.00),0,7,random(-3,5),0,frandom(-11.00,12.00))
    RNGB AAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1D", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB AA 0 BRIGHT A_FireCustomMissile("HHCBRANGER3D", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB A 2 BRIGHT A_FireCustomMissile("HHCBRANGER3D", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-8.00,8.00))
    RNGB A 0 A_PlaySound("dragon/fire")
    RNGB A 0 A_TakeInventory("RangerClip",1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",3,0,7,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,11,2)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuffShotgun",-3,0,15,-1)
    RNGB A 0 A_FireCustomMissile("WeaponSmokePuff_ShotMuzzle",0,0,11,2)
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFireLight3",frandom(-15.00,17.00),0,11,random(-2,4),0,frandom(-10.00,11.00))
    RNGB AAAAAA 0 A_FireCustomMissile("FlameThrowerFireLight",frandom(-16.00,18.00),0,11,random(-3,5),0,frandom(-11.00,12.00))
    RNGB AAAA 0 A_FireCustomMissile("FlameThrowerFireLight2",frandom(-16.00,18.00),0,11,random(-3,5),0,frandom(-11.00,12.00))
    RNGB AAA 0 BRIGHT A_FireCustomMissile("HHCBRANGER1D", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB AA 0 BRIGHT A_FireCustomMissile("HHCBRANGER3D", frandom(-9.00,9.00), 0, 0, 4, 0, frandom(-8.00,8.00))
    RNGB A 0 BRIGHT A_FireCustomMissile("HHCBRANGER3D", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-8.00,8.00))
    RNGB BB 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    RNGB B 2 BRIGHT A_GunFlash
    RNGB CDE 1 BRIGHT
    RNGB E 0 A_JumpIfInventory("RangerAmmo",1,4)
    RNGB FGH 1 A_ReFire
    Goto Ready+12
    RNGB FGH 1 A_ReFire
    Goto Reload
  Reload:
    RNGB A 0 A_JumpIfInventory("RangerClip",2,2)
    RNGB A 0 A_JumpIfInventory("RangerAmmo",1,"ReloadStart")
    RNGB A 0 A_TakeInventory("Reloading",1)
    Goto Ready+14
  ReloadStart:
    RNGC A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
	RNGC A 0 A_JumpIfInventory("RangerToken",1,"Reload2")
	RNGC A 0 A_JumpIfInventory("RangerToken2",1,"Reload3")
    RNGC A 3 A_PlaySoundEx("ranger/open","SoundSlot5")
    RNGC BCD 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC E 0 A_JumpIfInventory("RangerAmmo",2,1)
	Goto ReloadStartSingle
    RNGC E 3 A_JumpIfInventory("RangerClip",1,"ReloadStartSingle")
	RNGC E 0 A_SpawnItemEx("OrangeShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC A 0 A_JumpIfInventory("RangerToken3",1,"OneShell")
	RNGC E 0 A_SpawnItemEx("OrangeShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
  OneShell:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
	RNGC E 0 A_GiveInventory("RangerToken",1)
    RNGC FG 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC HI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    RNGC JKLM 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC O 3 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC O 0 A_TakeInventory("Reloading",1)
    Goto ReloadAmmo
  ReloadAmmo:
    RNGC O 0 A_JumpIfInventory("RangerClip",1,"ReloadStart2")
    RNGC O 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadStart2
    RNGC O 0 A_GiveInventory("RangerClip",1)
    RNGC O 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
    Goto ReloadAmmo
  ReloadStart2:
    RNGC PQRS 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC T 3 A_PlaySoundEx("ranger/in","SoundSlot5")
    Goto ReloadAmmo2
  ReloadAmmo2:
    RNGC I 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd")
    RNGC I 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd
    RNGC I 0 A_GiveInventory("RangerClip",1)
    RNGC I 0 A_TakeInventory("RangerAmmo",1)
    Goto ReloadAmmo2
  ReloadStartSingle:
    RNGC E 0 A_SpawnItemEx("OrangeShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC E 0 A_GiveInventory("RangerToken2",1)
	RNGC E 0 A_GiveInventory("RangerToken3",1)
    RNGE EFGH 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	goto Reload3
  Reload3:
    RNGE JK 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC PQ 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC R 3 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC T 3 A_TakeInventory("Reloading",1)
    Goto ReloadAmmoSingle
  ReloadAmmoSingle:
    RNGC T 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd")
    RNGC T 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd
    RNGC T 0 A_GiveInventory("RangerClip",1)
    RNGC T 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
	RNGC I 0 A_TakeInventory("RangerToken2",1)
  ReloadEnd:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
    RNGC UWXY 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC Z 3
    RNGD A 0 A_PlaySoundEx("ranger/close","SoundSlot5")
    RNGD ABC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGD C 0 A_ReFire
    Goto Ready+12
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP U 0
    WEAP U 0 A_SpawnItem("RangerDrop")
    stop
  ReloadStart_SOH:
    RNGC A 0 A_JumpIfInventory("RangerToken",1,"Reload4")
	RNGC A 0 A_JumpIfInventory("RangerToken2",1,"Reload5")
    RNGC A 2 A_PlaySoundEx("ranger/open","SoundSlot5")
    RNGC BCD 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC E 0 A_JumpIfInventory("RangerAmmo",2,1)
	Goto ReloadStartSingle_SOH
    RNGC E 2 A_JumpIfInventory("RangerClip",1,"ReloadStartSingle_SOH")
	RNGC E 0 A_SpawnItemEx("OrangeShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC A 0 A_JumpIfInventory("RangerToken3",1,"OneShell2")
	RNGC E 0 A_SpawnItemEx("OrangeShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
  OneShell2:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
	RNGC E 0 A_GiveInventory("RangerToken",1)
    RNGC FG 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC HI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    RNGC JKLM 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC O 2 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC O 0 A_TakeInventory("Reloading",1)
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    RNGC O 0 A_JumpIfInventory("RangerClip",1,"ReloadStart2_SOH")
    RNGC O 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadStart2_SOH
    RNGC O 0 A_GiveInventory("RangerClip",1)
    RNGC O 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
    Goto ReloadAmmo_SOH
  ReloadStart2_SOH:
    RNGC PQRS 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGC T 2 A_PlaySoundEx("ranger/in","SoundSlot5")
    Goto ReloadAmmo2_SOH
  ReloadAmmo2_SOH:
    RNGC T 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd_SOH")
    RNGC T 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd_SOH
    RNGC T 0 A_GiveInventory("RangerClip",1)
    RNGC T 0 A_TakeInventory("RangerAmmo",1)
    Goto ReloadAmmo2_SOH
  ReloadStartSingle_SOH:
    RNGC E 0 A_SpawnItemEx("OrangeShellCasing",Cos(Pitch)*-30,-2,35-(Sin(Pitch)*-5),Cos(Pitch)*FRandom(-2,-4),FRandom(3,6),-Sin(Pitch)*FRandom(-1,-2),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
	RNGC E 0 A_GiveInventory("RangerToken2",1)
	RNGC E 0 A_GiveInventory("RangerToken3",1)
    RNGE EFGH 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	goto Reload5
  Reload5:
    RNGE JK 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC PQ 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC R 2 A_PlaySoundEx("ranger/in","SoundSlot5")
    RNGC T 2 A_TakeInventory("Reloading",1)
    Goto ReloadAmmoSingle_SOH
  ReloadAmmoSingle_SOH:
    RNGC T 0 A_JumpIfInventory("RangerClip",2,"ReloadEnd_SOH")
    RNGC T 0 A_JumpIfInventory("RangerAmmo",1,1)
    Goto ReloadEnd_SOH
    RNGC T 0 A_GiveInventory("RangerClip",1)
    RNGC T 0 A_TakeInventory("RangerAmmo",1)
	RNGC I 0 A_TakeInventory("RangerToken",1)
	RNGC I 0 A_TakeInventory("RangerToken2",1)
  ReloadEnd_SOH:
    RNGC I 0 A_TakeInventory("RangerToken3",1)
    RNGC UWXY 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    RNGC Z 2 A_PlaySoundEx("ranger/close","SoundSlot5")
    RNGD ABC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    RNGD C 0 A_ReFire
    Goto Ready+12
  }
}
actor RangerDragon : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}

actor RangerPickup : CustomInventory
{
  inventory.pickupmessage "You got the Sears Ranger sawed-off shotgun."
  inventory.pickupsound "spas/pump"
  +INVENTORY.AUTOACTIVATE
  //inventory.respawntics 70
  scale 0.12
  States
  {
  Spawn:
    WEAP U -1
    stop
  Pickup:
    WEAP U 0
    WEAP U 0 A_JumpIf((ACS_NamedExecuteWithResult("RefCheckVar",0,0,0)) == 1, "PickupStay")
    WEAP U 0 A_JumpIfInventory("Sears Ranger",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP U 0 A_JumpIfInventory("Sears Ranger Dragon",1,"AmmoPickup")
    WEAP U 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP U 0 A_JumpIfInventory("MaxWeaponsFilled",84,"FailPickup2")
	WEAP U 0 A_GiveInventory("MaxWeaponsFilled",17)
    WEAP U 0 ACS_NamedExecuteWithResult("RefPickU",19,0,0)
    stop
  PickupStay:
    WEAP U 0
    WEAP U 0 A_JumpIfInventory("Sears Ranger",1,"FailPickup") // If the player already has this weapon, they get more ammo for it
    WEAP U 0 A_JumpIfInventory("Sears Ranger Dragon",1,"FailPickup")
    WEAP U 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP U 0 A_JumpIfInventory("MaxWeaponsFilled",84,"FailPickup2")
	WEAP U 0 A_GiveInventory("MaxWeaponsFilled",17)
    WEAP U 0 ACS_NamedExecuteWithResult("RefPickU",19,0,0)
    WEAP U 0 ACS_NamedExecuteWithResult("RefPickC",19,0,0)
    WEAP U 0 A_PlaySound("spas/pump")
    fail
  AmmoPickup:
    WEAP U 0
    WEAP U 0 A_JumpIfInventory("RangerAmmo",0,"FailPickup")
    WEAP U 0 A_GiveInventory("RangerAmmo",8)
    stop
  OneManArmy:
    WEAP U 0
	WEAP U 0 A_JumpIfInventory("MaxWeaponsFilled",121,"FailPickup2")
	WEAP U 0 A_GiveInventory("MaxWeaponsFilled",17)
	WEAP U 0 ACS_NamedExecuteWithResult("RefPickU",19,0,0)
	stop
  FailPickup:
    WEAP U 1
    fail
  FailPickup2:
    WEAP U 1
    WEAP U 0 ACS_NamedExecuteAlways("RefSlots",0,12,0,0)
    fail
  }
}

actor RangerDrop : RangerPickup
{
  States
  {
  Spawn:
    WEAP U -1
    stop
  Pickup:
    WEAP U 0
    WEAP U 0 A_JumpIfInventory("Sears Ranger",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP U 0 A_JumpIfInventory("Sears Ranger Dragon",1,"AmmoPickup")
    WEAP U 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP U 0 A_JumpIfInventory("MaxWeaponsFilled",84,"FailPickup2")
	WEAP U 0 A_GiveInventory("MaxWeaponsFilled",17)
    WEAP U 0 ACS_NamedExecuteWithResult("RefPickU",19,0,0)
    stop
  }
}

actor RangerDrop2 : RangerDrop
{
  States
  {
  Spawn:
    WEAP U -1
    stop
  Pickup:
    WEAP U 0
    WEAP U 0 A_JumpIfInventory("Sears Ranger",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP U 0 A_JumpIfInventory("Sears Ranger Dragon",1,"AmmoPickup")
    WEAP U 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP U 0 A_JumpIfInventory("MaxWeaponsFilled",84,"FailPickup2")
	WEAP U 0 A_GiveInventory("MaxWeaponsFilled",17)
    WEAP U 0 ACS_NamedExecuteWithResult("RefPickU",19,0,0)
    stop
  AmmoPickup:
    WEAP U 0
    stop
  }
}

actor HHCBRANGER1 : HHBullet
{
  damage (random(12,16))
  Speed 200
  decal none
  damagetype "Shotgungib"
  -NOEXTREMEDEATH
  states
  {
  Spawn:
    TNT1 A 1
    TNT1 A 1 A_ScaleVelocity(0.8)
    stop
  Death:
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff_2", 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_Jump(48,2)
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff_3", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  }
}
actor HHCBRANGER2 : HHCBRANGER1
{
  damage (random(12,16))
  Speed 200
  decal ShotChip
  damagetype "Shotgun"
  +NOEXTREMEDEATH
  states
  {
  Spawn:
    TNT1 A 7
    TNT1 A 2 A_ScaleVelocity(0.75)
    stop
  Death:
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff_2", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  XDeath:
	//TNT1 A 0 A_Jump(176,2)
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 5 A_PlaySound("generic/ricochets")
    stop
  Crash:
	//TNT1 A 0 A_Jump(176,2)
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
	TNT1 A 0 A_Jump(48,2)
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff_3", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  }
}
actor HHCBRANGER3 : HHCBRANGER2
{
  damage (random(12,18))
  damagetype "Shotgungib"
  -NOEXTREMEDEATH
}

actor HHCBRANGER1D : HHBullet
{
  damage (random(10,14))
  Speed 200
  decal none
  +FORCERADIUSDMG
  damagetype "Dragon"
  states
  {
  Spawn:
    TNT1 A 1
    TNT1 A 2 A_ScaleVelocity(0.75)
    stop
  Death:
    TNT1 A 0 A_SpawnItemEx("FireballPuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 0 A_PlaySound("generic/ricochet")
    TNT1 AA 12 A_Explode(2,32,0)
    stop
  XDeath:
	//TNT1 A 0 A_Jump(144,2)
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 0 A_SpawnItemEx("FireballPuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
	TNT1 A 0 A_Jump(32,2)
    TNT1 A 0 A_PlaySound("generic/ricochets")
    TNT1 AA 12 A_Explode(2,32,0)
    stop
  Crash:
	//TNT1 A 0 A_Jump(144,2)
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 0 A_SpawnItemEx("FireballPuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 0 A_PlaySound("generic/ricochet")
    TNT1 AA 12 A_Explode(2,32,0)
    stop
  }
}
actor HHCBRANGER2D : HHCBRANGER1D
{
  damage (random(10,14))
  Speed 200
  decal none
  +FORCERADIUSDMG
  damagetype "Dragon"
  states
  {
  Spawn:
    TNT1 A 5
    stop
  Death:
    TNT1 A 0 A_SpawnItemEx("FireballPuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 0 A_PlaySound("generic/ricochet")
    TNT1 AA 12 A_Explode(2,32,0)
    stop
  XDeath:
	//TNT1 A 0 A_Jump(144,2)
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 0 A_SpawnItemEx("FireballPuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
	TNT1 A 0 A_Jump(32,2)
    TNT1 A 0 A_PlaySound("generic/ricochets")
    TNT1 AA 12 A_Explode(2,32,0)
    stop
  Crash:
	//TNT1 A 0 A_Jump(144,2)
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 0 A_SpawnItemEx("FireballPuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 0 A_PlaySound("generic/ricochet")
    TNT1 AA 12 A_Explode(2,32,0)
    stop
  }
}
actor HHCBRANGER3D : HHCBRANGER2D
{
  damage (random(10,18))
}