ACTOR ShotgunPendeho : GenericHumanScum 
{

  //----------------------------COMPLEX DOOM COMPATIBILITY DROPS------------------------
 	   
	DropItem "HealthFlask" 40
	DropItem "ArmorCharge" 40
	DropItem "AmmoPack" 20
	DropItem "HandGrenadeAmmo" 50 1
	DropItem "MineAmmo" 25 1

  Health 40
  Radius 20
  Height 56
  Mass 100
  Speed 8
  PainChance 170
  Translation "112:127=240:247"
  Monster
  Species "Cartel"
  Tag "Cartel Light Shotgunner"
  +FLOORCLIP
  SeeSound "Cartel/See"
  PainSound "GTS/pain"
  DeathSound "GTS/death"
  ActiveSound "Cartel/active"
  Obituary "%o was too bad for someone's drug-business. Cartel Shotgunner solved this problem"
  DropItem "Shotgun"
  States
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("STFUCheck") == 1, "STFU")
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult ("VanJumpCheck") == 1, "VanJump")
	TNT1 A 0 A_SetScale (scaleX+frandom(-0.02, 0.02), scaleY+frandom(-0.08,0.08))
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
	TNT1 A 0 A_SpawnItemEx ("CartelWRITER", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION, 69)
  Spawn2:
    OTL1 A 10 A_Look
    Loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUCartel")
	 Goto Spawn+2
  VanJump:
	 TNT1 A 0
	 TNT1 A 0  NODELAY ACS_NamedExecuteAlways ("VanillaHeights")
	Goto Spawn+3	 
  See:
     "####" A random(1,5)
	 TNT1 A 0 A_Jump (70, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	 TNT1 A 0 A_Jump (180, "MissileCheck")	
  SeeLoop:
    TNT1 A 0 A_CheckSight ("CheckReload")
    TNT1 A 0 A_JumpIfInventory ("ShotgunShotCounter", 8, "Reload")
	TNT1 A 0 A_Jump (199, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
    OTL1 AABBCCDD 3 A_Chase
    Loop
  CheckReload:
    TNT1 A 0 A_Jump (150, "CheckReload2")
 	Goto SeeLoop+1
  CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("ShotgunShotCounter", 8, "Reload")
	Goto SeeLoop+1
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    OTL1 AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		TNT1 A 0 A_Jump (50, "DodgeRight")
		Goto SeeLoop+1
	DodgeLeftF:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil (random (-8,-3))
	    OTL1 AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
    DodgeLeftB:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil (random (3,8))
	    OTL1 AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
	DodgeRight:
	    TNT1 A 0 A_FaceTarget
	    OTL1 AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
	DodgeRightF:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil ( random (-8,-3)) 
	    OTL1 AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
    DodgeRightB:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil ( random (3,8)) 
	    OTL1 AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
  MissileCheck:
    TNT1 A 0 A_JumpIfTargetInLos ("Missile", 0, JLOSF_DEADNOJUMP)
	Goto SeeLoop	
  Missile:
    TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 8, "Reload") 
    OTL1 E 15 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 1200)
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 25, 0, random (-7,7))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    OTL1 F 10 Bright A_FaceTarget 
    OTL1 E 10 A_FaceTarget
    Goto SeeLoop
  Accuracy:
    OTL1 E 10 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 25, 0, random (-4,4))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    OTL1 F 10 Bright A_FaceTarget 
    OTL1 E 10 A_FaceTarget
    Goto SeeLoop
  Reload:
    OTL1 DE 12 A_PlaySound ("SHOTLOD")
	OTL1 DE 12 A_PlaySound ("SHOTLOD")
	OTL1 DE 12 A_PlaySound ("SHOTLOD")
	TNT1 A 0 A_TakeInventory ("ShotgunShotCounter", 8)
	OTL1 DE 12 A_PlaySound ("SHOTLOD")
	OTL1 DE 12 A_PlaySound ("SHOTLOD")
	OTL1 DE 12 A_PlaySound ("SHOTLOD")
	OTL1 DE 12 A_PlaySound ("SHOTLOD")
	TNT1 A 0 A_Playsound ("SHOTPUMP")
	Goto SeeLoop	
  Pain:
    OTL1 G 3
    OTL1 G 3 A_Pain
    Goto SeeLoop
  Death:
    SHOB H 5
    SHOB I 5 A_Scream
    SHOB J 5 A_NoBlocking
    SHOB K 5 A_Playsound ("FallingBodyLight", CHAN_BODY)
    SHOB L -1
    Stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    SPOS M 5
	SPOS N 5 A_XScream
	SPOS Q 2 A_NoBlocking
	SPOS RST 5
	SPOS U -1
	Stop
    Stop
  Raise:
    TNT1 A 0 
    TNT1 A 0 A_SpawnItemEx ("NanoResEffect", 0, 0, 15, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    OTL1 L 5
    OTL1 KJIH 5
    Goto See
  }
}



	Actor ShotgunPendehoSpawner : RandomSpawner 
		{
		 DropItem ShotgunPendeho
		 DropItem ShotgunPendehoGrey
		 DropItem ShotgunPendehoTan
		 DropItem ShotgunPendehoRed
		 DropItem ShotgunPendehoYellow
		 DropItem ShotgunPendehoDarkGreen
		}


ACTOR ShotgunPendehoGrey : ShotgunPendeho 
{
Translation "192:207=64:75","240:246=76:79","112:127=96:111"
}

Actor ShotgunPendehoTan : ShotgunPendeho 
{
Translation "192:207=96:105","240:246=106:111","112:127=64:79"
}

Actor ShotgunPendehoRed : ShotgunPendeho 
{ 
Translation "192:207=96:105","240:246=106:111","112:127=180:191"
}

Actor ShotgunPendehoYellow : ShotgunPendeho 
{
Translation "112:127=160:167" 
}


Actor ShotgunPendehoDarkGreen : ShotgunPendeho 
{
Translation "112:127=121:127"
}