Something I've wanted to do in a mod for quite some time is have a healthbar printed to the screen when you're aiming a weapon at an enemy. I've tried studying jpalomo's JPHUD to figure out how, but since I'm all thumbs when it comes to ACS, I didn't get anywhere.
This was the primary reason for me suggesting what became [wiki]GetSpawnHealth[/wiki]. I know that the activator for the script needs to be set to the target (as a weapon will be calling the script), but what equation should I use to determine target's current health out of max health? I can't just divide the former by the latter, because that returns a number smaller than 1, and thus it'll be rounded up, right?
Healthbar for targeted monster
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: Healthbar for targeted monster
Here is a basic demo that displays "enemy" health (not bar*):
Spoiler: *
Re: Healthbar for targeted monster
Actually my intention was to have it render through a weapon's Flash state, like this:Blue Shadow wrote:If your ultimate goal is to do the drawing of bars in SBARINFO, I can adjust the demo to do just that.
Code: Select all
Flash_TargetHP:
TNT1 A 0 A_JumpIf(CallACS("CheckTargetHP", 0, 0, 0)>=100,"TargetHPMax")
TNT1 A 0 A_JumpIf(CallACS("CheckTargetHP", 0, 0, 0)>=90,"TargetHP90")
...
TargetHPMax:
H100 A 1
Goto LightDone
TargetHP90:
H090 A 1
Goto LightDone
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: Healthbar for targeted monster
Curious, why through a weapon, instead of more suitable solutions like ACS or SBARINFO?amv2k9 wrote:Actually my intention was to have it render through a weapon's Flash state
- T_Silverwolf
- Posts: 50
- Joined: Mon Feb 24, 2014 2:26 pm
- Location: http://www.tammysilverwolf.com
- Contact:
Re: Healthbar for targeted monster
I'd actually be quite interested in this, is there a demo out there somewhere?
Re: Healthbar for targeted monster
Hi!
I think this would be an initial try from me:
Just use it as you wish.
I think this would be an initial try from me:
Just use it as you wish.
Re: Healthbar for targeted monster
Thanks for all your help, BlueShadow & cocka!




Re: Healthbar for targeted monster
@T_Silverwolf
It's part of a bigger system yet to be released. The hp/class name thing was just for testing purposes but should be easy to recreate.
@amv2k9
That's a hella sweet looking hud man!
It's part of a bigger system yet to be released. The hp/class name thing was just for testing purposes but should be easy to recreate.
@amv2k9
That's a hella sweet looking hud man!
- T_Silverwolf
- Posts: 50
- Joined: Mon Feb 24, 2014 2:26 pm
- Location: http://www.tammysilverwolf.com
- Contact:
Re: Healthbar for targeted monster
Wow, nice. O_o I'm trying to do something vaguely similar (though not a point and click style thing) I guess I'll have to keep digging, scripting really isn't my strongest suit.kodi wrote:@T_Silverwolf
It's part of a bigger system yet to be released. The hp/class name thing was just for testing purposes but should be easy to recreate.
@amv2k9
That's a hella sweet looking hud man!