   Actor DesertCamoTacticalGunner : GenericHumanScum 
       {
  scale 1.0
  obituary "%o was shot, blown up and totally democratised by the Desert Camo Tactical Gunner"
  health 257
  radius 15
  height 54
  mass 100
  speed 11
    Species "Knight"
  +DOHARMSPECIES 
  painchance 100
  SeeSound "DesertCamGunner/See"
  PainSound "GTS/pain"
  DeathSound "GTS/Death"
  ActiveSound "DesertCamGunner/Active"
  Tag "Desert Camo Tactical Gunner"
  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:
    PU32 A 10 A_Look
    loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUDesertCamGunner")
	 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")
    PU32 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
	    PU32 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))
	    PU32 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))
	    PU32 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
	    PU32 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)) 
	    PU32 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)) 
	    PU32 AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
	DodgeMoves:
		PU32 AABB 2 A_Recoil (random (1,3))
		PU32 CCDD 2 A_Wander  
		PU32 AABBCCDDAABBCCDDAABBCCDD 2 A_Wander
  MissileCheck:
	TNT1 A 0 A_JumpIfInventory ("GrenadeCoolDown", 1, 2)
	TNT1 A 0 A_Jump (175, "40mmCheck")
    TNT1 A 0 A_JumpIfTargetInLos ("Missile", 0, JLOSF_DEADNOJUMP)
	Goto SeeLoop
  Missile:
	TNT1 A 0
	TNT1 A 0 A_TakeInventory ("GrenadeCoolDown", 1)
	TNT1 A 0 A_TakeInventory ("ShotCounter", 6)
    PU32 E 7 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("TriShot", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP,  0, 950)
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 1500)
  MissileLoop:
    TNT1 A 0 
	TNT1 A 0 A_FaceTarget
    TNT1 A 0 A_PlaySound ("USZRFL")
	PU32 F 1 BRIGHT A_CustomMissile ("AKTracer",42,8,random (-1,1))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_GiveInventory ("ShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("ShotCounter", 6, "MissileDodge")
    PU32 E 2 A_MonsterRefire (40, "SeeLoop")
   Loop
  MissileDodge:
	TNT1 A 0 
	TNT1 A 0 A_FaceTarget
    TNT1 A 0 A_PlaySound ("USZRFL")
	PU32 F 1 BRIGHT A_CustomMissile ("AKTracer",42,8,random (-1,1))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
    PU32 E 2 A_MonsterRefire (40, "SeeLoop")
	TNT1 A 0 A_JumpIfInTargetLos ("DodgeMoves", 1, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 0, 600)
   Loop 	
  Trishot:
	PU32 E 6 A_FaceTarget
    TNT1 A 0 A_PlaySound ("USZRFL")
	PU32 F 2 BRIGHT A_CustomMissile ("AKTracer",42,8)
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	PU32 E 3 A_FaceTarget 
	TNT1 A 0 A_PlaySound ("USZRFL")
	PU32 F 2 BRIGHT A_CustomMissile ("AKTracer",42,8)
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	PU32 E 3 A_FaceTarget
	TNT1 A 0 A_PlaySound ("USZRFL")
	PU32 F 2 BRIGHT A_CustomMissile ("AKTracer",42,8, random(-1,1))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	PU32 E 3 A_MonsterRefire (40, "SeeLoop")
	TNT1 A 0 A_JumpIfInTargetLos ("DodgeMoves", 1, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 0, 600)
	Loop
  Accuracy:
    PU32 E 10 A_FaceTarget
	TNT1 A 0 A_PlaySound ("USZRFL")
	PU32 F 2 BRIGHT A_CustomMissile ("AKTracer",42,8)
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_JumpIfInTargetLos ("DodgeMoves", 1, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 0, 600)
	TNT1 A 0 A_Jump (69, "40mmCheck")
	PU32 E 2 A_MonsterRefire (40, "SeeLoop")
	Loop
  40mmCheck:
	TNT1 A 0
    TNT1 A 0 A_JumpIfTargetInLos ("40mm", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 900, 400)
	TNT1 A 0 A_JumpIfTargetInLos ("Suppress40mm", 15, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 1200, 901)
	TNT1 A 0 A_JumpIfTargetInLos ("Long40mm", 15, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 0, 1201)
	Goto MissileCheck+1
  40mm:
    PU32 E 12 A_FaceTarget
	TNT1 A 0 A_PlaySound ("GLFIR", CHAN_WEAPON)
	PU32 F 2 BRIGHT A_CustomMissile ("LRGrenade40mm", 42, 8, random (-3,3), CMF_OFFSETPITCH, random (1, 4))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 2)
	Goto SeeLoop
  Suppress40mm:
	PU32 E 15 A_FaceTarget
	TNT1 A 0 A_PlaySound ("SOVIUBGL", CHAN_WEAPON)
	PU32 F 3 BRIGHT A_CustomMissile ("LRGrenade40mm", 42, 8, random (-4,4), CMF_OFFSETPITCH, random (5,8))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 2)
	Goto Seeloop
  Long40mm:
	PU32 E 35 A_FaceTarget
	TNT1 A 0 A_PlaySound ("SOVIUBGL", CHAN_WEAPON)
	PU32 F 3 BRIGHT A_CustomMissile ("LRGrenade40mm", 42, 8, random (-7,7), CMF_OFFSETPITCH, random (10,14))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 2)
	Goto SeeLoop	
  Reload:  
    PU32 D 12 A_PlaySound ("RIFOUT")
	TNT1 A 0 A_TakeInventory ("AKShotCounter", 30)
	PU32 E 23 A_PlaySound ("RIFIN")
	PU32 D 16 A_PlaySound ("RIFREAD")
	Goto SeeLoop
  Pain:
    PU32 G 3
    PU32 G 3 A_Pain
    goto SeeLoop
  Death:
  	//TNT1 A 0 A_Jump(20, "Suren")
    PU32 H 5 A_Scream
    PU32 I 5
    PU32 J 5 A_NoBlocking
    PU32 K 5
    PU32 L -1
    stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    PGIB A 1 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)
	PU32 LKJIH 5
   Goto See	
  Idle:
    PU32 AA 4 A_Wander
    PU32 A 0 A_Look
    PU32 BB 4 A_Wander
    PU32 A 0 A_Look
    PU32 CC 4 A_Wander
    PU32 A 0 A_Look
    PU32 DD 4 A_Wander
    PU32 A 0 A_Look
    loop
  }
	   
	   
	   }
	   
	   
	   
	   
	   
	Actor LRGrenade40mm
   {
 projectile
+MISSILE
-NOGRAVITY
+BLOODSPLATTER
gravity 0.25
radius 5
height 5
speed 30
scale 1.0
damage (10)
Obituary "%o was blown up by 40mm grenade"
states
    {
	 Spawn:
	     GREX A 3 A_SpawnItemEx("CSMiniMissileTrail",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
		Loop
     Death:
         TNT1 A 0
         TNT1 A 0 A_PlaySound("misc/boom",5)
         TNT1 A 0 A_PlaySound("misc/distanceboom",6,1.0,0,0)
         TNT1 A 0 A_Explode((30),60, 0 ,0,60)
         TNT1 AAAAA 0 A_CustomMissile ("CSMiniMissileExplosionFlame", 0, 0, random (0, 360), 2, random (0, 360))
         TNT1 AAA 0 A_CustomMissile ("CSMiniMissileBoomSmoke", 0, 0, random (0, 360), 2, random (0, 360))
         TNT1 A 0 A_SpawnItemEx("CSMiniMissileShockwave",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
         TNT1 A 1 Radius_Quake (2,4,0,7,0)
         TNT1 A 20
stop
     }
   
  }   