Announcement

Collapse
No announcement yet.

Custom Bot spawning issues - UT2004

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

  • replied
    So is the problem that your stuff doesnt get spawned into the game, but the stock bots do?

    If your doing it that way, you will have to set the defaults in the gametype for the roster as well.

    How do you know your bots not showing up, is it because of the log? It looks to me like you will be sending the bot to a different state before that log statement gets called... Try moving that log statement to the beginning of the SetAttraction function.

    Leave a comment:


  • started a topic Custom Bot spawning issues - UT2004

    Custom Bot spawning issues - UT2004

    Hello,

    Im trying to spawn my own custom bot with its own custom (dum) AI and custom Pawn. I created my own game type which I extended off xDeathmatch. I've gone through this tutorial over at UnrealWiki.
    http://wiki.beyondunreal.com/wiki/Spawning_Your_Own_Bot

    However I can't seem to be able to spawn a bot with my customer controller and pawn. The closest I can get it changing my defult controller and pawn to be my custom controller and pawn.

    My code is as follows:-

    Code:
    /////////////////////////////////////////////
    //Main Game Class
    /////////////////////////////////////////////
    
    class ctc extends xDeathMatch;
    
    
    defaultproperties
    {
      GameName="MyMod"
      Acronym="CtC"
      MapPrefix="DM"
      Description="Insert Desc here"
    }
    
    function Bot SpawnBot(optional string botName)
    {
    local Bot NewBot;
    local RosterEntry Chosen;
    local UnrealTeamInfo BotTeam;
    
        BotTeam = GetBotTeam();
        Chosen = BotTeam.ChooseBotClass(botName);
    
    
        if (Chosen.PawnClass == None)
              Chosen.Init();
    
        NewBot = Bot(Spawn(Chosen.PawnClass.default.ControllerClass));
    
    
        if ( NewBot != None )
                     NewBot.PawnClass = class'ctc.NewPawn';
                     InitializeBot(NewBot,BotTeam,Chosen);
        return NewBot;
    }
    
    
    /////////////////////////////////////////////
    //My new Pawn
    /////////////////////////////////////////////
    
    class NewPawn extends xPawn;
    
    //used to just show that the class has been initalized
    event PostBeginPlay()
    {
        Super.PostBeginPlay();
        Log("Pawns begin Play");
    }
    //assign our controller class through the default properties
    defaultproperties
    {
        ControllerClass=class'ctc.MyAIController';
    }
    
    
    /////////////////////////////////////////////
    //My AI Controller
    /////////////////////////////////////////////
    class MyAIController extends xBot;
    
    function SetPawnClass(string inClass, string inCharacter)
    {
    	Super.SetPawnClass("ctc.NewPawn", inCharacter);
    }
    
    function SetAttractionState()
    {
        if ( Enemy != None )
            GotoState('FallBack');
        else
        {   //want to change this to whatever your default state is you
               //want for your bot.
            GotoState('Roaming');
    
        }//close if
        log("Attraction State Changed to " );
    }
    
    defaultproperties
    {
    	PawnClass=class'ctc.NewPawn'
    }
    Im just trying to spawn a bot with my customer AI Controller, and down the track I wish to be able to change the bots' character model and play around with the AI - but at this stage I can't even get the basic bot running around.

    Can anyone shed some light on this or point me in the right direction - any help would be sweet
Working...
X