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

ActivateVehicle

Activates a vehicle previously added to a mission using AddStageVehicle.

Scope

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

Syntax

MFK
Lua
ActivateVehicle( car, locator, behaviour, [driver] );
Game.ActivateVehicle( car, locator, behaviour, [driver] )
  • car: The name of the car to activate.
  • locator: The name of the CarStart Locator to place the car on when activating it.
    • Radical always uses NULL for this argument, but the behaviour does work.
  • behaviour: The type of Vehicle Behaviours to give the car.
  • driver: Set the driver of the vehicle.
    • This argument takes effect immediately, not when reaching the stage.
    • As a result, it's kind of useless and you should just use the 5th argument of AddStageVehicle instead probably.

Examples

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

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

AddStage();
	// Then use ActivateVehicle to change him to chase AI in this stage.
	ActivateVehicle("skinn_v", "NULL", "chase");

	AddObjective("dummy");
	CloseObjective();
CloseStage();
Game.AddStage()
	-- Add Skinner with NULL 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 to change him to chase AI in this stage.
	Game.ActivateVehicle("skinn_v","NULL","chase")

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