Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  

can't count dead monsters?

Recommended Posts

I have a level where random monsters constantly randomly warp in (spawnspotfacing). And of course they're constantly dying too. I (might) want to make a hud message display the exact # of each type of monster that has died so far, maybe like:
"zombiemen: 67, shotgunguys: 42, bla bla"

Well say if I'm only allowed to count the living monsters (that's what zdoom wiki says about thingCount).. say there's currently 8 spectres... now on the same tic one warps in and one dies.. it'd look like nothing happened since there's still 8 spectres. Or something. Counting spectre corpses seems much simpler.

Its also kinda awkward to count living because often when a monster TRIES to warp, it is blocked so doesn't actually warp or come into existence.

Share this post

Link to post

A possible solution is to use variants of the monsters. Make a decorate replacement for them. Change just the death state so that it calls a script. Something like this:

Actor ScriptedDemon : demon replaces demon
        TNT1 A 0 ACS_ExecuteAlways(337, 0, 1)
        Goto Super::Death
Then make script 337 (or whatever number you give it) update an array (one that's global to the map) of counters. Each index corresponds to one monster type. (Here, I've arbitrarily given 1 to demons. Maybe 0 is imps.) Whenever it's called, it increases the value at the index given to it by its parameter.

You use ACS_ExecuteAlways so that the script can run several times at once if many monsters die simultaneously. (With plain old ACS_Execute, each script can run only one at a time, so if two demons die together, only one would be counted.)

Share this post

Link to post

gez to the rescue! that worked great (i'm still a decorate noob).

All this time I thought reveNants were reveRants... no wonder they were never warping..

Only the demon gave trouble:
actor demon2 : demon replaces demon
(doombuilder complained that demon2 was used twice, but I improvised and called it demon2ASS and now it works. That'll teach that ass for trying to ass with me).

Here's the script if anyone cares:

//0th index stands for "zombieman"
//1st index stands for "shotgunguy"
int deads[18];

script 5 (int index){
    deads[index] += 1;
Each monster's decorate replacement code feeds a unique parameter (int index) to script 5 upon death.

getlevelinfo could come in handy sometime, but it seemed to count only the entire horde, rather than counting specific types of monsters.

Share this post

Link to post

Demon1 and Demon2 are used for the Hexen chaos serpents.

Share this post

Link to post

Yeah, I noticed you called revenants reverants, but I didn't say anything cuz I didn't want to be a dick or thought you called them that as a joke or something. lols

Share this post

Link to post

why dont you just use setthingspecial when you spawn it. that'll do the same thing and then you don't have to mess with decorate.

Share this post

Link to post

another question:

for thingcount, here are wiki examples:

ThingCount(T_IMP, 0)
ThingCount(T_BARON, 0)
ThingCount(T_DEMON, 0)
ThingCount(T_NONE, 5)

well, what are the rest of the T_WHATEVER names?
example, t_chaingun might refer to the weapon whereas I want to refer to the monster.
t_chaingunguy and t_chaingunner didn't have the word turn red colored (recognized) in doombuilder2.

and t_fatso doesn't work but t_mancubus does etc.

I want to count all living monsters of any type.
thingcount(t_none,0) seems to count way more than just monsters.
getlevelinfo_total_monsters isn't 'compatible' with my current code,
so I guess I want t_imp + t_baron + etc

My code is a messy suckfest, so will probably just leave the decorate part since it works rather than messing with setthingspecial.

Share this post

Link to post
gggmork said:

well, what are the rest of the T_WHATEVER names?

The identifiers are listed on the actor's page. For example, look at the imp's page, see these "Spawn ID / Identifier" stuff in the infobox?

Otherwise, there's a full list here.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this