changing mugshot midgame

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!)
Post Reply
Connorpo1221
Posts: 9
Joined: Mon Jul 25, 2022 12:27 pm

changing mugshot midgame

Post by Connorpo1221 »

I was wondering if there was anyway to do this because I wanted to make it so when you pick up an armor bonus it changes the mugshot to a helmet wearing one, and if you lose all armor the mugshot would change back. I doubt this would be possible with SBARINFO but what about Zscript?
User avatar
Enjay
 
 
Posts: 27154
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: changing mugshot midgame

Post by Enjay »

It is possible to check the presence of an item in the users inventory in ZScript and then only do something if the item is/is not present. That also applies to any ZScript used to define a status bar.

As a similar principle, I use a simple check for a custom inventory item in my ZScript status bar.
if (!CheckInventory("NJHUDHider", 1))
After the above line, my code defines the status bar.
If the NJHUDHider item is not present, the status bar gets drawn. If I want the status bar to vanish (during a cutscene) I give the player the NJHUDHider item and the status bar disappears. After the cutscene, I take the NJHUDHider item away again and the status bar returns.

The same idea could probably be used to check for amour and, if present, draw one set of HUD faces, if not present, draw the other set.

It may even be possible to do in SBARINFO. As I recall, it can also draw things conditionally, depending on whether an item is present or not (e.g. keys, inventory bars and so on) but it might be less flexible.
Connorpo1221
Posts: 9
Joined: Mon Jul 25, 2022 12:27 pm

Re: changing mugshot midgame

Post by Connorpo1221 »

Thank you for replying I will try this out
Connorpo1221
Posts: 9
Joined: Mon Jul 25, 2022 12:27 pm

Re: changing mugshot midgame

Post by Connorpo1221 »

Yeah I'm trying but I really don't know zscript or Sbarinfo, how exactly would I use if (!CheckInventory("NJHUDHider", 1))

(also I'm trying to make sure this is compatible with other hud mods)
Post Reply

Return to “Scripting”