Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
cyber-menace

Reading a groups health.

Recommended Posts

Is there anyway to use the GetActorProp to read the Health of a large group of monsters with the same tag. When I tried it only read the health of one random monster in the group.

Share this post


Link to post

I'd guess the best way of doing this would be with an array. I don't know the specific functions in Zdoom though, check the editing resource for how to do it.

Share this post


Link to post
cyber-menace said:

There aren't too many enemies, so I decided to make a bunch of variables. example:

minicybHP1
minicybHP2
minicybHP3
etc


Eeewww! Use arrays!

int bla[2];

bla[0] = 123;
bla[1] = 456;
like that.

Share this post


Link to post

I don't need this code anymore anyway. The health bar gets very inaccurte if too many enemies are applied to it. The overkill from enemies cause odd glitches.

Share this post


Link to post
cyber-menace said:

I don't need this code anymore anyway. The health bar gets very inaccurte if too many enemies are applied to it. The overkill from enemies cause odd glitches.




You have to take into account that dead monsters can have negative health. So you cannot simply add the numbers. That will inevitably give incorrect results.

Share this post


Link to post
Graf Zahl said:

You have to take into account that dead monsters can have negative health. So you cannot simply add the numbers. That will inevitably give incorrect results.

Heh, you just inadvertently solved a problem I was having with the player's health bar in my project.

Share this post


Link to post

Hmm, can you not decide whether or not to factor in a monsters HP based on whether it is a positive number or not?

Share this post


Link to post
chilvence said:

Hmm, can you not decide whether or not to factor in a monsters HP based on whether it is a positive number or not?



Of course you can. But you first have to know this fact before you can handle it. ;-)

Share this post


Link to post
Linguica said:

If you have a big group why not just have the bar tell how many monsters are still alive?


That's precisly what I did. There were 31 Monsters so I spread it out evenly along the bar. Much easier calculation...

Share this post


Link to post

Yeah, I'm thinking if you check each monsters health individually using a loop, you will be able to check whether their health is greater than 0 before adding it to the general catch all health variable. Would use up a lot of TID's though...

Share this post


Link to post

I'm fully aware of that. Luckily these are summoned monsters so I can have as many TIDs as I want... at least I can have A LOT of TIDs. I tried this before, but if you overkill a monster it won't record it and thus UNDERKILLING the monster instead. It's really quite wierd. I would need to add 2 or 3 lines of script per monster to fix this... and even then it would be too messed up...

Share this post


Link to post

Meh, I am unarmed for thinking about this. What would be the right command for reading a monsters health?

Share this post


Link to post
chilvence said:

Meh, I am unarmed for thinking about this. What would be the right command for reading a monsters health?




health=GetActorProperty(tid, APROP_HEALTH);

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
Sign in to follow this  
×