Follow missions are missions where you must follow a certain vehicle from Point A to Point B, without letting that vehicle get too far away from you.
Before you create a follow mission, you should probably read the Creating a Mission: The Basics thread.
Creating the Mission
In your level's mission file, create a new stage with the following setting:
AddStageVehicle( "VEHICLE_NAME", "VEHICLE_LOCATION", "NULL", "VEHICLE_STATS", "DRIVER" )...where VEHICLE_NAME is the file name of the .p3d file that contains the vehicle's model, VEHICLE_LOCATION is the starting point of the vehicle (taken from the mission's .p3d file), VEHICLE_STATS is the .con file that you want to use which contains vehicle stats (found in the /Missions/level0X directory), and DRIVER is the name of the person that will drive the vehicle (which can be left out if you want to have no driver).
As an example, if you want Snake to drive Frink's hover car, starting at the Level 5 museum, you would type:
AddStageVehicle( "frink_v", "m5_museum_start", "NULL", "\Missions\level06\M3chase.con", "snake" )NOTE: If you are using a .lua file, use a double backslash ( \\ ) instead of a single one ( \ ).
After the AddStageVehicle line, you'll need to put in some waypoints that the vehicle drives to... These are used to set the vehicle's path around the level. To add a waypoint, type this immediately after the AddStageVehicle line:
AddStageWaypoint( "WAYPOINT_NAME" )...where WAYPOINT_NAME is the name of the waypoint in the mission's .p3d file. You can add as many waypoints as you need to in a mission.
After creating the vehicle and its path in the mission, you'll need to add a new objective to the stage:
AddObjective( "follow", "neither" ) SetObjTargetVehicle( "VEHICLE_NAME" ) CloseObjective()...where the VEHICLE_NAME should match the VEHICLE_NAME that you used in the AddStageVehicle setting.
Adding a Fail Condition
In order to fail the mission (due to getting too far away from the follow vehicle), you'll need to add a fail condition. To add a fail condition to the follow mission, add these lines under the objective (from above):
AddCondition( "followdistance" ) SetFollowDistances(0, 150) SetConditionVehicle( "VEHICLE_NAME" ) CloseCondition()...where the first number (0, in this case) is the highest point of the Follow Meter in-game (which means that if you are 0 meters away from the vehicle you are following, the Follow Meter will be full), and the second number (150, in this case) is the lowest point of the Follow Meter in-game (which means that if you are 150 meters away from the vehicle you are following, the Follow Meter will be empty - and you'll fail the mission). The VEHICLE_NAME must also match the vehicle name used earlier, in order for the game to know which vehicle you must be following.
Adding Items to the mYl.mfk or mYload.lua File
The vehicle you are following must also be in the mission load file, otherwise the game will crash. To add the vehicle to the mission load file, type this inside the file:
LoadDisposableCar("art\cars\VEHICLE_NAME.p3d", "VEHICLE_NAME", "AI" )...where VEHICLE_NAME is the name of the .p3d file that contains the vehicle's model.
NOTE: If you are using a .lua file, use a double backslash ( \\ ) instead of a single one ( \ ).
Other Mission Tutorials
Creating an Item-Collecting Mission
Coming Soon: Creating a Destroy Mission
Coming Soon: Creating a Follow-and-Collect Mission
Coming Soon: Creating a Simple Race Mission
Coming Soon: Creating a Checkpoint Race
Coming Soon: Creating a Race with Laps
Coming Soon: Creating a Hit-and-Collect Mission
Coming Soon: Creating a Wager Race