
ACTOR PrePlacedMarinePlasmaGun Replaces MarinePlasma
{
    States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx ("Marine_PlasmaGunSpawn",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	Stop
    }
}





ACTOR Marine_PlasmaGun1PathfinderNew: Marine1Pathfinder
{
-FRIENDLY
	Speed 4
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_GiveInventory("TargetIsAMarine", 1)
	Goto See
	Pain:
    See:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 Thing_ChangeTID(0,98)
		TNT1 AAAAAAAAAAAAAAAAA 1 A_Chase
		//TNT1 A 0 Thing_Hate(98, 264, 0)
		TNT1 A 0 A_Recoil(-5)
		TNT1 A 0 A_SpawnItem("MarineSpawnChecker")
		TNT1 A 1 A_FaceTarget
		Loop
	Death:
	Missile:
	    TNT1 A 0
		TNT1 A 0 A_ChangeFlag("NOCLIP", 0)
	    TNT1 A 0 A_Recoil(-4)
		TNT1 A 1
		TNT1 A 0 A_JumpIf(momx == 0, "CheckAgain")
	SpawnMarine:	
		TNT1 A 0 A_Scream
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("Marine_PlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItem("FriendlymarineTFog")
		Stop
	CheckAgain:
		TNT1 A 0
		TNT1 A 0 A_JumpIF(momy == 0, "See")
		Goto SpawnMarine
	}
}

ACTOR Marine_PlasmaGunSpawn: RedTorch
{
    Radius 10
    Height 48
	MONSTER
	-SHOOTABLE
	-COUNTKILL
	-FRIENDLY
	translation "112:127=[0,128,192]:[0,0,0]"
	States
    {
    Spawn:
	    PLA6 A 10 
		PLA6 A 1 A_CheckSight("DontSpawn")
		TNT1 A 0 A_Chase
		TNT1 A 0 A_Look
	See:	
		TNT1 A 0 A_GiveToTarget("NumberOfAlliesPlasmaGun", 1)
		TNT1 A 0 A_SpawnItemEx ("Marine_PlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop
	DontSpawn:
	    PLA6 A 1
		Goto Spawn
    }
}

ACTOR Marine_PlasmaGun: Marine_Rifle
{
	DropItem "PlasmaRifle"
	translation "112:127=[0,128,192]:[0,0,0]"
	States
	{
	Active:
		TNT1 A 0 A_ChangeFlag("NOBLOCKMAP", 1)
		TNT1 A 0 A_PlaySound("MarineGuard", 2)
		TNT1 A 0 A_CustomMissile ("OrderTitle2", 50, 0, 0, 2, 90)
		PLA6 A 30
		TNT1 A 0 A_ChangeFLag("NOBLOCKMAP", 1)
		TNT1 A 0 A_SpawnItemEx ("PlasmaGunMarineGuarding",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		Stop
		
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory("TargetIsAMarine")
		PLA6 A 1 A_Look
		Goto See
	
	ForgetTarget:
		TNT1 A 0 A_ClearTarget
		Goto See
	
	See:
		//TNT1 A 0 A_JumpIfInventory("ZombiemanFatality3", 1, "FatalityZombieman")
		//TNT1 A 0 A_JumpIfInventory("ImpFatality3", 1, "FatalityImp")
		//TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
		//TNT1 A 0 A_JumpIfInventory("RevenantFatality", 1, "FatalityRevenant")
		//NULL A 0 A_JumpIfInventory("ComandoFatality", 1, "FatalityComando")
		TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)	
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		
		
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 AA 1 A_Chase
		TNT1 A 0 A_ChangeFlag("FASTER", 0)
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_CheckSight("ForgetTarget")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		TNT1 A 0 A_CheckSight("FollowPLayer")
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		
		PLA6 AA 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfCloser(200, "Waits")
		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfCloser(200, "Waits")
		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfCloser(200, "Waits")
		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfCloser(200, "Waits")
		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		
		
		TNT1 A 0 A_JumpIfCloser(200, "Waits")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		Goto See
	BecomeEnemy23:
		PLA6 A 1
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		Goto FollowPlayer
		
	FollowPlayer:
	    TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("FASTER", 1)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
	    TNT1 A 0 A_JumpIfCloser(150, "Waits")
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)
		PLA6 A 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		TNT1 A 0 A_Recoil(-1)
		PLA6 AA 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		
		PLA6 AA 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 BB 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		TNT1 A 0 A_Recoil(-1)
		PLA6 CC 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		PLA6 DD 1 A_Chase
		TNT1 A 0 A_Recoil(-1)
		
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
		TNT1 A 0 A_JumpIfTargetInLOS("See")
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		
		
		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		Loop
	
	CheckRangeToWait:
		TNT1 A 0
		TNT1 A 0 A_JumpIfCloser(150, "Waits")
		Goto FollowPLayer
	
	CheckIfPlayerSee:
		TNT1 A 0
		PLA6 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_FastChase
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		////TNT1 A 0 Thing_Hate(94, 0, 0)
		TNT1 A 0 A_JumpIfCloser(800, 2)
		Goto Pathfind
		TNT1 AAA 0
		Goto FollowPlayer
	
	
	
	Pathfind:
		TNT1 A 0
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_JumpIFInTargetInventory("IsPLayer", 1, 1)
		Goto FollowPLayer
		//TNT1 A 1 A_Chase("", "")
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		TNT1 A 0 A_ChangeFlag("NOBLOCKMAP", 1)
		TNT1 A 0 A_ChangeFlag("NOCLIP", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_SpawnItemEx ("Marine_PlasmaGunPathfinder",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		Stop
	
	
	
	Waits:
		PLA6 H 1
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, 2)
		TNT1 A 0 A_ClearTarget
		Goto See
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "BecomeEnemy23")
		TNT1 A 0 A_Jump(32, "Waits2")
		TNT1 A 0 A_Jump(32, "Waits3")
		
		PLA6 H 8 A_Stop
		PLA6 E 8 A_Stop
		TNT1 A 0 A_Stop
		TNT1 A 0 A_CheckSight("FollowPlayer")
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ClearTarget
		
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		MARN D 0 A_Look
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		PLA6 E 1 A_LookEx(0, 0, 0, 0, 0, "FollowPlayer")
		TNT1 A 0 A_CheckSIght("FollowPlayer")
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_JumpIfCloser(200, "Waits")
		Goto FollowPlayer
	
	Waits2:
		TNT1 A 0 A_SetAngle(random(90, -90) + angle)
		PLA6 E 8 A_Stop
		TNT1 A 0 A_PlaySound("MRNWT", 2)
		PLA6 H 8 A_Stop
		TNT1 A 0 A_CheckSight("FollowPlayer")
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ClearTarget
		
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		MARN D 0 A_Look
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		PLA6 E 1 A_LookEx(0, 0, 0, 0, 0, "FollowPlayer")
		TNT1 A 0 A_CheckSIght("FollowPlayer")
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_JumpIfCloser(300, "Waits")
		Goto FollowPLayer
	
	Waits3:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInTargetInventory("Clip2", 50, 3)
		Goto GiveAmmo
		TNT1 AAA 0
		TNT1 A 0 A_SetAngle(random(90, -90) + angle)
		PLA6 E 8 A_Stop
		TNT1 A 0 A_PlaySound("MRNWC", 2)
		PLA6 H 8 A_Stop
		TNT1 A 0 A_CheckSight("FollowPlayer")
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ClearTarget
		
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		MARN D 0 A_Look
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		PLA6 E 1 A_LookEx(0, 0, 0, 0, 0, "FollowPlayer")
		TNT1 A 0 A_CheckSIght("FollowPlayer")
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_JumpIfCloser(300, "Waits")
		Goto FollowPLayer
	
	GiveAmmo:
		TNT1 A 0
		PLA6 A 10 A_FaceTarget
		TNT1 A 0 A_PlaySound("MRNGI1")
		PLA6 I 30
		TNT1 A 0 A_GiveToTarget("Clip2", 100)
		//TNT1 A 0 A_SpawnItemEx("Stimpack", 40, 0)
		Goto Waits
	
	Missile:
        //PLA6 E 1
		TNT1 A 0 A_ChangeFlag("NODROPOFF", 1)
		TNT1 A 0 A_SpawnItem("KillMeSmall")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABaronOfHell", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMancubus", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")//
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "CheckRangeToWait")
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 1)
		TNT1 A 0 A_JumpIfCloser(300, "Retreat")
		TNT1 A 0 A_PlaySound("MRNAT", 2)
		
	Missile2:	
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 1)
		PLA6 E 5 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		Goto See
		
	StrafeLeft:
		PLA6 A 3 A_FaceTarget
		PLA6 B 3 ThrustThing(angle*256/360+192, 3, 0, 0)
		PLA6 C 3 A_FaceTarget
		PLA6 D 3 ThrustThing(angle*256/360+192, 3, 0, 0)
        Goto Missile2
		
	StrafeRight:
		PLA6 A 3 A_FaceTarget
		PLA6 B 3 ThrustThing(angle*256/360+64, 3, 0, 0)
		PLA6 C 3 A_FaceTarget
		PLA6 D 3 ThrustThing(angle*256/360+64, 3, 0, 0)
        Goto Missile2	
	
	CheckRetreat:
		TNT1 A 0
		TNT1 A 0 A_JumpIfCloser(500, "Retreat")
	Pain.Avoid:		
		TNT1 A 0 A_Jump(256, "StrafeLeft", "StrafeRight")
		Goto StrafeLeft
		
	Retreat:
        TNT1 A 0
		PLA6 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		PLA6 B 3
        TNT1 A 0 A_Recoil(5)
		PLA6 CD 3 A_FaceTarget
		Goto MIssile2
		
	
		
	AttackMelee:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPLayer")
		PLAM A 4 A_FaceTarget
		TNT1 A 0 A_Recoil(-4)
		PLAM A 1 A_FaceTarget
		PLAM B 4 A_CustomMissile("MarinePunch",40,0,0,0)
		PLAM B 2
		TNT1 A 0 A_JumpIfInventory("ZombiemanFatality3", 1, "FatalityZombieman")
		TNT1 A 0 A_JumpIfInventory("ImpFatality3", 1, "FatalityImp")
		TNT1 A 0 A_JumpIfInventory("SergeantFatality", 1, "FatalitySergeant")
		TNT1 A 0 A_JumpIfInventory("RevenantFatality", 1, "FatalityRevenant")
		Goto See
		
	Pain:
	    PLA6 G 3
		TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)
		PLA6 G 3 A_Pain
		Goto FollowPlayer



	Death:
	Death.Bullet:
		TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		PLAY H 10 A_PlayerScream
		
		PLAY I 10 A_NoBlocking
		PLAY J 10 
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		PLAY KLM 10
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
		PLAY N -1
		Stop

    Death.Eat:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_GiveToTarget("EatMe",1)
		TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        XPL1 A 10 A_XScream
        XPL1 B 20 A_NoBlocking
        XPL1 CDE 10 
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL1 E -1
        Stop

    Death.Cut:
	Death.Saw:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath2", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath3", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RipGuts", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("XDeathHalfMarine", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 A 10 A_XScream
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 B 20 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 C 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 DE 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL2 E -1
        Stop

    Death.Slime:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_PlaySound("BIGSCREA")
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        PMET AABBCCDDEEFFGGHHIIIII 10 A_CustomMissile ("PlasmaSmoke", 25, 0, random (0, 180), 2, random (0, 180))
        PMET IIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLL 3 A_CustomMissile ("PlasmaSmoke", 25, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_NoBlocking
        TNT1 A -1
        Stop

    Death.Minigun:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_Jump (128, 3)
        Goto Death
        TNT1 AAA 0
		TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath2", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath3", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RipGuts", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("XDeathHalfMarine", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 A 10 A_XScream
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 B 20 A_NoBlocking
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 C 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 DE 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL2 E -1
        Stop

    Death.Rip:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 AAAAAAAAAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 A 10 A_XScream
        TNT1 AAAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 B 20 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 C 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 D 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 E 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 F 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 F 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL3 F -1
        Stop
	Death.Massacre:
	Death.Explosives:
	XDeath:
		TNT1 A 0 ThrustThingZ(0,60,0,1)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_CustomMissile ("MarineXDeath", 0, 0, random (0, 360), 2, random (0, 160))
		PPOD A 0 A_SpawnItemEx("BasicMarineGib1", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		PPOD A 0 A_SpawnItemEx("BasicMarineGib2", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		PPOD A 0 A_SpawnItemEx("BasicMarineGib3", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		PPOD A 0 A_SpawnItemEx("BasicMarineGib4", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        MHEA A 7 A_XScream
        MHEA B 7 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        MHEA CD 7
        MHEA E -1
		Stop
		
	 Crush:
	 Death.Stomp:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
	    TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail8", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAAA 0 bright A_CustomMissile ("SuperGoreSpawner", 5, 0, random (0, 360), 2, random (30, 180))
		TNT1 AAAAAA 0 bright A_CustomMissile ("XDeath1", 5, 0, random (0, 360), 2, random (30, 180))
		TNT1 AA 0 bright A_CustomMissile ("XDeath2", 55, 0, random (0, 360), 2, random (30, 180))
		TNT1 AA 0 bright A_CustomMissile ("XDeath3", 55, 0, random (0, 360), 2, random (30, 180))
		TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
		TNT1 A 0 A_SpawnItem ("CrushedRemains")
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 1
		TNT1 A 1 A_XScream
		TNT1 A 1 A_NoBlocking
		Stop	

	Death.Blast:
	Death.SuperPunch:
	Death.SSG:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
	    PLA6 O 2 A_FaceTarget
        TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBlood", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), 2, random (0, 40))
		TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), 2, random (0, 40))
        TNT1 A 0 A_XScream
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        PLA6 OPQRSTU 8
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        PLA6 U -1
        Stop

    Death.Rape:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		XPL4 A 20 A_XScream
		 TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath2", 1, 0, random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath3", 1, 0, random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
        TNT1 AAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 B 20 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 C 20
        TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 D 20
        TNT1 AAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 E 20
        TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 F 20
        TNT1 AAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL4 F -1
        Stop

    Death.plasma:
        TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_XScream
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAA 0 A_CustomMissile ("Brutal_FlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
		EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
        TNT1 A 1
        TNT1 A -1
        Stop


		Death.GreenFire:
        TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_XScream
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAAA 0 A_CustomMissile ("Brutal_Blood", 30, 0, random (0, 360), 2, random (0, 160))
		
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
		
		EXPL AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("GreenFlameTrails", 50, 0, random (0, 360), 2, random (0, 360))
		XBRN AAAA 2 BRIGHT A_SpawnItem("GreenFlare",0,43)
        Stop

    Death.burn:
	TNT1 A 0
	TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
	 PBUR A 1
      PBUR A 1 A_Scream
      PBUR A 1 A_NoBlocking
	  TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
       PBUR AAAABBBBCCCC 2 A_CustomMissile ("SmallFlameTrails", 32, 0, random (0, 180), 2, random (0, 180))
	    PBUR DDDDEEEE 2 A_CustomMissile ("SmallFlameTrails", 16, 0, random (0, 180), 2, random (0, 180))
        PBUR EEEEE 4 A_CustomMissile ("SmallFlameTrails", 8, 0, random (0, 180), 2, random (0, 180))
		PBUR EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 6 A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
        PBUR E -1
        Stop

    Death.Fire:
	Death.Flames:
	Death.Burn:
	TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_PlaySound("BIGSCREA")
      BURN W 6 A_Scream
      BURN X 6 A_NoBlocking
	  TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
       BUR2 ABCD 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
       BURN FGHIJKL 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
       BURN MNOPQRSTUV 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
        BURN VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 6 A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
        BURN V -1
      Stop
	  
	  
	  Death.ExplosiveImpact:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		NULL A 0 ThrustThingZ(0,30,0,1)
		NULL AAAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains2", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains4", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains5", 50, 0, random (0, 360), 2, random (0, 160))
		NULL AAAA 0 A_CustomMissile ("SmallBrainPiece", random (45, 55), random (5, -5), random (170, 190), 2, random (0, 40))
		NULL AAAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), 2, random (0, 160))
		NULL AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), 2, random (0, 40))
        NULL AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), 2, random (0, 160))
	    NULL A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), 2, random (0, 160))
	    NULL A 0 A_CustomMissile ("XDeath3", 40, 0, random (0, 360), 2, random (0, 160))
	    PPOD A 0 A_SpawnItemEx("BasicMarineGib1", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        NULL AAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		NULL A 0 A_XScream
        XPL6 A 5
		NULL A 0 A_NoBlocking
        XPL6 BCDE 5
        XPL6 F -1
        Stop

    Crush:
        TNT1 A 0 A_PlaySound("misc/xdeath4")
        CRS1 A 5
        CRS1 A -1
        Stop

    Death.HKFT:
	Death.BHFT:
	Death.RVFT:
		TNT1 A 1 A_Scream
		TNT1 A 1 A_NoBlocking
        TNT1 A 0 A_GiveToTarget("Curbstomp_Marine",1)
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A -1
        Stop

    Death.FatalityMarine:
		TNT1 A 1 A_PlayerScream
		TNT1 A 0 A_GiveToTarget("GoFatality", 1)
		TNT1 A 1 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 A 0 A_GiveToTarget("Fatality_Marine",1)
		TNT1 A -1
        Stop
	}
}




ACTOR PlasmaGunMarineGuarding: Marine_PlasmaGun
{
	FastSpeed 0
	MaxStepHeight 0
	+FRIENDLY
	+MISSILEMORE
	+NODROPOFF
	+MISSILEEVENMORE
	+SHOOTABLE
	Speed 0
	States
	{
	Active:
		TNT1 A 0 A_ChangeFlag("NOBLOCKMAP", 1)
		TNT1 A 0 A_PlaySound("MarineFollow", 2)
		TNT1 A 0 A_CustomMissile ("OrderTitle1", 50, 0, 0, 2, 90)
		PLA6 A 30
		TNT1 A 0 A_ChangeFLag("NOBLOCKMAP", 1)
		TNT1 A 0 A_SpawnItemEx ("Marine_PlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		Stop
		
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
		TNT1 A 0 A_GiveInventory("TargetIsAMarine")
		PLA6 E 1 A_Look
		Goto See
		
	See:	
		//TNT1 A 0 A_SetAngle(random(90, -90) + angle)
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		PLA6 EEEEEEEEEEHHHHHHHHH 1 A_Chase
		TNT1 A 0 A_ClearTarget
		Loop
	
		
		
	Missile:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
		TNT1 A 0 A_SpawnItem("KillMeSmall")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 1)
		
	Missile2:	
		TNT1 A 0 A_ChangeFlag("SHOOTABLE", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 1)
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		
		TNT1 A 0 A_PlaySound("PLSM9", CHAN_WEAPON)
		PLA6 F 2 BRIGHT A_CustomMissile("Plasma_Ball",40,0,0,0)
		PLA6 E 3 A_FaceTarget
		Goto See
			
		
	Pain:
	    PLA6 G 3
		PLA6 G 3 A_Pain
		TNT1 A 0 A_Jump(128, "StrafeLeft", "StrafeRight")
		Goto See
		
	StrafeLeft:
		PLA6 A 3 A_FaceTarget
		PLA6 B 3 ThrustThing(angle*256/360+192, 3, 0, 0)
		PLA6 C 3 A_FaceTarget
		PLA6 D 3 ThrustThing(angle*256/360+192, 3, 0, 0)
        Goto Missile2
		
	StrafeRight:
		PLA6 A 3 A_FaceTarget
		PLA6 B 3 ThrustThing(angle*256/360+64, 3, 0, 0)
		PLA6 C 3 A_FaceTarget
		PLA6 D 3 ThrustThing(angle*256/360+64, 3, 0, 0)
        Goto Missile2		
	}
}

ACTOR Marine_PlasmaGunPathfinder
{
	Radius 32
	Height 56
	Speed 20
	Health 4000
	PainChance 255
	MaxTargetRange 150
	Monster
	damagefactor "SpawnMarine", 8000.0
	MaxDropOffHeight 1200
	MaxStepHeight 1200
	-COUNTKILL
	+NOTARGET
	+THRUACTORS
	+MISSILEMORE
	+MISSILEEVENMORE
	+FASTER
    +DONTSPLASH
	-SHOOTABLE
	-FRIENDLY
	+NOCLIP
	+LOOKALLAROUND
	+NOINFIGHTING
	States
	{
	Spawn:
	Pain:
    See:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		//TNT1 A 0 Thing_ChangeTID(0,98)
		//TNT1 A 0 Thing_Hate(98, 0, 0)
		TNT1 A 0
		TNT1 A 0 A_GiveInventory("TargetIsAMarine", 1)
		TNT1 AAAAA 1 A_Chase
		//TNT1 A 0 Thing_Hate(98, 0, 0)
		TNT1 A 0
		TNT1 A 0 A_GiveInventory("TargetIsAMarine", 1)
		TNT1 A 1 A_FaceTarget
		Loop
	//Missile:
	TNT1 A 2
	TNT1 A 0 A_SpawnItem("MarineSpawnChecker")	
	TNT1 A 5
	Goto See
	Death:
	Missile:
	    TNT1 A 0
	    TNT1 A 0 A_Recoil(-2)
		TNT1 A 2
		TNT1 A 0 A_Scream
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("Marine_PlasmaGun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItem("FriendlymarineTFog")
		Stop
	}
}

ACTOR Marine_PlasmaGunAdd: Marine1Pathfinder
{
	Speed 4
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_GiveInventory("TargetIsAMarine", 1)
	Goto See
	Pain:
    See:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 Thing_ChangeTID(0,98)
		TNT1 AAAAAAAAAAAAAAAAA 1 A_Chase
		//TNT1 A 0 Thing_Hate(98, 264, 0)
		TNT1 A 0 A_Recoil(-5)
		TNT1 A 1 A_FaceTarget
		Loop
	Death:
	Missile:
		TNT1 A 1
		TNT1 A 0 A_Scream
		TNT1 A 0 A_NoBlocking
		TNT1 A 200
		TNT1 A 0 A_GiveToTarget("NumberOfAlliesPlasmaGun", 1)
		Stop
	}
}

ACTOR RemoveMarinePlasmaGun
{
	States
	{
	Spawn:
	Pain:
    See:
		TNT1 A 1
		TNT1 A 0 A_SpawnItemEx("RemoveMarinePlasmaGunActivate",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 1
		Stop
	}
}

ACTOR RemoveMarinePlasmaGunActivate: Marine1Pathfinder
{
-FRIENDLY
-SHOOTABLE
Scale 1.0
Speed 1
MaxTargetRange 90000
	States
	{
	Spawn:
	Pain:
    See:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 Thing_ChangeTID(0,98)
		TNT1 AAAAAAAAAAAAAAAAA 1 A_Chase
		//TNT1 A 0 Thing_Hate(98, 264, 0)
		TNT1 A 0 A_Recoil(-5)
		TNT1 A 1 A_FaceTarget
		Loop
	Missile:
		TNT1 A 1
		TNT1 A 0 A_TakeFromTarget("NumberOfAlliesPlasmaGun", 1)
		TNT1 A 0 A_Scream
		TNT1 A 0 A_NoBlocking
		TNT1 A 1
		Stop
	}
}



