Removing dead monsters after death help

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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!)
Post Reply
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Removing dead monsters after death help

Post by Gunslaher_Pi »

Hiya peeps.

So I made a horde mode map but in my ignorance I completely forgot that adding new monsters to an already cluttered cemetery of dead monster actors can....well slow lower performing PC's down.

So I was wondering if I could use A_remove or something to that effect with a tic delay to make dead monsters vanish after death. This would definitely help with slower machines. I.e - mine

Tia!
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: Removing dead monsters after death help

Post by Logan MTM »

Code: Select all

Death.Remove:
TNT1 A 1
Stop
Just what you need is some kinf of check in the regular Death State and Jump to "Death.Remove".

If you want right after die, the last frame should not be -1. Change to something that end with positive Tic and Stop.


#HackyFTW
Last edited by Logan MTM on Tue Jan 04, 2022 8:16 am, edited 3 times in total.
User avatar
Gunslaher_Pi
Posts: 47
Joined: Sun Jan 17, 2021 3:41 am
Graphics Processor: Intel (Modern GZDoom)
Location: Aussieland - 3D REALMS OG DESIGNER

Re: Removing dead monsters after death help

Post by Gunslaher_Pi »

Awesome! Thank you so much! This will be key for when I finish my .wad

Especially since I'll have 4 players running around killing.

Thanks buddy!!!
XASSASSINX
Posts: 380
Joined: Tue Dec 20, 2016 4:53 pm
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Removing dead monsters after death help

Post by XASSASSINX »

As a small bonus, you can also use A_FadeOut, since it looks smoother. Even better, combine it with something like A_CheckSight to only make the enemy despawn after you lose sight of him, to, you know, not dissapear in sight. Like this:

Code: Select all

  Death:
    SPOS H 5
    SPOS I 5 A_Scream
    SPOS J 5 A_NoBlocking
    SPOS K 5
DeathWait:
    SPOS L 72 A_CheckSight("DeathFade") //Make this check every 3 seconds.
    Loop
DeathFade:
    SPOS L 3 A_FadeOut(0.1)
    Loop
Just as a note, this does make enemies not being able to be ressurected, and i'm not using using a flag would make they revivable, but then it might not reduce lag as much.
User avatar
Player701
 
 
Posts: 1709
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Removing dead monsters after death help

Post by Player701 »

Just for the record, the engine also provides built-in functionality to remove excess corpses which comes from Hexen; see A_QueueCorpse/A_DeQueueCorpse for details. Basically, you need to call A_QueueCorpse somewhere in the death state and A_DeQueueCorpse somewhere in the raise state. It also does not prevent monsters from being able to be resurrected. The maximum number of corpses is controlled via the sv_corpsequeuesize CVAR (default: 64), and can also be made infinite by setting the value to -1.
Post Reply

Return to “Scripting”