Getting from death state to restart

I’m also going through “Learning Unreal Engine in 24 hours”. in chapter 21 “create a death state.”

I’m trying to have the game restart after the space ship hits two meteors and dies. I followed the book, but its not working. I have the function name blank in “Set timer by function name” - I tried it with and without “Restart Game” - and it still didn’t work. I’ve tried for hours trying to figure this out.
can you help? thanks carl

That is because game mode is not going to have whatever function you are trying to call on it. You need to cast game mode to your custom game mode. Then you can access all the variables and functions you created on your game mode.

Also I’m not sure why you would use a timer for this, if for instance you have an event on your custom game mode called “Restart Game”, you can get your game mode → cast to your custom game mode → and directly call “Restart Game”

Or you could do the timer, just make sure you type the name of your event in the set timer function name field exactly correct.

hi steve,
thanks for writing
I followed the directions (diagram) in the unreal book; but that isn’t working.
so, you suggest taking out the “set timer by function name” completely? I tried that - it doesn’t compile correctly.
I tried taking out the “set timer by function name” completely, and using “Restart Game” - that doesn’t compile either.
If I put an object name in the function space on “set timer by function name” - that doesn’t work.

I tried deleting the “timer by function name” and adding “open level” - it worked, but I got an error message.

any suggestions?

Well i’m going to need more information then it just didn’t work. What are the error messages, what’s not compiling exactly? What does your other blueprint look like, the one that has the function on it that you want to call?

Like I said previously you are going to need to cast your game mode to the correct game mode, but if its not compiling if you remove the set timer and get game mode node entirely, then you have a problem somewhere else that need fixing first and I will need to see what that error is in order to help you.