Transforming Enemies (And Their Related Problems)

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
ImpieTwo
Posts: 912
Joined: Sun Aug 16, 2015 11:52 pm

Transforming Enemies (And Their Related Problems)

Post by ImpieTwo »

I've been having trouble with enemies that change into new enemies when defeated. For example, the Splatterhouse Phantom which sheds its cloak and changes its behavior when it takes a certain amount of damage. I tried having it spawn the new enemy upon death, but if the player is too close, the new enemy simply fails to spawn. Same happens with the monster stasis tubes: the danger is supposed to be that you can break them and accidentally release the monster inside, but again, if you're too close, the monster fails to spawn during the tube's death animation (and also fails to spawn if the object is solid during the spawning process -- catch 22).

I got around this with the Monster Jenny boss by blocking the player with linedefs, and changing the linedefs' "solid" flag with ACS. But that's a one-time boss event: doing that for each of the dozens of stasis tubes in the lab areas is out of the question. I was sure there was a way to make this work without having to use convoluted ACS sequences for every instance (it wouldn't work with the phantoms anyway since they're mobile).

So now I've tried making the phantom a single enemy that jumps to different states based on whether he has the "clothed" inventory item, and jumps to the cloak shedding state when he flinches and has health below X. But now I get the dreaded "!" symbol wherever he is supposed to appear.

Code: Select all

Actor PhantomCloak replaces revenant 6081
{
  //$Title "PhantomCloak"
  //$Category Monsters
  Health 400
  Radius 24
  Height 60
  Mass 350
  Speed 10
  PainChance 208
  Bloodtype "Brutal_Blood"
  PainSound "Demon/Pain"
  MeleeSound "Medusa/Melee"
  Obituary "%o was spooked by some kind of phantom."
  Monster
  +FloorClip
  +DontHurtSpecies
  +QuickToRetaliate
  +LOOKALLAROUND
  +NOINFIGHTING
  +MissileMore
  States
  {
  Spawn:
    NULL A 0 A_GiveInventory("Clothed",1)
	PHAC A 0 A_StopSoundEx("SoundSlot7")
	PHAC A 1 A_Look
    Loop
  See:
    NULL A 0 A_JumpIfInventory("Clothed",0,"NudeSee")
	PHAC A 0 A_StopSoundEx("SoundSlot7")
	PHAC A 0 A_PlaySoundEx("phantom/hum", "SoundSlot8", 1)
    PHAC AA 5 A_Chase
    Loop
  Missile:
    NULL A 0 A_JumpIfInventory("Clothed",0,"NudeMissile")
	PHAC AAA 4 A_FaceTarget
    PHAC A 0 A_Jump(208, "Gaze")
    PHAC B 6 A_CustomMissile("MedusaBall", 48, 0)
    Goto See
  Gaze:
    PHAC A 0 A_JumpIfCloser(384, 1)
    Goto Missile+3
    PHAC B 0 A_PlaySoundEx("Medusa/Gaze", "SoundSlot7", 1)
    PHAC B 5 bright A_CustomBulletAttack(4, 0, 5, 0, "MedusaPuff")
    PHAC B 0 A_Jump(8, 3)
    PHAC B 0 A_JumpIfCloser(384, 1)
    Goto See
    PHAC B 0 A_SpidReFire
    Goto Gaze+2
    PHAC B 0
    Goto See
  Pain:
    NULL A 0 A_JumpIfInventory("Clothed",0,"NudePain")
	PHAC C 0 A_StopSoundEx("SoundSlot7")
    PHAC C 3
    PHAC C 3 A_Pain
	PHAC A 0 A_JumpIfHealthLower(150,"Reveal")
    Goto See
  Reveal:
    NULL A 0 A_JumpIfInventory("Clothed",0,"NudeSee")
	PHAC D 0 A_SetInvulnerable
	PHAC D 6 A_PlaySound ("caco/sight")
    PHAC E 6
	PHAC F 6
	PHAC F 0 A_UnSetInvulnerable
	PHAC D 0 A_TakeInventory("Clothed",1)
	Goto NudeSee
  NudeSee: 
       PHAN AA 2 A_Chase
	   PHAN A 0  A_PlaySoundEx("phantom/hum", "SoundSlot8", 1)
       Loop 
   NudeMissile:
       PHAN AAA 4 A_FaceTarget
       PHAN A 0 A_Jump(208, "NudeVomit")
       PHAN B 6 A_CustomComboAttack("MedusaBall", 48, 35, "Medusa/Melee", "Melee", 1)
       Goto See
   NudeVomit:
	   PHAN B 3 A_FaceTarget
       PHAN B 4 A_CustomMissile("SlimeBall", 48, 0, 0)
	   PHAN B 4 A_CustomMissile("SlimeBall", 48, 0, 0)
	   PHAN B 4 A_CustomMissile("SlimeBall", 48, 0, 0)
       Goto See
   NudePain: 
       PHAN C 2
       PHAN C 2 A_Pain 
       Goto See 
   Death: 
	   PHAN C 3 A_Scream
       PHAN D 3 A_NoBlocking
	   PHAN E 6 A_Fall
	   PHAN FGFGHGHIHIJ 4
		 TNT1 AAAAAA 0 A_CustomMissile ("CeilBloodLauncherLong", 0, 0, random (0, 360), 2, random (50, 130))
		 TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 AA 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 A 0 A_CustomMissile ("XDeath5", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 A 0 A_CustomMissile ("Brains3", 40, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 A 0 A_CustomMissile ("XDeathOrgan1", 40, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 A 0 A_CustomMissile ("XDeathOrgan2", 40, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 AAAAAAAA 0 A_CustomMissile ("SuperWallRedBlood", 40, 0, random (0, 360), 2, random (-5, 5))
		 TNT1 AAAA 0 A_CustomMissile ("Instestin", 32, 0, random (0, 360), 2, random (0, 90))
		 TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Bloodmist", 35, 0, random (0, 360), 2, random (0, 90))
		 TNT1 AAAAAA 0 bright A_CustomMissile ("SuperGoreSpawner", 32, 0, random (0, 360), 2, random (50, 130))
		XMED A 5 A_Stop
		XMED B 5 A_XScream
		XMED C 5
		XMED D 5 A_NoBlocking
		XMED E 5
		TNT1 A 0 A_CustomMissile ("BigBloodSpot", 4, 0, random (0, 360), 2, random (0, 90))
		TNT1 A 0 A_StopSoundEx("SoundSlot7")
		TNT1 A 0 A_StopSoundEx("SoundSlot8")
		Stop
   }
}

Actor Clothed : CustomInventory
{}
Here's the unaltered monster tube code while I'm at it.

Code: Select all

Actor TubeSleep 6079
{
//$Title "TubeSleep"
//$Category Splat3DFurniture
Health 60
Radius 20
Height 56 
Mass 5000
deathsound "mimi/glass"
MONSTER
+NOBLOOD
States
 {
 Spawn:
   MITB A 10 bright
   Loop
 Death:
   MITB B 6 bright A_Scream
   MITB C 6 bright 
   MITB D 6 bright
   MITB E 0 A_NoBlocking
   MITB E 0 A_SpawnItemEX ("howler",0,0,0,0)
   MITB E -1
   Stop
 }
}
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Transforming Enemies (And Their Related Problems)

Post by Matt »

I tried having it spawn the new enemy upon death, but if the player is too close, the new enemy simply fails to spawn.
[wiki=A_SpawnItemEx]SXF_NOCHECKPOSITION[/wiki]?
ImpieTwo
Posts: 912
Joined: Sun Aug 16, 2015 11:52 pm

Re: Transforming Enemies (And Their Related Problems)

Post by ImpieTwo »

Does this mean it spawns regardless of obstructions?

Also wondering if the new way I coded the phantom will work and i just configured it wrong, or if spawning the new enemy is more efficient.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Transforming Enemies (And Their Related Problems)

Post by Matt »

First question, yes.

Second question, uhhh test it a zillion times and see what goes wrong and fix it???
(spawning a second monster is much, much more efficient if the two forms are significantly more different than "sometimes spawn sparks and smoke and maybe attack more frequently with a different attack sequence", and in ZScript you should be able to transfer any necessary properties)
ImpieTwo
Posts: 912
Joined: Sun Aug 16, 2015 11:52 pm

Re: Transforming Enemies (And Their Related Problems)

Post by ImpieTwo »

Matt wrote: (spawning a second monster is much, much more efficient if the two forms are significantly more different than "sometimes spawn sparks and smoke and maybe attack more frequently with a different attack sequence", and in ZScript you should be able to transfer any necessary properties)
I'll just do it that way then. It'll save me weeks of headaches...

Return to “Scripting”