Hello people of the community! I’ve not posted before, and I have been searching endlessly for a solution to my problem, but can’t seem to locate one. I have just recently gotten my AI to spawn in the world at a specific location. If I shoot him he takes damage and eventually dies. The problem I am having is he will not respawn (which should be after a 2 second delay). I’m sure it’s something I’ve done, but whatever it is, it’s eluding me. Could anybody possibly point me in the right direction? Thanks for any help!
Destroy actor removes that instance of the blue print so it cannot run the remaining script.
You need to make an event in say gamestate or game mode that spawns the Ai so the ai does it calls to gamestate to respawn an Ai then destroys itself
Sorry I haven’t had a chance to respond, but I appreciate the reply. That makes a lot of sense and it’s a rather silly oversight on my part. Will work on that as soon as I get a moment and will update when I get it taken care of. Thanks again for the response!
Ok so I’ve been driving myself crazy trying to get this figured out… with no luck. Been all over the forums and documentation section looking for something I may have missed, but no luck. For the life of me I can not figure out how to get my AI to spawn/respawn in any blueprint other than my AI Character blueprint. What am I doing wrong?
In game mode make a function that runs in sever - spawn bot.
In this function spawn actor of class, your bot class. You could preface it with a delay if you don’t want it instant.
In the Ai. Wherever you set it to die before the destroy node cast to game mode and run that function. Tgen destroy self.
What @Inph1del said.
The basic idea is that you need to keep track of your AI in another Blueprint - be it an Actor BP or GameMode.
Here’s one way:
Create an actor Blueprint and call it “Spawn Manager.” Move all your spawning code here - like location, AI type, etc. When the AI needs to spawn call the Spawn Event in this blueprint.
When the AI “dies” cast to the SpawnManager BP and call an event or function (e.g: Event Respawn) and then use Destroy Actor.
The SpawnManager will now run EventRespawn and respawn the AI again in your specific location.
If you have many AIs spawning and dying, you could use a Blueprint Interface to notify your Spawn Manager of the AI death.
Hope this helps!
Thanks again for the help, but either it doesn’t want to work for me or I’m still trying to light a fire with wet matches…
Deathmatch is a Child of my GameMode blueprint. What is it that I’m missing? I’m sure it’s something simple…
Edit There is a DestroyActor node after the Respawn node in the AI_Character_Blueprint. And what it’s doing now is I hit the AI with enough damage to kill it, and pops up the “Dead Bot” message, but he doesn’t get destroyed or respawn.
Well self can’t cast to deathmatch… You’d want to get game mode and plug that into there
Yup… that was the simple, yet frustrating oversight that was giving me gray hairs… Kudos to you for your help and patience!
No probs I’ve learned the hard way myself I tend to always put a print out of casts failure naming the blueprint and somthing about it so when stuff fails I know what to look into