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

Basic Question about AI/Controller class.

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

  • Basic Question about AI/Controller class.

    Hi all, basically what I am trying to do is pretty simple. I want to make a bot walk down a set path and attack any enemy he bumps into.

    I have messed around with Kismet a little and can't really get the bot to go anywhere once I have him spawned. I tried using ActorFactoryAI and connecting it will MoveToActor to get him to go to a new pathnode but he wont budge.

    I have also messed around a little with a controller class. I looked at some examples and got him to follow me around a little bit but the real problem I am having (probably the real question of this post) is that I don't know how to reference the pathnode that I placed with the UDK, in my script. I'm sure I need a var Actor Pathnode but I don't know how to set it to the pathnode that I placed (or maybe I am going about this all wrong).

    Any assistance is much appreciated.

  • #2
    how are you currently spawning the AI?
    because there are several ways to do it, and it would be easiest to find the one that uses what you've currently got working.

    Comment


    • #3
      if you are using unrealscript, you need to show your code to get some help.

      Comment


      • #4
        you could use foreach to itterate through the pathnodes in the world, then tell the bot to MoveTo them.
        http://udn.epicgames.com/Three/Unrea...%28_ForEach%29

        Comment


        • #5
          Originally posted by tegleg View Post
          you could use foreach to itterate through the pathnodes in the world, then tell the bot to MoveTo them.
          http://udn.epicgames.com/Three/Unrea...%28_ForEach%29
          A much better way would be to use the findRandomDest(); function

          if(Destination == none || Pawn.ReachedDestination(Destination))
          {
          Destination = FindRandomDest();

          }

          //Find a path to the destination and move to the next node in the path
          MoveTarget = FindPathToward(Destination);
          if(MoveTarget != None)
          {

          MoveToward(MoveTarget);

          }

          Comment


          • #6
            Hmmm, ok so to answer everyones questions at once.

            how are you currently spawning the AI?
            because there are several ways to do it, and it would be easiest to find the one that uses what you've currently got working.
            Currently I am creating a bot in Kismet and assigning him to an AIController class that has his logic in it.

            if you are using unrealscript, you need to show your code to get some help.
            The code thus far is just someone elses AI and I guess I can't see how to do with it what I want to do with it.


            tegleg:
            If I iterate through the nodes, tell him to move to them - is it going through the pathnodes in order (0, 1, 2, etc)? And how do I stop him from going too far? This could work if I could tell them what node to start with and what node to stop with.

            ankangronto:
            FindRandomDestination sounds like it will be hard to get the bot to go exactly where I want him to every time. Is there a way to make specific destinations for different teams and basically just have the 1 destination on each side so that random dest only selects that one every time?

            Thanks for all the fast responses guys.

            Comment


            • #7
              add each pathnode to an array
              then you can do stuff like
              MoveTo(MyPathArray[5])
              or whatever

              Comment


              • #8
                Originally posted by tegleg View Post
                add each pathnode to an array
                then you can do stuff like
                MoveTo(MyPathArray[5])
                or whatever
                Ok so thats back to the root of my question. I could make a PathNode in my script and then add it to an array, easy enough. How do I take a PathNode I made in the UDK and placed on my map and put it in an array? Use the PathNone name I guess but I couldn't get it to work.

                Comment


                • #9
                  var class<Pathnode> MyPaths;
                  var Pathnode Current;

                  simulated function PostBeginPlay()
                  {
                  foreach Worldinfo.AllActors(class'Pathnode', Current)
                  {
                  MyPaths.AddItem(Current)
                  }
                  }

                  like that

                  Comment


                  • #10
                    Originally posted by tegleg View Post
                    var class<Pathnode> MyPaths;
                    var Pathnode Current;

                    simulated function PostBeginPlay()
                    {
                    foreach Worldinfo.AllActors(class'Pathnode', Current)
                    {
                    MyPaths.AddItem(Current)
                    }
                    }

                    like that
                    Awesome, will it put them in numeric order (i would assume so). Also, what is class supposed to be in the array delcaration and in the first argument of AllActors()?

                    Comment


                    • #11
                      heres a very useful page
                      http://udn.epicgames.com/Three/Unrea...Reference.html

                      Comment


                      • #12
                        That was very helpful. It should actually be var array<class<Pathnode> > MyPaths;

                        Now I am getting the error "type mismatch" on this line:
                        foreach Worldinfo.AllActors(class 'Pathnode', Current)

                        Comment


                        • #13
                          sorry it should be
                          var array<Pathnode> MyPaths;
                          i wrote that code off the top of my head

                          did you put this var in?
                          var Pathnode Current;

                          Comment


                          • #14
                            Ah, yeah that was the problem, the class<pathnode> part had me thinking it was supposed to be a dynamic array which i thought was strange. When i changed it to var array<Pathnode> MyPaths; it worked!

                            I tossed MoveTo(MyPaths[1].Location) into my default state and he ran right to the node I thought he would.

                            Thanks a ton.

                            Comment


                            • #15
                              var array<Pathnode> MyPaths; is a dynamic array
                              it would be
                              var pathnode mypaths[5];
                              for a non dynamic array with 5 items

                              Comment

                              Working...
                              X