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

[Code] Simple Racing/path following AI + GameType

  • Filter
  • Time
  • Show
Clear All
new posts

    no you would have to forget about moveto()
    instead you need a vector location where you want the bot to aim for instead of moveto.
    then tie your brain in knots figuring out the vector maths to add a force to the vehicle in the required direction.

    i was thinking more of a hovering or flying vehicle when you mentioned this.
    the wheels will spin from friction on the ground if you turn the barakes off (some defaultproperty).

    i dont know how exactly how the wheels work cos i havnt got the engine source.
    test ive done suggest there is a force applied to the body to make it move, taking variables from slipfactor and whatever to rotate the graphical representetion of the wheel to make it look as if its real,
    rather than taking the wheel object and calculating the forces from there.
    of course i could be totally wrong and would welcome an explination of how it actually works.


      Hey, im having a problem with this. Its more on my side then anything. Im trying to use this code for a mod for a game called Dungeon Defenders, and I cant seem to find a way to edit it..Basically what im trying to do it make the Retail made Bots/AI use this script instead of the ones that they come with..


        probably best to contact someone from the Dungeon Defenders team, it might not be possible.


          Hi tegleg this system is really good and has been a massive help for me but when I change the max speed to try tell the AI to slow down for corners it doesnt appear to do anything I have set it to 250 and it still seems to just go flat out everywhere. I am using an edited scorpion vehicle code.


            @tegleg: What about using Route class..?


              could be a possibility VendorX
              i long since stopped using this ai though, i wont be updating it any time soon.


                Hey Tegleg, can you explain what the inventory manager is doing here? -- I'm a bit lost on the 'hack' bit


                  Hi there,
                  is there any chance you can help me to add to this script the ability to the pawn to stop when a player or anoter pawn is in front of him ?


                    @ vawx
                    the inventory manager is a way of making the default pawn a vehicle. its much less messing codewise than spawning a normal pawn and entering a vehicle.

                    Trace() or AllCollidingActors()


                      Thanks i managed to do it with a different methode and it works but i'm stuck in something else actually i want the pawn to start with the closest pathnode to his location i have done this (in theorie it works but i just discover that the pawn location is always set to 0.0.0 and that's only in the PostBeginPlay function )

                      simulated function PostBeginPlay()
                      local Race_PathNode Current;
                      local int ini_Distance;
                      local int real_distance;
                      local int m;


                      `log(Pawn.Location @ "this is the pawn location");

                      //add the pathnodes to the array
                      foreach WorldInfo.AllActors(class'Race_Pathnode',Current)
                      Waypoints.AddItem( Current );


                      for(m = 0; m <= Waypoints.Length; m++)
                      `log("the iterative number is " @ m);

                      ini_Distance = VSize2D(Pawn.Location - Waypoints[m].Location);
                      if (ini_distance < real_distance)
                      `log(Waypoints[m].Location @ "this is the pathnode location");




                      any ideas ?
                      actually if you ever asked why i wanna do that it's pretty simple i wanna create a traffic system and different spawn points in every point spawn a pawn that should continue his way begining with the nearst pathnode to him .


                        you could try doing it after postbeginplay to give everything chance to initialise.
                        function GetNearest()
                        ini_Distance = VSize2D(Pawn.Location...
                        or another way is to give the spawn point a pathnode in the editor, then give that to the ai on spawn.
                        class spawnpoint...
                        var() PathNode StartNode;
                        //when you spawn the ai
                        MyAI = spawn(the ai...);
                        MyAI.StartNode = StartNode;


                          Actually it didn't work but i managed to get work with changing pawn.location by location i don't know how but it did work...
                          i'm sorry if i ask a lot but i never programed for games before so i'm learning step by step
                          so my question is i wanna the spawn point to random the vehicle that gonna be spawned.
                          is there any known function for that ?


                            Hi can you give me a tutorial how to set this up i have race_nodes placed. But i dont know what to do after that besides spawn a car. Im assuming kismet is required but i dont know what to place and connect.


                              you can do it in kismet or code
                              in code
                              Spawn() the car, ai and a pawn. Possess() the pawn and DriverEnter() the car.
                              in kismet
                              UTActorFactoryAI - use this bot for the controller and whatever pawn you want
                              then use an EnterVehicle node to put the pawn in the car

                              the bot should start racing round soon as the level is loaded


                                actually its a LOT more simple than that, just had a look at what i gave out

                                all you have to do is place a Bot_SpawnPoint where you want the bot to spawn and thats it