I have 2 enemy spawners(actor) that spawns 1 AI(character) at 2 different locations.
Under the enemy spawning blueprint, I used SpawnActor.
Under the AI blueprint, I set the AI Move To the player’s location until it success, so the player will die and the player will respawn.
Under the player blueprint, after destroyed, it will respawn player at a fixed location.
I’m confused whether should i destroy the AI who touched the player or not.
If it’s not destroyed, the AI will not move again or kill the player, even if the player touches it after first death.
If I were to destroy them, the AI will not be respawned, no matter i bind the custom event to respawn the AI with any random keyboard keys to trigger, or link the custom event with the ‘Event Destroyed’ under the AI blueprint.
If there is no solution for this, can someone tell me how am I going to reenable their movements and move them back to their original location where they were spawned at? Thank you.
How does your AI find your player? Does it have a reference, that maybe needs to be refreshed with the new player, that you spawn in after the player got killed?
For the spawner, that spawns your AIs, i have created a custom event, that i can call to trigger a respawn. So whenever i need another AI from this spawner, i just call that event, and it will happily spawn in another AI by triggereing the SpawnActor node again.
I guess, you just need to somehow inform your spawners, that you need another AI
Problem solved by alternative way. Set AI enemies at fixed location. Single/multiple AIs also work. At event BeginPlay, save their initial locations in an array variable. After player dies and respawns, use Set Actor Location for all AI enemies.
For the reenabling movements part, I found out my AI only move on beginplay, using Event Tick solved it.