Jump to content
  • 0

How do I stop my custom monster from telefragging itself?


Individualised

Question

I have created a custom monster for GZDoom. It acts just like a demon, except that when it is killed, it spawns 2 smaller, faster versions of itself with less health. Those monsters when killed in turn spawn even smaller and faster versions with even less health, that do not spawn anything when killed.

This monster works great in open areas. However, issues arise when it is placed in a tight space. The monsters that it spawns when it is killed do not have enough space and end up telefragging themselves.

Is there a way to prevent this from happening? Preferably the solution would not involve disabling telefragging for this monster altogether, but if that's the only way then that's fine.

 

Here's the code: (I wanted to use ZScript, but there simply weren't enough resources for me to learn from, so I had to settle with DECORATE.)

 

ACTOR SlimeDemonBig : Demon 15000
{
	Obituary "%o was turned to goo by a slime demon." 
	States
	{
	Spawn:
		SLI1 AB 10 A_Look
    Loop
    See:
		SLI1 AABBCCDD 2 Fast A_Chase
    Loop
    Melee:
		SLI1 EF 8 Fast A_FaceTarget
		SLI1 G 8 Fast A_SargAttack
    Goto See
    Pain:
		SLI1 H 2 Fast
		SLI1 H 2 Fast A_Pain
    Goto See
	Death:
		SLI1 I 8 
		SLI1 J 8 A_Scream
		SLI1 K 4
		SLI1 L 4 A_NoBlocking
		SLI1 M 4
		SLI1 N -1 A_DualPainAttack("SlimeDemonMedium")
		Stop
	Raise:
		SLI1 N 5
		SLI1 MLKJI 5
		Goto See
	}
	
}

ACTOR SlimeDemonMedium : Demon 15001
{
	Health 100
	Speed 15
	Radius 20
	Height 37
	Obituary "%o was turned to goo by a slime demon." 
	States
	{
	Spawn:
		SLI2 AB 10 A_Look
    Loop
    See:
		SLI2 AABBCCDD 2 Fast A_Chase
    Loop
    Melee:
		SLI2 EF 8 Fast A_FaceTarget
		SLI2 G 8 Fast A_SargAttack
    Goto See
    Pain:
		SLI2 H 2 Fast
		SLI2 H 2 Fast A_Pain
    Goto See
	Death:
		SLI2 I 8 
		SLI2 J 8 A_Scream
		SLI2 K 4
		SLI2 L 4 A_NoBlocking
		SLI2 M 4
		SLI2 N -1 A_DualPainAttack("SlimeDemonSmall")
		Stop
	Raise:
		SLI2 N 5
		SLI2 MLKJI 5
		Goto See
	}
	
}

ACTOR SlimeDemonSmall : Demon 15002
{
	Health 50
	Speed 20
	Radius 10
	Height 19
	Obituary "%o was turned to goo by a slime demon." 
	States
	{
	Spawn:
		SLI3 AB 10 A_Look
    Loop
    See:
		SLI3 AABBCCDD 2 Fast A_Chase
    Loop
    Melee:
		SLI3 EF 8 Fast A_FaceTarget
		SLI3 G 8 Fast A_SargAttack
    Goto See
    Pain:
		SLI3 H 2 Fast
		SLI3 H 2 Fast A_Pain
    Goto See
	Death:
		SLI3 I 8 
		SLI3 J 8 A_Scream
		SLI3 K 4
		SLI3 L 4 A_NoBlocking
		SLI3 M 4
		SLI3 N -1
		Stop
	Raise:
		SLI3 N 5
		SLI3 MLKJI 5
		Goto See
	}
	
}

Any help is appreciated. Thanks in advance for your response! :)

Edited by Individualised

Share this post


Link to post

8 answers to this question

Recommended Posts

  • 1

Managed to get things working the way I wanted with A_DropItem. I even have a little delay for each of the 2 monsters that spawn, and the "pop-up movement" is a nice little bonus. Thanks for the help!

Share this post


Link to post
  • 0

The simplest way would be to give them the +THRUSPECIES flag. It'll allow them to move through each others, so they shouldn't telefrag each others when spawning anymore. But it'll also allow them to "stack" physically at the same place, so if you don't want that you can have them remove the flag a short while after being spawned.

	Spawn:
		SLI2 AB 10 A_Look
		SLI2 A 0 A_ChangeFlag("THRUSPECIES", false)
		Loop

Same for the small ones but with SLI3 instead.

Share this post


Link to post
  • 0

Hmm... no dice I'm afraid. They still telefrag each other. I tried removing the change to false in Spawn to see if that was the issue but that also didn't do anything. Unless I'm setting the flag wrong? I put "+THRUSPECIES" above the Health statement.

Share this post


Link to post
  • 0

Seems it is hardcoded in the pain elemental function to immediately kill the spawned actor if there isn't enough room for them. It's technically not a telefrag.

Share this post


Link to post
  • 0
3 hours ago, Individualised said:

Ah, okay. Is there a more generic function that I can use for spawning monsters that would be suitable for this?

I believe you can use A_DropItem to spawn them (it even gives them a little pop-up movement when they spawn :D) but you may have to use +THRUSPECIES mentioned above if they get stuck on eachother. One problem can be that they don't spawn facing you, in which case you can make the smaller ones skip immediately to their See state since they're in combat anyways

Edited by Test Tickle

Share this post


Link to post
  • 0

I'll try A_SpawnItemEx tomorrow. I probably tried that before I knew about +THRUSPECIES and forgot about it. A_DropItem doesn't seem to want to spawn 2 monsters even though I've specified 2 as the amount.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...