Announcement

Collapse
No announcement yet.

What is the best way to handle death?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What is the best way to handle death?

    I have a character with a health bar. As he takes damage, the health goes down. If the health bar reaches zero, the character dies, a second passes, and he respawns at the same location he died. I've tried setting a branch to check if the health is indeed at zero. If it is, I destroy the actor. This seems to work, but not sure as when I try to respawn the same actor, I get a stream of "cast failed" lines down the side of the screen. Not sure if the destroy actor is causing it or the respawn, or if I have this completely wrong. Any help would be appreciated. I am doing this within the character blueprint, if that helps.

    #2
    It's hard to say what's causing your failed casts without seeing what your doing. At a guess your most likely trying to cast a null reference with you destroying the pawn. Remember to set any pawn references with your new pawn when you spawn a new one in and possess it.
    Check out my pet project: Salvos - Maze Survival

    Looking for blueprint tutorials? Then visit my blog or YouTube channel.
    Blog: voxagon Youtube: Click

    Comment


      #3
      I got it working finally. My problem was destroying the actor inside the character blueprint. Then trying to respawn it from the same blueprint

      Comment

      Working...
      X