Re-code door/secret messages?

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!)
User avatar
Enjay
 
 
Posts: 26632
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re-code door/secret messages?

Post by Enjay »

I made this suggestion a few days ago: viewtopic.php?f=15&t=61739

The crux of it is that I've been increasingly using SetHUDSize and HUDMessages for my printing to screen needs but the built-in messages (key-door, key-switch and key-script messages and "A Secret Is Revealed!" etc) do not match the appearance of my own HUDMessages. I can get them close-ish with the scaling options, but not exactly right. The suggestion is to be able to set scaling to emulate specific screen resolutions for messages (effectively like using SetHUDSize for them) but it's quite clear that delving into that stuff is a bit of a nightmare.

I know that I could just script all such messages myself but I'd also like to retro-fit some stuff to existing levels or even just have something that I can autoload for my own use.

So, with all the new stuff that has been exposed to modders, I wondered if anyone could think of any way to use whateversuitablefeaturexists to auto-change those messages to a HUDMessage and still have the keychecking and whatever work as originally intended? Some sort of XLAT entry in combination with an ACS library, of ZScript or something?

I expect that this is probably too deep in the code and not exposed to modders, but I've been impressed by the ingenuity of folks on here before when asking about equally bizarre things, so I thought there'd be no harm in asking. :)
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: Re-code door/secret messages?

Post by Kinsie »

The stuff that happens when finding a secret can be customized by overriding the OnGiveSecret function in the player class.

Code: Select all

// called on getting a secret, return false to disable default "secret found" message/sound
virtual bool OnGiveSecret(bool printmsg, bool playsound) { return true; }
User avatar
Enjay
 
 
Posts: 26632
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Re-code door/secret messages?

Post by Enjay »

I could maybe look into that and get it to run a script with a HUDMessage instead of just putting up its regular message.

Thanks. :)


It's getting late here though so I'll have to leave it to tomorrow.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49188
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Re-code door/secret messages?

Post by Graf Zahl »

I think the best option here is to have a scriptable override of Console.MidPrint, or to be more precise, have the native C_MidPrint function call something on the script side before printing stuff itself. That shouldn't be too hard to add.

Return to “Scripting”