Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
The_Hatstand

Console Message on Monster death

Recommended Posts

Hello folks,

I'd like to make a very slight mod to the Doom 2 source, so that a message would be posted to the console every time a monster is killed. I don't think it should be too difficult but unfortunately I have no idea where to start. It doesn't need to relate to a specific monster, or keep count, simply to print a message to the console, as it does when you pick up an item.

Does anybody have any ideas of where/how I should make the mod? I'm working on a small project inspired by the Doom engine, and I'll post the results when I get it working, maybe it would be of some interest to you.

Thanks in advance.

Share this post


Link to post

Which type of console are you referring to? I ask because in the context of a game console usually refers to the sort of pop-down thing introduced by the Quake engine that allowed changing configuration and issuing commands mid-game. The vanilla DOOM engine doesn't have one.

The other type of console that I can think of at the moment is a system console window, such as the type of which Win32 console programs automatically get one at startup, or can be created and bound to standard output via some Win32 API incantations in any program.

For the latter, you'd end up just doing something similar to this in P_KillMobj (p_inter.c):

... 
printf("A %d killed a %d\n", 
       source ? source->type : -1, // really needs a better solution
       target->type);
...
For the "better" solution I would suggest that you add a "const char *name" to mobjinfo_t (info.h), and give every thing type an appropriate name in info.c.

Then you could pull source->info->name and target->info->name when the pointers are valid, and use "Unknown source" as a string literal when they are NULL (a NULL source value is possible in P_KillMobj when things die due to such causes as being crushed or melting in a pool of nukage).

Share this post


Link to post

Ah yes, I meant the second - the system console window. I'm running Doom 2 on Ubuntu, so I want to pipe || the output into a .txt doc, so I can connect it with an arduino (electronics interface). Basically I want to trigger a real-world event when a monster is killed in the game.

Thanks for your prompt response, I will give it a try now.

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
×