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
  • Mission Conditions

followdistance

Fail the player if they go beyond a certain distance from an AI vehicle.

Examples

MFK
Lua
AddCondition("followdistance");
	// Required: Specify the distance the player needs to be in order to fail. Only the second value is used, the first value is always treated as 0.
	SetFollowDistances(0, 250);
  
	// Required: Specify which vehicle the player needs to stay close to.
	SetCondTargetVehicle("cVan");
CloseCondition();
Game.AddCondition("followdistance")
	-- Required: Specify the distance the player needs to be in order to fail. Only the second value is used, the first value is always treated as 0.
	Game.SetFollowDistances(0, 250)
	
	-- Required: Specify which vehicle the player needs to stay close to.
	Game.SetCondTargetVehicle("cVan")
Game.CloseCondition()

Notes

This condition isn't limited to follow objectives, it can also be used with any other objective so long as an AI vehicle is present.

Do note, however, that when used with a losetail objective, the game will only render a single bar that constantly switches between the distance of the followdistance condition and the losetail objective.