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
  • Modding Tools
  • Lucas' Simpsons Hit & Run Mod Launcher
  • Hacks
  • Mod Requirable Hacks
  • Additional Script Functionality
  • Console Commands
  • MFK Commands
  • Mission Initialisation
  • Stages
  • Objectives

SetObjSound

Available since Version 1.18.

Set a sound to use for the following ASF objective types:

Scope

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

Syntax

hitpeds Objective

MFK
Lua
SetObjSound( sound );
Game.SetObjSound( sound )
  • sound: The name of the daSoundResourceData to play.

insidetrigger / outsidetrigger Objectives

MFK
Lua
SetCondSound( sound, event, [time_between, start_delay] );
Game.SetCondSound( sound, event, [time_between, start_delay] )
  • sound: The name of the daSoundResourceData to play.
  • event: The event to play the sound on.
    • enter_trigger: Play the sound when entering the trigger.
    • inside_trigger: Play the sound when inside the trigger
      • Only for insidetrigger objectives.
    • outside_trigger: Play the sound when outside the trigger
      • Only for outsidetrigger objectives.
    • exit_trigger: Play the sound when exiting the trigger.
  • time_between: The time between each time the sound plays in second
    • Only for inside_trigger or outside_trigger events.
  • start_delay: The delay before the sound starts playing after entering/exiting the trigger in seconds
    • Only for inside_trigger or outside_trigger events.

Examples

hitpeds Objective

MFK
Lua
AddObjective("hitpeds");
	AddObjSound("generic_car_explode");
CloseObjective();
Game.AddObjective("hitpeds")
	Game.AddObjSound("generic_car_explode")
Game.CloseObjective()

insidetrigger / outsidetrigger Objectives

MFK
Lua
AddObjective("insidetrigger");
	SetObjTrigger("z2phone1");

	SetObjSound("enter_trigger", "gag_alm2");
	SetObjSound("inside_trigger", "countdown_beeps", 1, 5);
	SetObjSound("exit_trigger", "P_HitByC_Mrg_01");
CloseObjective();
Game.AddObjective("insidetrigger")
	Game.SetObjTrigger("z2phone1")

	Game.SetObjSound("enter_trigger", "gag_alm2")
	Game.SetObjSound("inside_trigger", "countdown_beeps", 1, 5)
	Game.SetObjSound("exit_trigger", "P_HitByC_Mrg_01")
Game.CloseObjective()