Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Controlling pawns through scripts

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

  • Controlling pawns through scripts

    Well, the next thing I'm going to need to do is set up some enemy patterns for my game.
    Now, I'm not doing complex-realistic-human-like-AI or any such nonsense. The enemies in my game are going to run on simple patterns. Walk back and forth, throw something at the player now and then, have particular actions triggered according to player proximity or if the walk into a wall or or a ledge... Not AI, just patterns.

    But as simple as I am thinking of this, and as much as I can conceive of how to break it down, I am unsure about how to get these ideas to actually control the pawn's movements.

    I know we have controller classes, and that is easily what I need to modify. But... how?
    I don't know what sort of code I need to put in to create a simple pattern. I don't know what I have to even use as reference, since the AI pawns for UT are much more robust than I want to use.
    I have experience making a pawn move with a player controller, but that is taking direct input from a player. How do I set up a script for the enemy to follow?

  • #2
    Originally posted by marscaleb View Post
    Well, the next thing I'm going to need to do is set up some enemy patterns for my game.
    Now, I'm not doing complex-realistic-human-like-AI or any such nonsense. The enemies in my game are going to run on simple patterns. Walk back and forth, throw something at the player now and then, have particular actions triggered according to player proximity or if the walk into a wall or or a ledge... Not AI, just patterns.

    But as simple as I am thinking of this, and as much as I can conceive of how to break it down, I am unsure about how to get these ideas to actually control the pawn's movements.

    I know we have controller classes, and that is easily what I need to modify. But... how?
    I don't know what sort of code I need to put in to create a simple pattern. I don't know what I have to even use as reference, since the AI pawns for UT are much more robust than I want to use.
    I have experience making a pawn move with a player controller, but that is taking direct input from a player. How do I set up a script for the enemy to follow?


    With an AI controller of course so if you want something really simple to show you the way



    Code:
     
    class AIAgresiveController extends AIcontroller;
    
    var Pawn player;
    
    event Possess(Pawn inPawn, bool bVehicleTransition)
    {
      super.Possess(inPawn, bVehicleTransition);
      //initialize Pawn Physics
      inPawn.SetMovementPhysics();
    }
    auto state Idle
    {
       event SeePlayer(Pawn Seen)
       {
    
         super.SeePlayer(Seen);
         player = Seen;
    
         GotoState('Chasing');
    
    
       }
    
    }
    state Chasing
    {
       Begin:
          MoveToward(player);
          Pawn.StartFire(0);
          goto 'Begin';
    }

    then on your pawns Deufault properties get there

    controllerClass=class'YourPAckageNAmTheclassesOnel ikeUTgame.AIAgresiveController'


    Also if you want a weapon for your pawn then on the pawn class


    /Add the default inv for the AI pawn
    event PostBeginPlay()
    {
    super.PostBeginPlay();
    AddDefaultInventory();
    }

    Thats it , maybe last function depends how you named it ...

    Comment


    • #3
      I feel like this is something I would have remembered had I not stopped working with UDK for the last month, but...
      How do I get a pawn to use the AIController class I make?

      Comment


      • #4
        controllerClass=class'YourPAckageNAmTheclassesOnel ikeUTgame.AIAgresiveController'
        read ........ all........... in pawn

        Comment


        • #5
          In case of PlayerController you may set the PlayerControllerClass in your GameInfo class' default properties. Something like this:

          Code:
          PlayerControllerClass=class'YourPlayerControllerClass'
          In case of AI controllers, in your AI pawn class' default properties:

          Code:
          ControllerClass=class'YourAIControllerClass'

          Comment


          • #6
            Why you can't delete posts , that's kinda bad no?

            BTW marscaleb i'll give you a future hint , so you don't lose time searching like a no good at searching person why your pawn doesen't get a controller when you spawn hm through code


            alright so basically , when you spawn pawn that has no controller , "spawn Means use spawn function" not place it in the editor. Doesen't get a controller

            Alright knowing this , then what you should do is give him a default controller

            ThePawnthatSpawned.SpawnDefaultController(); // that function it's native it's there of the engine

            also if he gets no weapon , call the THePawnThatSpawned.AddDefaultInventory();

            Comment


            • #7
              That's good to know, thank you; I was just about to have the pawns be spawned because placing them directly in the map wasn't setting them up properly either.

              Comment


              • #8
                i suposed it

                Comment

                Working...
                X