How to have a weapon display a "tip" message when equipping?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
Post Reply
User avatar
JtoTheB
Posts: 55
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

How to have a weapon display a "tip" message when equipping?

Post by JtoTheB »

Basically, I want to make it so whenever you take out a weapon, a little message appears at the bottom giving you a tip of sorts about it. (ex. "Great for close range, terrible at long range.") Is there a way I could do this? If so, it would be greatly appreciated if someone were to either give me some code to base off of or give me a tutorial on how to.
User avatar
JtoTheB
Posts: 55
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: How to have a weapon display a "tip" message when equipping?

Post by JtoTheB »

Any help? (Sorry to bump post)
User avatar
Enjay
 
 
Posts: 27274
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: How to have a weapon display a "tip" message when equipping?

Post by Enjay »

I'm sure that there would be a ZScript way of making tips (not sure how to do it myself). However, a less flexible and less sophisiticated way of doing things could be to hijack the weapon tag property and put your tips in there.

Image

Of course, you'd also have to ensure that your users had their options set to show tags. ( displaynametags=2 )
User avatar
JtoTheB
Posts: 55
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: How to have a weapon display a "tip" message when equipping?

Post by JtoTheB »

I'm probably gonna do the tag method, as I'm only educated in DECORATE and not Zscript.
User avatar
Enjay
 
 
Posts: 27274
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: How to have a weapon display a "tip" message when equipping?

Post by Enjay »

Another way to do it that might give you more control (I don't know why I didn't think of this before - I've even done it myself before now) is that you could put your tip into an ACS script and run the script from your weapon's decorate. You can use functions like ACS_NamedExecute directly in one of your weapon's decorate frames (probably something in the select sequence, but it might be possible to define a pickup state for a weapon and put it there - I haven't checked that) and the ACS script could print whatever you like to the screen.

You'd probably want to set up your ACS so that it only calls the script once per raise, but that's easy enough to do. You could also put in checks if you only wanted it to happen the first time that you raised that particular weapon.

In fact, if you did want it to show only on the first pickup, it could be even easier. You could attach the script to a map-placed weapon and the script would run when the player picks it up. No need for DECORATE changes at all. That's not so good if the player can get the weapon via it being dropped by an enemy though.

Edit: proof of concept attached.
Just load up the PK3 in Doom2. It will give you a message (that lasts about 4 seconds) when the pistol first appears. If you pick up the shotgun, it will give you a different message.
You can switch between the weapons and the pistol and shotgun will always give their messages. I didn't bother giving a message to any other weapons (including the fist).

If you did only want it to happen once per weapon, that would be easy enough to do.

I did it all in DECORATE because that's your preference. I'm sure in ZScript you could probably do away with the ACS entirely.
Attachments
VerboseGunz.pk3
(1.8 KiB) Downloaded 1 time
Post Reply

Return to “Scripting”