Thursday 28 November 2013

Adding a bot AI.

These are the steps you need to follow to add an AI bot to you level

 Right click in level where you want bot to spawn, Choose add actor - add PathNode.
 Select the path node and enter Kismet.
 Right Click anywhere- New Event - Level Loaded
 Right Click anywhere again - new action – actor - actor factory
 right click on spawn point (actor factory)
 choose new object var using PathNode 0
 connect Level Loaded to Spawn Actor
 on the actor factory properties (blue arrow) – choose UTActorFactoryAI
 Click on drop down arrow beside Factory
 Tick Force Deathmatch AI
 Set Controller Class - None
 Set Pawn Class – UTPawn
 Tick Give Default Inventory
 click the little Green Cross on Inventory List and select any weapon from the dropdown menu

The final code should look something like this:

Adding a bot 

Then to have the bot re-spawn follow these steps:
  • Add an Attach to Event Node ( New Action -> Event -> Attach to Event)
  • Then a Death Node (New Event -> Pawn -> Death)
  • Right click on the Spawned thingy in Actor Factory and create a new object variable
The code is as follows:
Respawning bot

One extra thing I added, was a delay before the bot re-spawns. To do that, simply right click on the black thingy on the Death Node and add delay.

You now have a fully shoot-able bot, have fun! 

No comments :

Post a Comment