Health value don't update

finaratic

Member
After i made my AI use Behavior Designer for brains i stumbled across some issue with updating enemy health at runtime. So i had this system where each round enemy's health are increased. It worked fine until i made my characters use Behavior Designer. So my old characters updating health fine, but new ones cant update VALUE field, MAX VALUE updates right. (Example of the code and the result. enemy must have 300 value and 300 max value but it only updated max value )


1688397412332.png
1688397360497.png

I figured out that turning off OnRespawn event in the Behavior Designer is fixing the issue, but i dont know why it dosent let me change health if i have OnRespawn Event
Currently i have Execute event of OnWillRespawn and next to it is OnRespawn. With just OnWillRespawn it works, but will this set up be right if i dont execute OnRespawn and execute just OnWillRespawn? In the respawner class this events go after each other so thats why i am concerned


1688398543437.png
 

Attachments

  • 1688398532998.png
    1688398532998.png
    51.7 KB · Views: 0
Last edited:
It's tough to say without stepping into it. When the health changes I recommend stepping into the method to determine why it's not updating. It's likely an execution order issue.
 
Thanks, i fixed it by calling events from separate script. I just put OnWillRespawn, OnRespawn and ImmidiateTransformChange in OnEnable method. Not sure how to make it work from Behavior Designer, but if i call them from separate script it seems to be working
 
Top