2008 Sep. 20
A first step in AI Unit Control
You'll need to have completed the previous tutorial in order to start this one. We will assume that you already know how to spawn an AI Unit on your map. The next step will be to force this unit to follow a basic path.
|
Before doing anything, we need to make sure the path we will create will stick directly on to our terrain (not applicable if you want a flight pathf for a plane or helicopter for example). Click on the Follow Terrain icon in your top toolbar as you can see below :
Now in your Rollupbar, go in the AI menu and double click on AIPath. Make a circle path by clicking on your terrain and finish the circle by double clicking as shown below :
Then make sure you disable the Road flag in the AIPath entity settings. Also, if you want to close the loop so your AI Unit goes round and round on that path, set the Closed flag to true.
|
|
In the Rollupbar, you will notice Sandbox2 automatically gives a name to your Path. The default here is AIPath1. You can rename it to whatever you want.
|
Now we're going to link our AI Unit and the path we just created. Switch back to your AI Unit by selecting it and in the Rollupbar, click on the Create button of the Flow Graph section. You will be prompted to enter a name, just put whatever you want in there (i.e soldier_path). In the Flow Graph editor, we're going to use the menu available when you right click on the grid background :
If you got everything right, your Graph should look like this :
If you got everything correct, you can close the Flow Graph window. AI/Physics button on the bottom part of the Sandbox window, you should see your player walk along the path your just created. |









