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

AddObjective

Adds an objective 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
AddObjective( objective_type, [ arrow_type ]);
AddObjective( objective_type, [ gamble_string, arrow_type ]);
Game.AddObjective( objective_type, [ arrow_type ])
Game.AddObjective( objective_type, [ gamble_string, arrow_type ])
  • objective_type: The objective type.
  • gamble_string: The string gamble.
    • When the objective is race and the 2nd argument is gamble, the race will be set to be a gamble race.
    • Otherwise, including this string does nothing.
  • arrow_type: The type of road arrows to use in this stage.
    • BOTH/both/b: Place road arrows on both the nearest road and intersections.
    • NEITHER/neither/n: Do not place road arrows.
    • INTERSECTION/intersection/i: Place road arrows on intersections.
    • NEAREST ROAD/nearest road: Place road arrows on the nearest road.
      • The game also checks for n for this arrow_type, but having already checked it for NEITHER/neither/n, this check can never be true.

Examples

MFK
Lua
AddObjective("getin", "neither");
	// ...
CloseObjective();
AddObjective("race", "gamble");
	// ...
CloseObjective();
AddObjective("race", "gamble", "neither");
	// ...
CloseObjective();
Game.AddObjective("getin", "neither")
	-- ...
Game.CloseObjective()
Game.AddObjective("race", "gamble")
	-- ...
Game.CloseObjective()
Game.AddObjective("race", "gamble", "neither")
	-- ...
Game.CloseObjective()

Notes

The actual code for checking arrow_type compares the last argument against all valid arrow types, not specifically the second or third (depending on the presence of gamble). This code is stupid, hence the documentation above not acknowledging this weird behaviour.