Is there a way to reset an actor to the state it was in when it spawned ?
What I would like to achieve is to reset the enemies in my level when the player character reaches a
I wondered if there is an already built-in way to tell a enemy (
Do you have any insight into if it is actually possible to achieve my goal using built-in methods at some level ?
Thanks a lot for your help !
asked Apr 20 '19 at 10:24 PM in Blueprint Scripting
Get Class -> Get Class defaults will get you the original variable values. Write a small reset function in the base class and restore them. Should work for something straightforward.
Or give the actor a default struct and a modifiable struct. When you want to reset the actor, set the modifiable struct to the the default one (or fetch one from a data table). You will still need custom functionality to restore things that are your game specific, ofc.
Another good method applicable to more complex setups is to envelop variable sets / structs with components. You can then have the components reset themselves (call their own reset functions that you wrote) without worrying about inheritance. More upfront work and way more planning here but you reap the benefits further down the line.
It depends heavily on what your game is atm and where you're taking it next.
I don't know of anything one node that would help. The way I would do it is just have a struct for all the variables you want saved and store that in the game state. Then you can reset the level and call on that info. Not sure if that helps.
answered Apr 21 '19 at 08:26 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here