Announcement

Collapse
No announcement yet.

AI Spawn after death issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AI Spawn after death issues

    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!

    Click image for larger version

Name:	Screenshot (13).png
Views:	1
Size:	247.6 KB
ID:	1213797
    Click image for larger version

Name:	Screenshot (14).png
Views:	1
Size:	278.6 KB
ID:	1213798

    #2
    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
    Inphidel / Brian - Developer of Ultraball
    http://www.ultraballgame.com

    Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

    Comment


      #3
      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!

      Comment


        #4
        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?

        Comment


          #5
          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.
          Inphidel / Brian - Developer of Ultraball
          http://www.ultraballgame.com

          Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

          Comment


            #6
            What [MENTION=274553]Inph1del[/MENTION] 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!
            [WIP] Procedural City Generator | RPG AI
            [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
            [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
            Join our Discord

            Comment


              #7
              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.
              Attached Files
              Last edited by MemnochGRI; 04-07-2017, 10:25 PM.

              Comment


                #8
                Well self can't cast to deathmatch.. You'd want to get game mode and plug that into there
                Inphidel / Brian - Developer of Ultraball
                http://www.ultraballgame.com

                Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

                Comment


                  #9
                  Yup... that was the simple, yet frustrating oversight that was giving me gray hairs... Kudos to you for your help and patience!

                  Comment


                    #10
                    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
                    Inphidel / Brian - Developer of Ultraball
                    http://www.ultraballgame.com

                    Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

                    Comment

                    Working...
                    X