Changing Item Pickup Message Ingame

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!)
JossTheFox
Posts: 15
Joined: Sat Jun 19, 2021 6:35 am

Changing Item Pickup Message Ingame

Post by JossTheFox »

Alright, so, I have no idea if this is the right place to put this, but I couldn't really think of anywhere else.
I have a simple question: pretend there's a room with a blue key in it, and when you pick up the blue key, monsters teleport in behind you. Normally, the pickup message would just be "Picked up a blue keycard." or something. However, I'm wondering if there's a way to make that specific item have a different pickup message, like "Picked up a blue keycard, oh, and look behind you." without making it a completely different Thing. The only way I thought of to do this would be through scripting, hence why I'm here.
Is that possible at all, or am I just trying to cut corners and should make it a separate Thing?
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: Changing Item Pickup Message Ingame

Post by NeoTerraNova »

I know this may not help, but I'd be making Fake Items for this, myself. An Item/Thing that Inherits from the Blue Keycard, and has a custom pickup message (i.e. "BlueCardTrapped").
User avatar
Enjay
 
 
Posts: 26403
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Changing Item Pickup Message Ingame

Post by Enjay »

The problem with that might be the fact that keys have special handling (for locks, status bar icons etc). So a straight up fake item that inherits from the key might not work in all circumstances that you want.

However, with a slight modification, it could work just fine: the fake item could just be a standard inventory item (the old-style FakeInventory item would work here I guess) that silently gives the real key. So, you pick up the fake item, you get the fake item message but the fake item gives you the real one, so you do in fact have the correct key and therefore all associated features work.
Plasmazippo
Posts: 101
Joined: Sat Sep 25, 2021 11:55 am
Operating System: Windows 10 ARM
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: Changing Item Pickup Message Ingame

Post by Plasmazippo »

Enjay wrote:The problem with that might be the fact that keys have special handling (for locks, status bar icons etc). So a straight up fake item that inherits from the key might not work in all circumstances that you want.

However, with a slight modification, it could work just fine: the fake item could just be a standard inventory item (the old-style FakeInventory item would work here I guess) that silently gives the real key. So, you pick up the fake item, you get the fake item message but the fake item gives you the real one, so you do in fact have the correct key and therefore all associated features work.
Doesn't the CustomInventory flag also works for this? I see it used a lot with custom keys, usually to distinguish pickup sounds for keycards, skull keys and regular (lever lock or pin tumbler) keys.
User avatar
ramon.dexter
Posts: 1241
Joined: Tue Oct 20, 2015 12:50 pm
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Changing Item Pickup Message Ingame

Post by ramon.dexter »

I would make it inherit from CustomInventory, omit use state and put giving of the real true key into the item's pickup state. Dirty, but works.
User avatar
Sir Robin
Posts: 392
Joined: Wed Dec 22, 2021 7:02 pm
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Changing Item Pickup Message Ingame

Post by Sir Robin »

Question: Why bother attaching that message to the blue key pickup? Why not make the teleport trigger responsible for the message? Wouldn't that make more sense anyway?
User avatar
Enjay
 
 
Posts: 26403
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Changing Item Pickup Message Ingame

Post by Enjay »

Agreed, and a printed or HUDMessaged bit of text is going to be far more noticeable compared to a usually-ignored pickup message hidden away at the top of the screen.
JossTheFox
Posts: 15
Joined: Sat Jun 19, 2021 6:35 am

Re: Changing Item Pickup Message Ingame

Post by JossTheFox »

Sir Robin wrote:Question: Why bother attaching that message to the blue key pickup? Why not make the teleport trigger responsible for the message? Wouldn't that make more sense anyway?
I didn't want to make it too noticeable, to be honest. It's probably unnecessary, considering the player would probably hear the monsters waking up when the trap opens anyways, so I didn't want to intrude on the screen too much (even though the print messages aren't too intrusive). I just wanted to add it as a little detail.
Thanks for the input, though :)
User avatar
Enjay
 
 
Posts: 26403
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Changing Item Pickup Message Ingame

Post by Enjay »

Well, if you do still want to do it, it's very possible by a few methods.

If you need an example file or something, it won't take long to whip one up.
JossTheFox
Posts: 15
Joined: Sat Jun 19, 2021 6:35 am

Re: Changing Item Pickup Message Ingame

Post by JossTheFox »

Enjay wrote:Well, if you do still want to do it, it's very possible by a few methods.

If you need an example file or something, it won't take long to whip one up.
I don't think I'll need an example, but thanks for the offer!

Return to “Scripting”