   actor SuitPistolGuard : GenericHumanScum 
{

   //----------------------------COMPLEX DOOM COMPATIBILITY DROPS------------------------

DropItem "HealthFlask" 40
DropItem "ArmorCharge" 40
DropItem "AmmoPack" 20
DropItem "HandGrenadeAmmo" 50 1
DropItem "MineAmmo" 25 1

  scale 1.0
  obituary "%o was safetised by security guard with airsoft 50 cal pistol (wait wat)"
  health 25
  radius 15
  height 54
    Species "Z"
  +DOHARMSPECIES
  Species "Bydlo"
  +DOHARMSPECIES
  Translation "192:207=5:8", "240:247=5:8"
  mass 100
  speed 9
  Damage 1
  painchance 200
  SeeSound "StMerc/see"
  PainSound "StMerc/pain"
  DeathSound "StMerc/Death"
  ActiveSound "StMerc/active" 
  dropitem "Clip"
  Tag "Pistol Security Guard"
  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.04,0.04))
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
  Spawn2:	
    MBA1 T 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,6)
    TNT1 A 0 A_Jump (70, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	TNT1 A 0 A_Jump (30, "MissileCheck")
    MBA1 EF 5
SeeLoop:
    TNT1 A 0 A_JumpIfCloser (450, "CheckDodge")
	TNT1 A 0 A_Jump (100, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
    MBA3 AABBCCDD 3 A_Chase
	TNT1 A 0 A_CheckSight ("CheckReload")
    loop
CheckReload:
    TNT1 A 0 A_Jump (50, "CheckReload2")
 	Goto SeeLoop
CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
	Goto SeeLoop
CheckDodge:
    TNT1 A 0 A_Jump (221, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	Goto SeeLoop+1
    DodgeLeft:
	    TNT1 A 0 A_FaceTarget
	    MBA3 AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (20, "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))
	    MBA3 AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (20, "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))
	    MBA3 AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (20, "MissileCheck")
		Goto SeeLoop+1
	DodgeRight:
	    TNT1 A 0 A_FaceTarget
	    MBA3 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)) 
	    MBA3 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)) 
	    MBA3 AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "MissileCheck")
		Goto SeeLoop+1
  MissileCheck:
    TNT1 A 0 A_JumpIfTargetInLos ("Missile")
    Goto SeeLoop+1
  Missile:
    TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
    MBA1 F 12 A_FaceTarget
	TNT1 A 0 A_Jump (100, "RapidFire", "4Fire")
	TNT1 A 0 A_Playsound ("BYPFR")
	TNT1 A 0 A_PlaySound ("BYPFRF", 6, 0.5, 0)
	MBA1 G 6 BRIGHT A_CustomMissile ("LightPistolTracer",45,0,random (-3,5))
	TNT1 A 0 A_GiveInventory ("LightPistolShotCounter", 1)
    MBA1 F 12
    goto SeeLoop
  RapidFire:
    MBA1 F 8 A_FaceTarget
    TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
	TNT1 A 0 A_Playsound ("BYPFR")
	TNT1 A 0 A_PlaySound ("BYPFRF", 6, 0.5, 0)
	MBA1 G 6 BRIGHT A_CustomMissile ("LightPistolTracer",45,0,random (-6,6))
	TNT1 A 0 A_GiveInventory ("LightPistolShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
   Loop
  4Fire:
    TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
	TNT1 A 0 A_Playsound ("BYPFR")
	TNT1 A 0 A_PlaySound ("BYPFRF", 6, 0.5, 0)
	MBA1 G 6 BRIGHT A_CustomMissile ("LightPistolTracer",45,0,random (-6,6))
	TNT1 A 0 A_GiveInventory ("LightPistolShotCounter", 1)
	MBA1 F 8 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
	TNT1 A 0 A_Playsound ("BYPFR")
	TNT1 A 0 A_PlaySound ("BYPFRF", 6, 0.5, 0)
	MBA1 G 6 BRIGHT A_CustomMissile ("LightPistolTracer",45,0,random (-7,8))
	TNT1 A 0 A_GiveInventory ("LightPistolShotCounter", 1)
	MBA1 F 8 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
	TNT1 A 0 A_Playsound ("BYPFR")
	TNT1 A 0 A_PlaySound ("BYPFRF", 6, 0.5, 0)
	MBA1 G 6 BRIGHT A_CustomMissile ("LightPistolTracer",45,0,random (-8,8))
	TNT1 A 0 A_GiveInventory ("LightPistolShotCounter", 1)
	MBA1 F 8 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("LightPistolShotCounter", 8, "Reload")
	TNT1 A 0 A_Playsound ("BYPFR")
	TNT1 A 0 A_PlaySound ("BYPFRF", 6, 0.5, 0)
	MBA1 G 6 BRIGHT A_CustomMissile ("LightPistolTracer",45,0,random (-9,9))
	TNT1 A 0 A_GiveInventory ("LightPistolShotCounter", 1)
	Goto SeeLoop
  Reload:
    MBA1 F 18
	TNT1 A 0 A_PlaySound ("LPISOUT")
	TNT1 A 0 A_TakeInventory ("LightPistolShotCounter", 8)
	MBA3 D 29
	TNT1 A 0 A_PlaySound ("LPISIN")
	MBA1 F 15
	TNT1 A 0 A_PlaySound ("LPISREAD")
    TNT1 A 0 A_JumpIfCloser (450, "RapidFireCheck")
	Goto SeeLoop
  RapidFireCheck:
    TNT1 A 0 A_JumpIfTargetInLos ("RapidFireCheck2")
   Goto SeeLoop 	
  RapidFireCheck2:	
    TNT1 A 0 A_Jump (88, "RapidFire")
	TNT1 A 0 A_Jump (150, "DodgeLeftB", "DodgeRightB")
	Goto SeeLoop
  Pain:
    MBA3 H 3
    MBA3 H 3 A_Pain
    goto SeeLoop
  Death:
	//TNT1 A 0 A_Jump(40, "Suren")
    MBA1 J 5 A_NoBlocking
    MBA1 K 5 A_Scream
    MBA1 L 5 A_Playsound ("FallingBodyLight", CHAN_BODY)
    MBA1 M -1
    stop
  XDeath:
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    MBA1 U 5
    MBA1 V 5 A_XScream
    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)
	MBA1 MLKJ 5
   Goto See	
  Idle:
    MBA3 AA 4 A_Wander
    MBA3 A 0 A_Look
    MBA3 BB 4 A_Wander
    MBA3 A 0 A_Look
    MBA3 CC 4 A_Wander
    MBA3 A 0 A_Look
    MBA3 DD 4 A_Wander
    MBA3 A 0 A_Look
    loop
  }
}