How can i make a music mod?

LUA:
-- name: Mario 64 Undertale Music

local audio = audio_stream_load("Undertale OST - 050 Metal Crusher.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_BOWSER_1 then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 005 Ruins.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_HMC then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 005 Ruins.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_WDW then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 014 Heartache.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_BOSS then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 022 Snowdin Town.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_CCM then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 022 Snowdin Town.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_SL then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 027 Dating Fight!.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_SLIDE then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)



local audio = audio_stream_load("Undertale OST - 050 Metal Crusher.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_BOWSER_2 then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 065 CORE.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_DARK_WORLD then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 065 CORE.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_FIRE_SEA then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)
local audio = audio_stream_load("Undertale OST - 065 CORE.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_BITS then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 077 ASGORE.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_BOWSER_3 then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 095 Bring It In, Guys!.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_STAFF_ROLL then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

local audio = audio_stream_load("Undertale OST - 050 Metal Crusher.mp3")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_CASTLE then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)
Don't double post! Use that edit button! Post automatically merged:

Is your id for cool cool mountain "LEVEL_CCM"?
yes
 
Put all of the seperate on_warp functions all together or rename all of them except one. Right now, you are redefining the function, meaning only the bottom on_warp definition with LEVEL_CASTLE gets called. The same is with the audio variable. Here is a example of what I used (just ignore the tp function):
LUA:
local audio = audio_stream_load("Spiderman.ogg")
local audio2 = audio_stream_load("LCA!.ogg")
local audio3 = audio_stream_load("BTIA.ogg")
local audio4 = audio_stream_load("FFortress.ogg")
local audio5 = audio_stream_load("Bowser8.ogg")
local audio6 = audio_stream_load("FindYFlame.ogg")
function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_WF then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end
function construct_tp()
    if gNetworkPlayers[0] then
        warp_to_level(LEVEL_WF, 1, 0)
        return true
    end
end
function on_warp2()
  if  gNetworkPlayers[0].currLevelNum == LEVEL_TTC then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio2, true)
    audio_stream_play(audio2, true, 1)
  else
    audio_stream_play(audio2, true, 0)
  end
end

function on_warp3()
  if  gNetworkPlayers[0].currLevelNum == LEVEL_BOWSER_1 then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio3, true)
    audio_stream_play(audio3, true, 1)
  else
    audio_stream_play(audio3, true, 0)
  end
end
function on_warp4()
  if  gNetworkPlayers[0].currLevelNum == LEVEL_BITFS then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio4, true)
    audio_stream_play(audio4, true, 1)
  else
    audio_stream_play(audio4, true, 0)
  end
end

function on_warp5()
  if  gNetworkPlayers[0].currLevelNum == LEVEL_BITDW then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio5, true)
    audio_stream_play(audio5, true, 1)
  else
    audio_stream_play(audio5, true, 0)
  end
end

function on_warp6()
  if  gNetworkPlayers[0].currLevelNum == LEVEL_LLL then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio6, true)
    audio_stream_play(audio6, true, 1)
  else
    audio_stream_play(audio6, true, 0)
  end
end


hook_event(HOOK_ON_WARP, on_warp)
hook_event(HOOK_ON_WARP, on_warp2)
hook_event(HOOK_ON_WARP, on_warp3)
hook_event(HOOK_ON_WARP, on_warp4)
hook_event(HOOK_ON_WARP, on_warp5)
hook_event(HOOK_ON_WARP, on_warp6)
hook_event(HOOK_ON_WARP, on_warp7)
hook_event(HOOK_ON_WARP, on_warp8)
hook_event(HOOK_ON_WARP, on_warp9)
hook_event(HOOK_ON_WARP, on_warp10)
hook_event(HOOK_ON_WARP, on_warp11)
hook_event(HOOK_ON_WARP, on_warp12)
hook_event(HOOK_ON_WARP, on_warp13)
hook_chat_command("Test", "Test", construct_tp)
 

Users who are viewing this thread