UnrealScript Game Programming Cookbook
AI and Navigation 128 Only two more steps to go with Kismet. From the Spawned node in our Actor Factory, we need to attach an o ...
Chapter 5 129 Our final step is to connect all of the nodes appropriately. In total, it should look like this: Level Loaded | ...
AI and Navigation 130 How it works... There are numerous ways to spawn bots on a level, including UnrealScript, making a pawn pl ...
Chapter 5 131 class WanderBot extends GameAIController; We only need one global variable, and that's TargetLocation. var Vector ...
AI and Navigation 132 The OffsetX and OffsetY variables tell us how far to the left and right, and then forward and backward, we ...
Chapter 5 133 Our final addition to this class is in the default properties. We'll add this to all of our AIController classes, ...
AI and Navigation 134 There's more... There are two console commands which will make you understand how the bots operate and wha ...
Chapter 5 135 // declare it at the start so you can use it throughout the script Var int _PathNode; /** Distance our pawn needs ...
AI and Navigation 136 // Calls all of the Tick functions from parent classes super.Tick(DeltaTime); // If there is a pawn on the ...
Chapter 5 137 { // Then set it back to zero and begin again _PathNode = 0; } // Go to the Pathfinding state GoToState('Pathfindi ...
AI and Navigation 138 How it works... The key component here was adding PathNodes to our array. We created a variable to store o ...
Chapter 5 139 * This is where all of the logic occurs =======================================================*/ simulated functi ...
AI and Navigation 140 Getting ready Open your IDE and prepare to create a new class. How to do it... This recipe will be slightl ...
Chapter 5 141 Again, if our bot realized that it can't directly access the point on the map, it will draw a new one and move tow ...
AI and Navigation 142 NavigationHandle.SetFinalDestination (NavigationHandle.PathCache_GetGoalPoint()); // The random point is a ...
Chapter 5 143 The final piece of the puzzle is the default properties block. defaultproperties { // Pawn is a player or a playe ...
AI and Navigation 144 How to do it... We've covered enough wandering and patrolling up to this point. Why not create an AI which ...
Chapter 5 145 Just as we added PathNodes to our array for our bots to use, we need to add the WayPoints that NavMeshes use to o ...
AI and Navigation 146 Now it's time to create our follow state. We're going to write the function for FindNavMeshPath() first, w ...
Chapter 5 147 Begin: // If we can reach our pawn.... if(NavigationHandle.ActorReachable(target)) { /* Clear any debug lines that ...
«
3
4
5
6
7
8
9
10
11
12
»
Free download pdf