Divergent/mods/[REQUIRED] UI Rework Main M.../gamedata/scripts/zzzzzz_mm_music.script

30 lines
580 B
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
local snd
local mus_t = {
"music\\mm_music\\track_1",
}
function main_menu_on_init()
math.randomseed(os.time())
local picked_track = mus_t[math.random(1, #mus_t)]
if not picked_track then return end
if snd then return end
snd = sound_object(picked_track)
if not snd then return end
snd:play(db.actor,0,sound_object.s2d)
end
function main_menu_on_quit()
if not snd then return end
snd:stop()
snd = nil
end
function on_game_start()
RegisterScriptCallback("main_menu_on_init", main_menu_on_init)
RegisterScriptCallback("main_menu_on_quit", main_menu_on_quit)
end