I need some help.

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Posts: 2
Joined: Sun Dec 05, 2021 9:53 am

I need some help.

Post by Dachre »


The owner of a Discord server I'm a member of is planning on organizing some classic Doom events/tournaments/seasons, etc. She's planning on both deathmatch and cooperative events. About 1,000 years ago, I wrote a little program that would parse a text log and spit out an HTML document that presents the post-match stats in a visually pleasing way—think the old "UTStats" that was shipped with the original Unreal Tournament.

She asked me for two things, one to blow the dust off of that program, make sure it still works, and update the visuals a bit. That bit's easy enough. But she also wants it to be able to process the co-op stats. Processing that is easy enough, but the problem is—the data she wants processed doesn't exist. She's looking for "how many Imps player so-and-so shot with a Super Shotgun," and those kinds of events aren't printed to the console, thus, I cannot process them.

So, my question boils down to: does there exist a mod anywhere that prints detailed monster kills to the console? I've looked, but I haven't found any such mod. If such a mod doesn't exist, how difficult would it be to implement such a thing? I've never dabbled in Doom modding/scripting before I my life, so I have no idea where to even start on such a thing.

Thanks in advance for any help/advice you can provide.
User avatar
User Accounts Assistant
Posts: 5995
Joined: Thu Feb 26, 2004 3:02 pm
Discord: Caligari87#3089
Github ID: caligari87
Preferred Pronouns: He/Him

Re: I need some help.

Post by Caligari87 »

If using GZDoom, you could fairly easily write an EventHandler with a WorldThingDied override (or others!) that prints the appropriate details to console. The following code is fairly rough and probably won't work out-of-the box, but it should give an idea of how to accomplish a "killfeed" for reviewing later.
the wiki wrote: void WorldThingDied (WorldEvent e)
  • Actor Thing - The actor that died.
    Actor Inflictor - If Inflictor is not null, it is the actor that caused the damage that killed Thing. While the event does not provide a pointer to the source of the damage (killer), it, if not null, is stored in the target field of Thing.

Code: Select all

class KillTracker : EventHandler {
  override void WorldThingDied(WorldEvent e) {
    actor WhatDied = e.thing;
    actor WhatDamaged = e.inflictor;
    actor WhatKilled = e.thing.target;
    string msg = WhatDied.GetClassName().." died.";
    if (WhatDamaged) { msg = msg.. " It was damaged by "..WhatDamaged.GetClassName(); }
    if (WhatKilled) { msg = msg.. " It was killed by "..WhatKilled.GetClassName(); }
If not using GZDoom, then you'll probably need to use some other scripting language specific to whatever port you're using, or in the case of vanilla Doom, edit the source code.
Posts: 2
Joined: Sun Dec 05, 2021 9:53 am

Re: I need some help.

Post by Dachre »

Thank you for the reply. The class you provided does indeed establish the functionality that I needed, but I could use a hand ironing out the specific details. I checked the wiki and searched for examples to try and figure it out myself, but haven't had much luck. Per the above example, what I'm experiencing is:

WhatDamaged.GetClassName() always returns "DoomPlayer," but I need the specific playername that a player has defined in their player setup, or some other unique method of identification.

WhatKilled.GetClassName() appears to always return the name of the projectile or impact entity responsible for the death, e.g. "BulletPuff" for pistol, shotgun, etc.; "Plasmaball" for plasma rifle kills. For unique projectiles this is still useable, however the return of "BulletPuff" for all "bullet-firing" weapons, for example, makes it impossible to differentiate what weapon was used.

I apologize if these further questions are somewhat amateurish, but I greatly appreciate your help.

Return to “General”