Search In
• More options...
Find results that contain...
Find results in...

## 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.

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.

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

```minicybHP1
minicybHP2
minicybHP3
etc
```

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.

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.

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

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.

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.

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

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. ;-)

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...

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...

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...

chilvence said:

health=GetActorProperty(tid, APROP_HEALTH);