Health Point Bar for multiple monsters

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!)
User avatar
Mini--Joe
Posts: 97
Joined: Sun Jul 27, 2014 10:25 am

Health Point Bar for multiple monsters

Post by Mini--Joe »

https://zdoom.org/wiki/Health_Point_Bar

I used this for a boss and got it to work, but I eventually want to have it work for multiple monsters with the same TID. Is this possible? How would I do this?
I changed multiple monsters to have the same TID for this, but it only counted one of the monsters' health.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Health Point Bar for multiple monsters

Post by Blue Shadow »

I've reworked the demo so that you can pass the TID of the monster you wish to have a health bar displayed. All you need to do is call a script:

Code: Select all

script 1 (void)
{
	ACS_NamedExecuteWithResult("DrawMonsterHPBar", 666); // ... or whatever the actual TID is.
}
You can also set the position of the bar with the second and third args if you feel like to.

https://www.dropbox.com/s/8hq15bh2a9jv2 ... o.pk3?dl=1
User avatar
Mini--Joe
Posts: 97
Joined: Sun Jul 27, 2014 10:25 am

Re: Health Point Bar for multiple monsters

Post by Mini--Joe »

Blue Shadow wrote:I've reworked the demo so that you can pass the TID of the monster you wish to have a health bar displayed. All you need to do is call a script:

Code: Select all

script 1 (void)
{
	ACS_NamedExecuteWithResult("DrawMonsterHPBar", 666); // ... or whatever the actual TID is.
}
You can also set the position of the bar with the second and third args if you feel like to.

https://www.dropbox.com/s/8hq15bh2a9jv2 ... o.pk3?dl=1

Oh man, thank you! This is perfect! I wasn't expecting help so quickly, too.

EDIT: Ok what the hell, It worked when I tested it the first time just fine. The bar went down when I shot any of the tagged monsters, but now it won't? This is ridiculous, I didn't change anything in the script, it should just keep working. Ugh.

EDIT2: So I changed the script to this:

Code: Select all

script 12 (void)
{
	Thing_Spawn (83, 29129, 270, 667);
	delay (16); 
	ACS_NamedExecuteWithResult("DrawMonsterHPBar", 667);
	Thing_Spawn (84, 29129, 270, 668);
	delay (16); 
	ACS_NamedExecuteWithResult("DrawMonsterHPBar", 668); 
	
}
and that makes 2 different HP bars, I assume this was the initial idea. Glad I got something to work for once.

Return to “Scripting”