All characters die immediately

After the final state machine refactor, in EU 4.26, all the characters die immediately after start playing. I presume that it’d because Health is not assigned a value upon construction, since it stops happening if I assign it a default value. But it seems to work for Sam in the final lesson, so I’m a bit confused. Has anyone else seen this behaviour?

Just for reference, if you don’t implement the state for going to back to life from dead, which I deemed innecesary, you’ll face the error that I mentioned.

Do you mean when opening the blueprint? Otherwise it shouldn’t do that when you begin play as it’s instantly assigned the max health.

When you start playing in preview mode (at least). It should get assigned the max health as you mentioned, but it seems to die before that happens. I used a log message and it in fact gets displayed. I presume that the ai blueprint gets executed somehow before begin play, therefore if you don’t implement the go back to life state machine, the animation will stay as dead

It’s still not quite clear if you’re talking about playing or just the viewport of the character blueprint. The former would be a bug and the latter is expected due to what you already worked out.

Sorry @DanM, I’m struggling to understand what are you asking about a viewport or playing. As I mentioned in both of my previous posts, this issue happens when you start playing the game (hit the big Play button in the editor), all characters will die if you don’t implement the state of going back to life from dead in the animation blueprint state machine.

Thanks for clarifying. I forgot about how Sam set it up with the Alive/Dead state.

To clear a couple things up.

What I thought was unclear was you said “start playing” which I thought was a little ambiguous as you could have been talking about the animation blueprint. You then followed up with “start playing in preview mode” which I take to mean you are talking about the animation blueprint’s preview view.

Viewport of the character blueprint vs playing in the editor


I see, I guess that the disambiguation came on the “all the characters die”, since the character blueprint will only display the one particular character that you are editing. In any case, it’s just a heads up for anyone facing that same error, if someone else took the challenge without implementing the “going back to life” state, which technically is never used in the game. Probably a good practice would be to assign a value to that property on construction (besides the beginplay stage, which is still necessary for game restart I presume), since constructors are meant for initialisation, and the state machine seems to execute before the beginplay event happens.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.