Count/Display Ammo Count on HUD

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.

Count/Display Ammo Count on HUD

Postby ReX » Mon Apr 27, 2020 9:46 am

I want to accomplish the following via ACS:

1. I want to count the player's available ammo, by ammo type, during a play-through of a given map. I believe I can do this by using CheckInventory
2. I want this to be displayed in the upper left-hand corner of the HUD
3. I want the ammo count to be updated each time the player expends ammo. This is where I am running into trouble. How to set up a script to check the inventory only when the player is expending ammo? Perhaps it might be better to have the script continuously check the ammo count and display it. But wouldn't this be a wasteful use of computational resources?

I have done a cursory search of the forums, but have found nothing. I'm guessing someone has already developed what I'm asking about, but I can't find anything.

I'd appreciate any help.
User avatar
ReX
Title? I don't need no steenkin' title!
 
Joined: 05 Aug 2003
Location: Quatto's Palace

Re: Count/Display Ammo Count on HUD

Postby m8f » Mon Apr 27, 2020 10:46 am

I believe AmmoInfo from Simple HUD Add-ons does exactly what you want, and it continuously checks ammo. No one complained about performance issues yet.
User avatar
m8f
dreamer
 
 
 
Joined: 29 Dec 2017
Location: Siberia (UTC+7)
Discord: m8f#0629
Github ID: mmaulwurff

Re: Count/Display Ammo Count on HUD

Postby ReX » Mon Apr 27, 2020 1:58 pm

m8f wrote:I believe AmmoInfo from Simple HUD Add-ons does exactly what you want, and it continuously checks ammo. No one complained about performance issues yet.

Thank you, m8f. I looked over the contents of the pk3 file, and realized the scripting is far beyond my capabilities to adapt into my own mod. I don't wan't to simply merge AmmoInfo into my mod; rather, I had hoped to pull relevant parts of the code into it. Moreover, it appears that the HUD display for the ammo count needs to be enabled using the player's menu. I was hoping to make the display a default.

Still, thanks for pointing AmmoInfo out to me.
User avatar
ReX
Title? I don't need no steenkin' title!
 
Joined: 05 Aug 2003
Location: Quatto's Palace


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest