You could destroy them all and respawn them. You can either get their current locations and spawn them there, or get their default locations through use of a variable and interface.
You can also just use an interface call to set their health. I wouldn’t recommend this one as it doesn’t reset their AI unless you tell it to, in which case that’s just more work.
And then you could reload the level entirely. It would reset everything in the level, but if you save it then that shouldn’t be a problem, as you’ll want players to be able to log off without resetting everything anyways.
Hi I’m so sorry for the delayed response- I just had minor surgery so I had to take a little break fr0m this project
I tried the for each loop node however it says error and ‘infinite loop’? Currently there’s only one enemy on the level so I’m not sure why it’s saying this - I’ve probably done something wrong ahh
Because I can easily set the player’s health back to max after respawn since there will only be one of each player (it’s a two player game!) so I can just reset their health in their blueprints-
it might depend on your game but the above seem kinda like band aid solutions. ultimately a check point is a save system and likely you’ll need a save system eventually so may as well do it properly now.
another issue is if you’re looping over AllActorsOfClass you wont get potentially destroyed Actors.
I have a checkpoint system atm but it just teleports the players back to a prior location rather than saving the level at that stage- although I think that does sound like a better solution honestly.
If this is just to reset the health to 100, in the SET node, just feed in 100 to the health.
The current logic translates into English as something like “Set the Health on this target actor to (Get the current health value of this actor)”
~
A step further - in the future if you want to have enemies with health values of higher than 100, you could have a ‘max HP’ variable in the enemy, and query that to set the correct amount on respawn.
Another idea - You could create a respawn function inside of the enemy with relevant reset code (reset health / position etc) - then you could just call the function on the enemy - same method as pictured above, iterating through an array (Get all actors returns an array) and executing a function on each item.