Why does my death animation not play when the enemy has 0 health?

Chief Man
Thu, 15 Apr 2021 06:08:56 +0000
Character & Animation

I have setup a health system where 1.0 means the enemy has full health and 0.0 means they have no health. The value range for the health is between 0 and 1 with a default value of 1.0. Each hit from my sword does 0.1 damage so it takes 10 hits for an enemy to have 0 health. I have setup a custom event that is supposed to update the health, check if the health is less than or equal to 0, and if that’s true then print a TRUE string, and then play my death animation. However, on the tenth hit the enemy does not play the death animation, and the print string does not print anything. So basically, it is not correctly detecting the enemy’s health. I know that the enemy is taking damage because I can see it on the health bar, and a print string shows the enemy’s health decreasing as I damage it. When the enemy takes the tenth hit, it says their health is “-0.0” I’m not sure if that’s normal or if it’s supposed to be “0.0” but I just thought I’d say it anyways.

8 posts - 1 participant