I need some help.

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

I need some help.

Postby Dachre » Sun Dec 05, 2021 10:25 am

Hello,

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.
Dachre
 
Joined: 05 Dec 2021
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)

Re: I need some help.

Postby Caligari87 » Mon Dec 06, 2021 7:18 am

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 allExpand view
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(); }
    console.printf(msg);
  }
}


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.
User avatar
Caligari87
User Accounts Assistant
 
Joined: 26 Feb 2004
Discord: Caligari87#3089
Github ID: caligari87

Re: I need some help.

Postby Dachre » Mon Dec 06, 2021 10:20 pm

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.
Dachre
 
Joined: 05 Dec 2021
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)


Return to General

Who is online

Users browsing this forum: No registered users and 4 guests