Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Games
  • Radical Entertainment
  • The Simpsons: Hit & Run
  • Scripting
  • Console Commands
  • MFK Commands
  • Mission Initialisation
  • Stages

AddStageVehicle

Adds a vehicle to a stage in a mission.

Scope

This command should be called between calls to AddStage and CloseStage in a mission's initialisation script.

Syntax

MFK
Lua
AddStageVehicle( car, locator, behaviour, [con_file, driver] );
Game.AddStageVehicle( car, locator, behaviour, [con_file, driver] )
  • car: The name of the car to add.
  • locator: The name of the CarStart Locator to place the car on.
  • behaviour: The type of Vehicle Behaviour to give the car.
  • con_file: The CON file to use on the car.
    • Optional, defaults to the car's CON file in the scripts\cars folder if omitted.
  • driver: The driver of the vehicle. This only works if the con_file does not call SetDriver.
    • Optional, defaults to no driver if omitted (unless the specified con_file sets a driver).

Examples

Activate Immediately

This example adds Skinner's car and activates it immediately with chase AI.

MFK
Lua
AddStage();
	// Add Skinner with chase AI right away
	AddStageVehicle("skinn_v", "m1_skinner_car", "chase", "missions\\l1m0\\skinner.con", "skinner");

	AddObjective("dummy");
	CloseObjective();
CloseStage();
Game.AddStage()
	-- Add Skinner with chase AI right away
	Game.AddStageVehicle("skinn_v", "m1_skinner_car", "chase", "missions\\l1m0\\skinner.con", "skinner")

	Game.AddObjective("dummy")
	Game.CloseObjective()
Game.CloseStage()

Activate Later

This example adds Skinner's car with no AI and then activates it in the following stage with ActivateVehicle.

MFK
Lua
AddStage();
	// Add Skinner with no AI
	AddStageVehicle("skinn_v", "m1_skinner_car", "NULL", "missions\\l1m0\\skinner.con", "skinner");

	AddObjective("dummy");
	CloseObjective();
CloseStage();

AddStage();
	// Then use ActivateVehicle in the next stage to activate him
	ActivateVehicle("skinn_v","NULL","chase");

	AddObjective("dummy");
	CloseObjective();
CloseStage();
Game.AddStage()
	-- Add Skinner with no AI
	Game.AddStageVehicle("skinn_v", "m1_skinner_car", "NULL", "missions\\l1m0\\skinner.con", "skinner")

	Game.AddObjective("dummy")
	Game.CloseObjective()
Game.CloseStage()

Game.AddStage()
	-- Then use ActivateVehicle in the next stage to activate him
	Game.ActivateVehicle("skinn_v", "NULL", "chase")

	Game.AddObjective("dummy")
	Game.CloseObjective()
Game.CloseStage()