actor SMGArmouredUnit : GenericHumanScum 
{
  scale 1.0
  obituary "%o was shot multiple times too much by the heavily armoured unknown soldier with SMG"
  health 100
  radius 15
  height 54
  mass 100
  speed 11
  Species "IMP"
+DONTHARMSPECIES
  painchance 160
  SeeSound "ArmorSMG/See"
  PainSound "ArmorSMG/pain"
  DeathSound "ArmorSMG/Death"
  ActiveSound "ArmorSMG/Active"
  Translation "112:127=[128,128,128]:[0,0,0]"
  Tag "SMG Armoured Unit"
  MONSTER
  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)
  Spawn2:
    GSOL A 10 A_Look
    loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUArmorSMG")
	 Goto Spawn+2
  VanJump:
	 TNT1 A 0
	 TNT1 A 0  NODELAY ACS_NamedExecuteAlways ("VanillaHeights")
	Goto Spawn+3	 
  See:
     "####" A random(1,4)
	 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_Jump (170, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
    GSOL AABBCCDD 3 A_Chase
    loop
  MissileCheck:
	TNT1 A 0 A_JumpIfInventory ("GrenadeCoolDown", 1, 2)
    TNT1 A 0 A_Jump (125, "GranataCheck")
    TNT1 A 0 A_JumpIfInTargetLos ("DodgeChoice", 50, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 0, 700)
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 50, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 750)
	Goto SeeLoop
  DodgeChoice:
    TNT1 A 0 A_Jump (190, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeRightF", "DodgeRightB")
	Goto ReturnFire
    CheckReload:
    TNT1 A 0 A_Jump (150, "CheckReload2")
 	Goto SeeLoop+1
  CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	Goto SeeLoop+1
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    GSOL AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (120, "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))
	    GSOL AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (120, "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))
	    GSOL AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (120, "MissileCheck")
		Goto SeeLoop+1
	DodgeRight:
	    TNT1 A 0 A_FaceTarget
	    GSOL AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "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)) 
	    GSOL AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "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)) 
	    GSOL AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "MissileCheck")
		Goto SeeLoop+1			
   Retreat:
    TNT1 A 0 A_Changeflag ("FRIGHTENED", 1)
	TNT1 A 0 A_ChangeFlag ("Missilemore", 1)
	TNT1 A 0 A_ChangeFlag ("MissileEvenMore", 1)  
	Goto SeeLoop+1	
  Missile:
	TNT1 A 0 A_TakeInventory ("GrenadeCoolDown", 1)
	TNT1 A 0 A_Changeflag ("FRIGHTENED", false)
    TNT1 A 0 A_TakeInventory ("AccuracyCounter", 5)
    TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800)
	TNT1 A 0 A_JumpIfCloser (425, "Supress")
    GSOL E 12 A_FaceTarget
  MissileLoop:
    GSOL E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800)
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-3,3))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    GSOL E 1 A_MonsterRefire (40, "SeeLoop")
	goto MissileLoop+1
  Supress:
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-6,-3))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9, random (-4,-1))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9)
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (1,4))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (3,6))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (1,4))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9)
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-4,-1))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-6,-3))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	Goto SeeLoop
  Accuracy:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 5, "SeeLoop")
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
    GSOL E 4 A_FaceTarget
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 Bright A_CustomMissile ("SMGTracer",32,9, random (-1,1))
	TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 5, "SeeLoop")
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	TNT1 A 0 A_GiveInventory ("AccuracyCounter", 1)
	GSOL E 1 A_MonsterRefire (40, "SeeLoop")
	Loop
  ReturnFire:
	GSOL E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-5,5))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-5,5))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	GSOL E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 30, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	GSOL F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-5,5))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    GSOL E 1 A_FaceTarget
	Goto SeeLoop
  Reload:
    TNT1 A 0 A_JumpIfCloser (620, "RetreatingGrenade")
    GSOL E 18 A_PlaySound ("SMGOUT")
	TNT1 A 0 A_TakeInventory ("SMGShotCounter", 30)
	GSOL D 22 A_PlaySound ("SMGIN")
	GSOL E 10 A_PlaySound ("SMGCOCK")
	TNT1 A 0 A_JumpIfCloser (450, "MissileCheck2")	
	Goto SeeLoop
  MissileCheck2:
    TNT1 A 0 A_JumpIfTargetInLos ("Missile")
	Goto SeeLoop
  GranataCheck:
	TNT1 A 0 
    TNT1 A 0 A_JumpIfTargetInLos ("Granata", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 700, 300)
	Goto MissileCheck+2
  Granata:
    //TNT1 A 0 A_Print ("Granata")
    GSOL D 10 A_FaceTarget
	TNT1 A 0 A_PlaySound ("GRNTOSS", CHAN_WEAPON)
	GSOL E 8 A_CustomMissile ("GreenHandGrenade", 42, 0, random (-3,3), CMF_OFFSETPITCH, random (10, 15))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 3)
	Goto SeeLoop
  RetreatingGrenade:
	GSOL D 7 A_FaceTarget
	TNT1 A 0 A_PlaySound ("GRNTOSS", CHAN_WEAPON)
	GSOL E 8 A_CustomMissile ("GreenHandGrenade", 42, 0, random (-6,6), CMF_OFFSETPITCH, random (10, 15))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 1)
  Retreating:
    TNT1 A 0 A_ChangeFlag ("FRIGHTENED", true) 
    GSOL ABCDABCDABCDABCDABCDABCDABCDABCDABCD 2 A_Chase	
 ReloadReady:
    TNT1 A 0 A_ChangeFlag ("FRIGHTENED", false)
	Goto ReloadBrave
 ReloadBrave:
    GSOL E 18 A_PlaySound ("SMGOUT")
	TNT1 A 0 A_TakeInventory ("SMGShotCounter", 30)
	GSOL D 22 A_PlaySound ("SMGIN")
	GSOL E 10 A_PlaySound ("SMGCOCK")
	TNT1 A 0 A_JumpIfCloser (450, "MissileCheck2")	
	Goto SeeLoop	
  Pain:
    GSOL G 3
    GSOL G 3 A_Pain
    goto SeeLoop
  Death:
    GSOL H 5 A_Scream
    GSOL IJ 2
    GSOL K 5 A_NoBlocking
    GSOL L 5
	GSOL M 5 A_Playsound ("FallingBodyGear", CHAN_BODY)
    GSOL N -1
    stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    GSOL U 5 A_XScream
    GSOL V 5 
    PGIB A 5 A_NoBlocking
    PGIB BCD 5
    PGIB E -1
    Stop
Raise:
    TNT1 A 0 
	TNT1 A 0 A_SpawnItemEx ("NanoResEffect", 0, 0, 15, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
	GSOL NMLKIJH 5
   Goto See	
  Idle:
    GSOL AA 4 A_Wander
    GSOL A 0 A_Look
    GSOL BB 4 A_Wander
    GSOL A 0 A_Look
    GSOL CC 4 A_Wander
    GSOL A 0 A_Look
    GSOL DD 4 A_Wander
    GSOL A 0 A_Look
    loop
  }
}



	