actor TerSMG : GenericHumanScum 
{
  scale 1.0
  obituary "%o was terrorised by the UZI terrorist"
  health 75
  radius 15
  height 54
  mass 100
  speed 11
  Damage 1
  Species "IMP"
+DONTHARMSPECIES
  painchance 200
  SeeSound "Arab/See"
  PainSound "Arab/pain"
  DeathSound "Arab/Death"
  ActiveSound "Arab/Active"
  Translation "112:127=64:79", "192:207=96:111"
  Tag "UZI nine millimeter terrorist"
  //+DROPOFF
  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.02, 0.02), scaleY+frandom(-0.08,0.08)) 
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
	TNT1 A 0 A_SpawnItemEx ("AlaWRITER", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION, 69)
  Spawn2:
    EW3A T 10 A_Look
    loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUArab")
	 Goto Spawn+2
  VanJump:
	 TNT1 A 0
	 TNT1 A 0  NODELAY ACS_NamedExecuteAlways ("VanillaHeights")
	Goto Spawn+3	 
  KabeemCheck:
    TNT1 A 0 
    TNT1 A 0 A_JumpIfCloser (115, "Kabeem")
   Goto SeeLoop	
  Kabeem:	
    EW3A H 30 A_PlaySound ("Arab/See")
	TNT1 A 0 A_SpawnItemEx ("AllaExplosion", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
	TNT1 A 0 DamageThing (999)
   Goto XDeath	 	
  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_TakeInventory ("GrenadeCoolDown", 1)	
	TNT1 A 0 A_Jump (170, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
    EW3A 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, 0, 0, 0)
	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", 50, "Reload")
	Goto SeeLoop+1
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    EW3A 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))
	    EW3A 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))
	    EW3A 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
	    EW3A 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)) 
	    EW3A 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)) 
	    EW3A 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 ("AccuracyCounter", 15)
    TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800) 
    EW3A E 12 A_FaceTarget
  MissileLoop:
    EW3A E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800)
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	EW3A F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-5,5))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    EW3A E 1 A_MonsterRefire (40, "SeeLoop")
	goto MissileLoop+1
  Accuracy:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 15, "SeeLoop")
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
    EW3A E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	EW3A F 1 Bright A_CustomMissile ("SMGTracer",32,9,random (-3,3))
	TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 15, "SeeLoop")
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	TNT1 A 0 A_GiveInventory ("AccuracyCounter", 1)
	//EW3A F 1 A_MonsterRefire (40, "SeeLoop")
	Loop
  ReturnFire:
	EW3A E 5 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800)
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	EW3A F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-7,7))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    EW3A E 1 A_FaceTarget
	EW3A E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800)
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	EW3A F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-7,7))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    EW3A E 1 A_FaceTarget
	EW3A E 2 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 800)
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 50, "Reload")
	TNT1 A 0 A_PlaySound ("UZIF")
	TNT1 A 0 A_PlaySound ("SMGFF", 6, 0.5, 0)
	EW3A F 1 BRIGHT A_CustomMissile ("SMGTracer",32,9,random (-7,7))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    EW3A E 1 A_FaceTarget
	Goto SeeLoop
  Reload:
    TNT1 A 0 A_JumpIfCloser (550, "Retreating")
    EW3A E 15 A_PlaySound ("SMGOUT")
	TNT1 A 0 A_TakeInventory ("SMGShotCounter", 50)
	EW3A D 32 A_PlaySound ("SMGIN")
	EW3A E 22 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")
    EW3A D 10 A_FaceTarget
	TNT1 A 0 A_PlaySound ("GRNTOSS", CHAN_WEAPON)
	EW3A E 8 A_CustomMissile ("BrownHandGrenade", 42, 0, random (-3,3), CMF_OFFSETPITCH, random (8, 12))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 1)
	Goto SeeLoop	
  Retreating:
    TNT1 A 0 A_ChangeFlag ("FRIGHTENED", true) 
    EW3A ABCDABCDABCDABCDABCDABCDABCDABCD 2 A_Chase
	TNT1 A 0 A_CheckSight ("ReloadReady")	
 ReloadReady:
    TNT1 A 0 A_ChangeFlag ("FRIGHTENED", false)
	Goto ReloadBrave
 ReloadBrave:
    EW3A E 15 A_PlaySound ("SMGOUT")
	TNT1 A 0 A_TakeInventory ("SMGShotCounter", 50)
	EW3A D 32 A_PlaySound ("SMGIN")
	EW3A E 22 A_PlaySound ("SMGCOCK")
	TNT1 A 0 A_JumpIfCloser (450, "MissileCheck2")	
	Goto SeeLoop	
  Pain:
    EW3A H 3
    EW3A H 3 A_Pain
    goto SeeLoop
  Death:
    EW3A I 5 A_Scream
    EW3A J 5
    EW3A K 5 A_NoBlocking
    EW3A L 5
	EW3A M 5 A_Playsound ("FallingBodyGear", CHAN_BODY)
    EW3A M -1
    stop
  Death.WEAK:
    EW3A N 5
    EW3A O 5 A_PlaySound("Baddy/pain")
    EW3A P 5 A_NoBlocking
    EW3A Q 5
    EW3A R -1
    stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    EW3A U 5 A_XScream
    EW3A 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)
    EW3A MLKJI 5
	Goto See
  Idle:
    EW3A AA 4 A_Wander
    EW3A A 0 A_Look
    EW3A BB 4 A_Wander
    EW3A A 0 A_Look
    EW3A CC 4 A_Wander
    EW3A A 0 A_Look
    EW3A DD 4 A_Wander
    EW3A A 0 A_Look
    loop
  }
}


	Actor TerSMGSpawner : RandomSpawner 
		{
		 DropItem TerSMG
		 DropItem TerSMGFullBrown
		 DropItem TerSMGSwampGrey
		 DropItem TerSMGLightBrown
		 DropItem TerSMGLightGreyBrown
		}
	
	
	

	Actor TerSMGFullBrown : TerSMG
		{
		 Translation "112:127=64:79", "192:207=64:79"
		}

	Actor TerSMGSwampGrey : TerSMG
		{
		Translation "112:127=152:159", "192:207=96:111"
		}

		Actor TerSMGLightBrown : TerSMG
		{	
		 Translation "112:127=128:143", "192:207=128:143"
		}

		Actor TerSMGLightGreyBrown : TerSMG
		{
		Translation "112:127=96:111", "192:207=64:79"
		}