UE3 - UT3 Need to modify Bot behavior Can anyone Help

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

GameScripter

New Member
Aug 21, 2009
3
0
0
I want to accomplish the following, and I am looking at UTBOt.uc and Actor.uc.

I am a newbie and do not understand where to start. I know I have to create a gametype. I know how to use a mutator to modify Weapons but when it comes to modify more complex behavior I am lost.

Do I start extending Actor class or UTBot class?

Also to initilize vars and spawn several bots do I need to use PostBeginPlay then AddBot()

I tried that and I get the bot but they still have a weapon, however they dont shoot anymore.

How would I have the NPC swarm me..


2. Make AI in deathmatch so that they swarm you. distance they can see you will be very long. (maybe done with AI variables in gametype,game info, deathmatch etc.)
3. Make level allow 100s of players.
4. Make default inventory for non player characters be nothing, and default inventory for player be just impact hammer, or a small gun
5. Make it so that when enemies run into you, they cause damage. (Goal is to make enemeis not use weapons, like zombies).


thanks for arll your help
 

Phoenix_Wing

Official Kantham Stalker
Mar 28, 2008
386
0
0
California
I dont know how AddBot works, but maybe the AI isnt being set to the bot for that gametype (i.e Deathmatch AI on Onslaught)

2. Subclass UTTeamAI and build off of that for your bots. Vision is defined in Controller or Pawn. Either one.

3. I wouldn't recommend this. This (online at least and older computers) would cause a lot of lag and performance decrease.

Knowing that though, here is what you need.

Defined in GameInfo class
Code:
var   globalconfig int		  MaxPlayers;				// Maximum number of players allowed by this server.
var	  int					  MaxPlayersAllowed;		// Maximum number of players ever allowed (MaxSPlayers is clamped to this in initgame()

4. Pawn Default Inventory FTW.

5. Touch Function FTW.
 
Last edited:

GameScripter

New Member
Aug 21, 2009
3
0
0
AI Bot Behavior modification

Thank you for your help.

Can you tell me how to start the script. I want to spawn 50 bots and
have them have no weapon. Also I want them to attack and cause
damage like a zombie. I want them also to attack the player in all
directions.

Can you show me an example script

Thanks again
 

brold9999

New Member
Apr 5, 2009
142
0
0
Probably the best thing for making them do their damage is to give them a "dummy" weapon rather than no weapon at all. If the weapon requires extremely short range like the impact hammer the bots will attempt to rush up close to attack.

Here is some semi-hacked together code that may get you started with spawning the bots and having them attack you:

Code:
var() int pawnAISkill;
var() int teamNum;
var() class<Pawn> pawnClass;
var() array< class<Inventory> > spawnWithInventory;
var() string pawnFriendlyName;

simulated function spawnPawn() {
  local int i;
  local Pawn newPawn;
  local Controller newPawnController;
  local UTPlayerReplicationInfo newPawnPRI;
  local UTTeamInfo newPawnTeam;

  newPawn = spawn(pawnClass);
  
  if (newPawn != none) {
    newPawn.spawnDefaultController();
    newPawnController = newPawn.controller;

    if (newPawnController != none) {
      newPawnPRI = UTPlayerReplicationInfo(newPawnController.playerReplicationInfo);
      if (newPawnPRI != none) {
        newPawnPRI.setPlayerName(pawnFriendlyName);
      }
      
      if (UTBot(newPawnController) != none) {
        UTBot(newPawnController).skill = pawnAISkill;
      }
      
      if (UTTeamGame(worldInfo.game) != none) {
        newPawnTeam = UTTeamGame(worldInfo.game).teams[teamNum];
        newPawnTeam.addToTeam(newPawnController);
        newPawnTeam.setBotOrders(UTBot(newPawnController));
      }
    }

    for (i=0;i<spawnWithInventory.length;i++)
      giveInventoryItem(newPawn, spawnWithInventory[i], true);
  }
}

function giveInventoryItem(Pawn other, class<Inventory> inventoryClass, bool bActivate)
{
  // Ensure we don't give duplicate items
  if (other.findInventoryType(inventoryClass) == none) {
    other.createInventory(inventoryClass, !bActivate);
  }
}

This will add bots to the specified team, with the specified class of pawn, team, skill, and inventory. It doesn't clean them up after they die so with this code alone, they will respawn after death normally according to the rules of the gametype. When they respawn they will be ordinary bots with the ordinary default equipment.
 

GameScripter

New Member
Aug 21, 2009
3
0
0
Zombie mode help

Thank you for your reply i tried the code but the bots still have powerful weapons nothing has changed. My main issue is that I want the Bots to attack me from all sides. Can I add 50 bots to attack me. I want them to be zombies and the way they attack is like zombies. They drain energy by touching. Would I need to modify the Touch function. Let me know. I just want to make them swarm me like zombies

Thanks again
 

brold9999

New Member
Apr 5, 2009
142
0
0
Are they starting with those weapons? Or picking them up? These are bots so they can pickup and use any item normally.

You could do the attacks with the Touch function but you can also create a weapon for them to use that is invisible, makes no sound, etc. and that will probably work better for bot behaviour. You can also give that weapon high enough priority that bots will not use other weapons if they pick them up, but preventing those pickups entirely may be better.

Using that spawnPawn function, you should be able to spawn any number of pawns. (it does not give the GameInfo the opportunity to limit it) If you want to make 50 of them, you can call the function 50 times, but as it is right now you need to wait for one to move off so another one can be created in the same spot. You could also change the code so that it doesn't always spawn in the same spot, then you could call it in quicker succession.