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
  • General

InitLevelPlayerVehicle

Scope

Using "DEFAULT" Slot

This command should be called in a level's initialisation script.

Using "OTHER" Slot

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

Syntax

MFK
Lua
InitLevelPlayerVehicle( vehicle_name, locator_name, slot, [con_file] );
Game.InitLevelPlayerVehicle( vehicle_name, locator_name, slot, [con_file] )
  • vehicle_name: The name of the vehicle to use.
  • locator_name: The name of the CarStart Locator to spawn the vehicle at.
  • slot: The slot to put the vehicle in.
    • DEFAULT: Use this vehicle as the level's default car.
    • OTHER: Use this vehicle as a forced car in a mission.
  • con_file: A path to a CON file.
    • Optional, defaults to the car's normal CON file in scripts/cars.

Examples

Level Default Car

Mission Forced Car

MFK
Lua
SelectMission("m3");
	// ...

	// This sets Comic Book Guy's vehicle as the starting vehicle for this mission.
	InitLevelPlayerVehicle("comic_v", "m3_cbgcar_sd", "OTHER");
	
	SetForcedCar();
	
	AddStage();
		// ...
	CloseStage();
CloseMission();
Game.SelectMission("m3")
	-- ...

	-- This sets Comic Book Guy's vehicle as the starting vehicle for this mission.
	Game.InitLevelPlayerVehicle("comic_v", "m3_cbgcar_sd", "OTHER")
	
	Game.SetForcedCar()
	
	Game.AddStage()
		-- ...
	Game.CloseStage()
Game.CloseMission()