Page 1 of 1

[0.16.51] Unit not dying when decrementing health to zero

Posted: Wed Jul 11, 2018 9:03 pm
by TheSAguy
Hi,

I've created a unit with a negative healing_per_tick = -1
So it should only have a certain time to live.

What seems to happen though, is that once it reaches 0, it does not die, and actually becomes immortal once it reaches 0.
So, the player of player's units can kill it if they damage it before it's health reaches 0, but once it reaches 0, it can't be killed....

Image

Once it reaches 0, I cant target it to kill...

Image
This seems to be a bug, but I'm not entirely sure...

Any code I can provide to help out?

Re: Unit not dying

Posted: Wed Jul 11, 2018 9:38 pm
by DaveMcW
You should probably report this in the bug forum.

Possible developer solutions:
- Kill unit when healing_per_tick takes HP to zero.
- healing_per_tick does not bring unit below 1 HP.
- Don't allow negative healing_per_tick

Re: Unit not dying

Posted: Thu Jul 12, 2018 7:05 am
by darkfrei
DaveMcW wrote:You should probably report this in the bug forum.

Possible developer solutions:
- Kill unit when healing_per_tick takes HP to zero.
- healing_per_tick does not bring unit below 1 HP.
- Don't allow negative healing_per_tick
The last is much more friendly for ups, so it will be so realized.

Re: Unit not dying

Posted: Thu Jul 12, 2018 7:16 am
by eradicator
I doubt UPS cares about +1 or -1. Just kill the thing when it drops to hp <= 0.
Does on_entity_damaged trigger for self-mutilation?

Re: Unit not dying

Posted: Thu Jul 12, 2018 7:27 am
by darkfrei
eradicator wrote:I doubt UPS cares about +1 or -1. Just kill the thing when it drops to hp <= 0.
Then every healing (negative healing) entity must be checked, if the health is 100% and if the health is ≤0.

Re: Unit not dying

Posted: Thu Jul 12, 2018 8:06 am
by bobingabout
Arguing that killing an entity if the health drops below 0 being too power hungry is... pointless really.

if you could see just how complex some of these functions already are, you'd realise it already does <=0 and <=1 checks all over the place to bring them back to 0 and 1. Adding one to healing per tick isn't going to kill performance, and calling this.die() if it does drop to or below 0 should be very possible.

Re: [0.16.51] Unit not dying when decrementing health to zero

Posted: Tue Jul 31, 2018 3:55 am
by Rseding91
Thanks for the report. I've changed it for 0.17 so when an entity has healing_per_tick of a negative value when it reaches 0 health it dies.

Re: [0.16.51] Unit not dying when decrementing health to zero

Posted: Tue Jul 31, 2018 5:56 pm
by TheSAguy
Great!
This now allows for a strong early unit, that if you can't kill, you just have to run away, it will eventually die :)
Thanks.