actor AKRookieMerc : GenericHumanScum 
{

   //----------------------------COMPLEX DOOM COMPATIBILITY DROPS------------------------
  
  DropItem "Stimkit" 60
DropItem "ArmorCharge" 60
DropItem "AmmoPack" 40
DropItem "HandGrenadeAmmo" 100 1
DropItem "MineAmmo" 50 1

  scale 1.0
  obituary "%o helped the AK Rookie Merc to get promotion"
  health 70
  radius 15
  height 54
  mass 100
  speed 10
  Species "Z"
  Translation "112:127=7:12"
  +DOHARMSPECIES
  painchance 190
  SeeSound "StMerc/See"
  PainSound "StMerc/Pain"
  DeathSound "StMerc/Death"
  ActiveSound "StMerc/Active"
  dropitem "Chaingun"
  Tag "AK Rookie Merc"
  MONSTER
  +FLOORCLIP
  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.08, 0.08), scaleY+frandom(-0.08,0.08)) 
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
	TNT1 A 0 A_SpawnItemEx ("BydloWRITER", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION, 69)
  Spawn2:
    SOL1 R 10 A_Look
    loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUStMerc")
	 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 ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_Jump (199, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
    SOL1 AABBCCDD 3 A_Chase
    loop
  CheckReload:
    TNT1 A 0 A_Jump (150, "CheckReload2")
 	Goto SeeLoop+1
  CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	Goto SeeLoop+1
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    SOL1 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))
	    SOL1 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))
	    SOL1 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
	    SOL1 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)) 
	    SOL1 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)) 
	    SOL1 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_JumpIfInventory ("GrenadeCoolDown", 1, 2)
    TNT1 A 0 A_Jump (150, "GranataCheck")
    TNT1 A 0 A_JumpIfTargetInLos ("Missile", 0, JLOSF_DEADNOJUMP )
	Goto SeeLoop
  Missile:
    TNT1 A 0 A_TakeInventory ("GrenadeCoolDown", 1)
    SOL1 E 6 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("CloseQuarters", 0, JLOSF_DEADNOJUMP, 550)
	TNT1 A 0 A_JumpIfTargetInLos ("LongRange", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 1000)
  MissileLoop:
    SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-6,-4))
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (4,6))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-3,3))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_MonsterRefire (40, "SeeLoop")
   Loop
  CloseQuarters:
    SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-6,-4))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-1,1))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (4,6))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-4,4))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
   Goto SeeLoop
  LongRange:
    SOL1 E 20 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-1,-1))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-2,2))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-3,3))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	SOL1 E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	SOL1 F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-4,4))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_JumpIfCloser (850, "SeeLoop")
	TNT1 A 0 A_MonsterRefire (40, "SeeLoop")
   Loop
  GranataCheck:
	TNT1 A 0 
    TNT1 A 0 A_JumpIfTargetInLos ("Granata", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 700, 300)
	Goto MissileCheck+2
  Granata: 
    SOL1 D 7 A_FaceTarget
	TNT1 A 0 A_PlaySound ("GRNTOSS", CHAN_WEAPON)
	SOL1 E 3 A_CustomMissile ("GreenHandGrenade", 42, 0, random (-3,3), CMF_OFFSETPITCH, random (10, 14))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 6)
	Goto SeeLoop  
  Reload:
    SOL1 D 14 A_PlaySound ("AK47REL1")
	TNT1 A 0 A_TakeInventory ("AKShotCounter", 30)
	SOL1 E 35 A_PlaySound ("AK47REL2")
	SOL1 D 25 A_PlaySound ("AK47REL3")
	Goto SeeLoop
  Pain:
    SOL1 H 3
    SOL1 H 3 A_Pain
    goto SeeLoop
  Death:
  	//TNT1 A 0 A_Jump(20, "Suren") 
    FEDP J 5 A_Scream
    FEDP K 5 A_NoBlocking
    FEDP L 5
	FEDP M 5 A_Playsound ("FallingBodyGear", CHAN_BODY)
    FEDP N -1
    stop
  Death2:
	FEDP S 4 A_Scream
	FEDP T 4 A_Noblocking
	FEDP U 4
	FEDP V 4 A_Playsound ("FallingBodyGear", CHAN_BODY)
	FEDP W -1
	Stop	
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    PGIB A 5 A_NoBlocking
    PGIB B 5 A_XScream
	PGIB CD 5
    PGIB E -1
    Stop
  Raise:
    TNT1 A 0 
    TNT1 A 0 A_SpawnItemEx ("NanoResEffect", 0, 0, 15, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
	FEDP NMLKJI 5
   Goto See 	
  Idle:
    SOL1 AA 4 A_Wander
    SOL1 A 0 A_Look
    SOL1 BB 4 A_Wander
    SOL1 A 0 A_Look
    SOL1 CC 4 A_Wander
    SOL1 A 0 A_Look
    SOL1 DD 4 A_Wander
    SOL1 A 0 A_Look
    loop
  }
}
	



	Actor AKRookieMercSpawner : RandomSpawner
		{
		 DropItem AKRookieMerc
		 DropItem AKRookieMercGray
		 DropItem AKRookieMercGreen
		 DropItem AKRookieMercHaki
		 DropItem AKRookieMercBrown
		}




	Actor AKRookieMercGray : AKRookieMerc
		{
		 Translation "112:127=85:111"
		}
		
	
	Actor AKRookieMercGreen : AKRookieMerc
		{
		 Translation "112:127=120:127"
		}
		
	
	Actor AKRookieMercHaki : AKRookieMerc
		{
		 Translation "112:127=7:12"
		}
		
	
	Actor AKRookieMercBrown : AKRookieMerc
		{
		 Translation "112:127=65:79"
		}