Adding a vehicle is quite simple as well. Look for the VehicleSpawner prefab in the Project Panel, by navigating to Prefabs > Spawners. Place it anywhere in your scene.
The Vehicle Spawner prefab is a GameObject that contains two components, a VehicleSpawner and an NpcSpawner. This can make sense if you think about it in this way. The vehicle not only needs to spawn, but its pilot needs to as well. And the pilot is the one controlling the vehicle, so the AI needs to be configured for him/her, not for the vehicle itself. The Vehicle Spawner properties are the following:
Spawn At Start
If checked, the vehicle will spawn as soon as the level loads
Vehicle Type
Determines the vehicle that will spawn
For now, there is only one vehicle, but more will come later.
Main Weapon
The vehicle's main weapon
It not only defines the weapon, but some other specifications tied to the weapon, like how far away it can shoot at the player
Secondary Weapon
Secondary weapon that doesn't interfere with the behavior of the vehicle when controlled by the AI
Pilot Weapon
This weapon will be used by the pilot when the Main and Secondary weapons are destroyed
This might depend on the type of vehicle in the future
You also need to set some properties in the Npc Spawner component.
Spawn At Start
Best leave this on!
If you want the Vehicle to spawn without a pilot, just remove the Npc Spawner component altogether
As of the present time, spawning a vehicle without a pilot will have buggy/undesired results. In the future I will add the functionality to drive empty vehicles; only then you'll have a reason to remove this component.
Npc Type
Sets the character that will pilot the vehicle
Ai Type
This will work exactly the same as with a regular NPC
Determines if the vehicle will wander randomly, stand guard or patrol following pre-established waypoints
Waypoints Behavior
Only relevant when Ai Type is set to Waypoints
Works the same as with an NPC
Faction
Defines the faction this pilot/vehicle will be aligned to.
Armor / Hair / Hat / Skin
More properties for the pilot that won't affect the AI
In the same way as with a regular NPC, a Vehicle Spawner can be complemented with a component called Vehicle Spawner_Weapon Randomizer. Select from the Main and Secondary weapons you would like to have available for this vehicle to spawn with.
In the previous page you learned how to create a NavMesh for the NPCs. The vehicles (and other future types of agents) need their own NavMesh due to the difference in sizes and mobility capabilities. In the same GameObject you created your NPC NavMesh, add another Nav Mesh Surface component like so.
You will see now that there are two different NavMeshes overlapping one another. This is what we are after.
At this point, you are ready to Build your map and test it! Be aware that the HeavyMecha (the only vehicle available so far) is a very difficult opponent to defeat! With more weapons and abilities to defend yourself the fight will be fairer, but for now, be prepared for a challenge.
In this screenshot, the Lighting has been properly set up. You will learn how to do this later!