Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
One Doomed Bunny

Need help with displaying a special icon on my HUD.

Question

Hello!

 

So, what I am trying to do is to display an "icon" on my custom HUD. Basically, if the player has no armor points it draws a heart icon, but if the player has 1+ armor points it draws a shield icon and removes the heart icon. 

 

If anyone has any idea how to do this, it would be very much appreciated.

 

 

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 1

Yeah, you can probably do that in SBARINFO and certainly do that in ZScript. Using ACS for such things is no longer encouraged.

 

For reference, you can look at the various implementations.

As you can see, they have conditions so as to only draw armor stuff if the player actually has an armor. You can do the same kind of things, except instead of having

if (armor)
{
	draw armor
}

You'd make it

if (armor)
{
	draw armor
}
else
{
	draw heart
}

 

For SBARINFO, if that's simpler for you than ZScript, you'd probably want to experiment with DrawSwitchableImage. I've never used SBARINFO or really looked at SBARINFO code, so I don't have examples you can look at, sorry.

Share this post


Link to post
  • 0
1 hour ago, Payload4367 said:

https://zdoom.org/wiki/HudMessage

 

Scroll down to the very bottom of the page. It explains how to display an image on the hud.

You'll need a script to check the players armor and then display the image. Unfortunately, I'm not sure how to do this...yet. Hope this helps.

 

hmmm... This sure does paint a bigger picture of what to do but I wonder if something similar can be done in SBARINFO.

Share this post


Link to post
  • 0
1 hour ago, Gez said:

Yeah, you can probably do that in SBARINFO and certainly do that in ZScript. Using ACS for such things is no longer encouraged.

 

For reference, you can look at the various implementations.

As you can see, they have conditions so as to only draw armor stuff if the player actually has an armor. You can do the same kind of things, except instead of having


if (armor)
{
	draw armor
}

You'd make it


if (armor)
{
	draw armor
}
else
{
	draw heart
}

 

For SBARINFO, if that's simpler for you than ZScript, you'd probably want to experiment with DrawSwitchableImage. I've never used SBARINFO or really looked at SBARINFO code, so I don't have examples you can look at, sorry.

 

Okay, this is what I came up with: 

DrawSwitchableImage Armor , "HPICON","SHICON", 8, 8;

 

But it does not seem to work properly. When I pickup any armor type (bonuses, green, blue...) it still shows the heart. Even if I type "give armor" into console it still shows the heart icon. Hmmmm...

 

I know you said you never used SBARINFO but do you perhaps have any idea what is wrong here?

 

EDIT: Nevermind, I figured it out: DrawSwitchableImage ArmorType ArmorBonus, "HPICON","SHICON", 8, 8;

Edited by One Doomed Bunny

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×