No announcement yet.

spawn enemy bots in kismet

  • Filter
  • Time
  • Show
Clear All
new posts

    spawn enemy bots in kismet

    this is a simple tutorial intended for people who are new to udk. its my first proper tutorial so feedback is welcome
    it will show you how to:
    1. spawn a bot from a trigger
    2. spawn a bot from level Loaded
    3. re-spawn a bot after death (infinite)
    4. re-spawn a bot after death (a number of times)

    Before you start, make a map and save it using the prefix 'VCTF'
    eg. VCTF-YourMap
    your map will use the Vehicle Capture The Flag game type, this is to allow for team selection for the bots

    1. spawn a bot from a trigger
    place a trigger and a player start on your level
    select the trigger
    open kismet
    new event using trigger - touch
    new action - actor factory
    connect trigger Touched to Spawn Actor
    go back to your level and select the player start
    back into in kismet
    right click on spawn point (actor factory)
    new object var using player start

    on the actor factory properties (blue arrow) - UTActorFactoryAI
    Controller Class - None
    Pawn Class - UTPawn
    Tick Give Default Inventory
    Tick Force Deathmatch AI
    click the little Green Cross on Inventory List
    select a weapon from the dropdown menu
    Team Index - 1 (the player is default on Team 0)

    Build All and test your map, walk into the Trigger and a bot will spawn and shoot you

    2. spawn a bot from level Loaded
    instead of using a Trigger
    New Event - Level Loaded
    connect Loaded and Visible to Spawn Actor

    the bot will spawn when the level starts

    Part 3 in the next post

    Part 3 re-spawn a bot after death (infinite)

    Using the kismet you already have from parts 1 and 2
    open Kismet
    New Action - Event - Attach to Event
    New Event - Pawn - Death
    Right click on Spawned (Actor Factory) - Create New Object Variable
    connect them up like the picture below

    the bot will now respawn on death
    NOTE: if the bot does not move away from the Player Start you will recieve a kismet warning
    you can solve this by creating a number Player Start's and connecting them all to the Spawn Point on the Actor Factory

    Part 4 in the next post


      Part 4 re-spawn a bot after death (a number of times)

      Starting from what you have from Part 3
      open kismet
      New Condition - Counter - Int Counter
      on the Int Counter propertes:
      set Value B to the number of times you want the bot to respawn
      connect them up like the picture below

      feedback is welcome
      hope that helps someone


        What about a custom bot? Getting theirs in there is kind of easy, but what if I wanted it with my skeletal mesh? Also to have my own animation. Is a crowd agent a better route?


          heres a nice bit of code thats helped me with using custom bots
          copy/paste into a file called EnemyPawn.uc
          change the skelital mesh and anims in defaultproperties to yours
          then on the Actor Factory properties (after a recompile) just change the Pawn Class to EnemyPawn

          class EnemyPawn extends UTPawn;
          // members for the custom mesh
          var SkeletalMesh defaultMesh;
          var MaterialInterface defaultMaterial0;
          var AnimTree defaultAnimTree;
          var array<AnimSet> defaultAnimSet;
          var AnimNodeSequence defaultAnimSeq;
          var PhysicsAsset defaultPhysicsAsset;
          simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info)
          	Begin Object Name=WPawnSkeletalMeshComponent
          	End Object


            Wow, thanks. This saves me a bit of time when I get to it. The characters I have now are trigger based. I also did the crowd agent system, but getting it to do what I wanted was making my brain hurt more. It already hurts. I was pretty much trying to take the shortcut in kismet until I had gotten to the scripting way. Inevitable hunh? All I wanted was for them to follow me. The rest I can figure out. So for different enemies, now I would reference to multiple enemy .uc files in my script folder.
            Setting up the Animtree and Animset is a different issue but I've gotten those to work.
            Thanks for the help.


              I followed this tutorial and I am doing a VCTF map. The problem is that the bots don't stop spawning. I have my bots set to the amount of 5 and the keeps spawning bypassing the limit of 5


                try deleting all the playerstarts and spawn the bots at a pathnode or something, i think you can spawn from almost anything.
                when you rebuild the paths it will say you need at least 1 playerstart, it doesnt matter if you play in the editor, but for the game you need at least 1 for your player.
                since i updated to august ive had bots seemingly popping up from nowhere on a few maps.
                maybe they changed something...


                  OK, so here is what I did.
                  I dropped the spawn amount down to just 1.
                  After that first bot got killed 5 of them spawned immediately, one for each path-node spawn-point I used.
                  I double checked and the spawn amount is set to 1 for blue-team

                  Could iut be that I have to add an actor factory for each bot? Reason I ask is that when I do just one bot it works fine, but anymore then that and it seems to go berserk


                    Originally posted by foodstamp View Post
                    Could iut be that I have to add an actor factory for each bot? Reason I ask is that when I do just one bot it works fine, but anymore then that and it seems to go berserk
                    YES i should have mentioned that sorry
                    dont spawn more than 1 bot in each actor factory
                    because each time a bot dies it fires the spawn thing
                    so if you have it spawning 5 bots each time....


                      hi thx for this tutorial but the bots are still they dont move i can move then in my map.


                        How do you respawn the same bot? Like for a team deathmatch setting? One where it keeps the amount of kills it's gotten.


                          not sure about that, havnt used much kismet lately.
                          theres probably some way of storing the kills into a variable, and when the bot respawns give it the kills.


                            i havent had a chance to look thought this yet but it looks very interesting, thanks.

                            Im creating a level pretty much the same at jacks rabbit for uni just looks different tbh!

                            Would this work in the same way as the enemies spawn on there?

                            I have created an enviroment and a friend is currently helping to model a main character untill then im using jazz!

                            Hes a little busy at the moment and im trying to get ahead slightly, the jazz tutorial only takes you as far as creating a moving jazz, the rest is a mistery at the moment