custom music (repost)

false

Member
Apr 23, 2024
9
0
130
How can i make a custom music mod everything helps. i heard it was easy plus we don't want to listen to mid sm64 Ost
 
how about this one?
local vengabus2 = audio_stream_load('MegaManWily.mp3')
local DTC = audio_stream_load('DameTuCosita.mp3')
local ooahSound = audio_stream_load('return-by-death-sound.mp3')
local RockSolid = audio_stream_load('RockSolid.mp3')


E_MODEL_BOOMBOX = smlua_model_util_get_id("boombox_geo")

function non_l_spawning(m)

if network_is_server() then

if (m.controller.buttonPressed & Z_TRIG) ~= 0 and (m.controller.buttonPressed & R_JPAD) ~= 0 then
--
spawn_sync_object(
id_bhvbomb,
E_MODEL_BOOMBOX,
m.pos.x, m.pos.y, m.pos.z,
nil)

elseif (m.controller.buttonPressed & Z_TRIG) ~= 0 and (m.controller.buttonPressed & L_JPAD) ~= 0 then
--
spawn_sync_object(
id_bhvbom1,
E_MODEL_BOOMBOX,
m.pos.x, m.pos.y, m.pos.z,
nil)

elseif (m.controller.buttonPressed & Z_TRIG) ~= 0 and (m.controller.buttonPressed & U_JPAD) ~= 0 then
--
spawn_sync_object(
id_bhvbom2,
E_MODEL_BOOMBOX,
m.pos.x, m.pos.y, m.pos.z,
nil)
end
end
end

function mario_update_local(m)
non_l_spawning(m)
end

function mario_update(m)
if m.playerIndex == 0 then
mario_update_local(m)
end
end

hook_event(HOOK_MARIO_UPDATE, mario_update)

function explosion(obj)
--
spawn_sync_object(
id_bhvExplosion,
E_MODEL_BREAKABLE_BOX_SMALL,
m.pos.x, m.pos.y, m.pos.z,
nil)
end


local bombtimer = 30 * 60 * 5 --- five minute

define_custom_obj_fields({
obomb = 'u32',
})

function bhvbomb1(obj)
obj.oGraphYOffset = -4.1
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oOpacity = 255
obj.oVelY = 50
obj_scale(obj, 2.2)

obj.oPosY = obj.oPosY + 500

local hitbox = get_temp_object_hitbox()
hitbox.interactType = INTERACT_DAMAGE
hitbox.downOffset = 0
hitbox.damageOrCoinValue = 0
hitbox.health = 1
hitbox.numLootCoins = 1
hitbox.radius = 70
hitbox.height = 70
hitbox.hurtboxRadius = 70
hitbox.hurtboxHeight = 70
obj_set_hitbox(obj, hitbox)

stop_background_music(get_current_background_music())

audio_stream_play(DTC, true, 1)

network_init_object(obj, true, {
'obomb'
})
end

function bhvbombexplodes(obj)
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
ooah_command()
audio_stream_play(ooahSound, true, 10)
end

function bhvbombloop(obj)
local floor = cur_obj_update_floor_height_and_get_floor()
if floor ~= nil then
if obj.oPosY < obj.oFloorHeight + 10 then
obj.oVelY = 0
obj.oPosY = obj.oFloorHeight + 5
obj_orient_graph(obj, floor.normal.x, floor.normal.y, floor.normal.z)
else
obj.oVelY = obj.oVelY - 3
obj.oPosY = obj.oPosY + obj.oVelY
if obj.oPosY < obj.oFloorHeight + 10 then

end
end
end

-- prevent interactions for the first 5 frames
if obj.oTimer < 5 then
obj.oInteractStatus = 0
end

if cur_obj_check_interacted() ~= 0 or obj.oTimer > bombtimer then
bhvbombexplodes(obj)
end
end




function ooah_command()
audio_stream_stop(DTC)
audio_stream_stop(vengabus2)
audio_stream_stop(RockSolid)
end


hook_event(HOOK_ON_WARP, ooah_command)
--------------------

function bhvbombexplosion(obj)
obj.oGraphYOffset = 58
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oOpacity = 255
obj.oVelY = 0
obj_scale(obj, 0.6)

obj.oPosY = obj.oPosY + 350

local hitbox = get_temp_object_hitbox()
hitbox.interactType = INTERACT_DAMAGE
hitbox.downOffset = 0
hitbox.damageOrCoinValue = 4
hitbox.health = 1
hitbox.numLootCoins = 1
hitbox.radius = 100
hitbox.height = 70
hitbox.hurtboxRadius = 100
hitbox.hurtboxHeight = 70
obj_set_hitbox(obj, hitbox)

expl_play_sound()

network_init_object(obj, true, {
'obomb'
})
end

-----------------------
--------------------

function bhvbomb2(obj)
obj.oGraphYOffset = -4.1
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oOpacity = 255
obj.oVelY = 50
obj_scale(obj, 2.2)

obj.oPosY = obj.oPosY + 500

local hitbox = get_temp_object_hitbox()
hitbox.interactType = INTERACT_DAMAGE
hitbox.downOffset = 0
hitbox.damageOrCoinValue = 0
hitbox.health = 1
hitbox.numLootCoins = 1
hitbox.radius = 70
hitbox.height = 70
hitbox.hurtboxRadius = 70
hitbox.hurtboxHeight = 70
obj_set_hitbox(obj, hitbox)

stop_background_music(get_current_background_music())

audio_stream_play(vengabus2, true, 1)

network_init_object(obj, true, {
'obomb'
})
end

-----------------------
--------------------

function bhvbomb3(obj)
obj.oGraphYOffset = -4.1
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oOpacity = 255
obj.oVelY = 50
obj_scale(obj, 2.2)

obj.oPosY = obj.oPosY + 500

local hitbox = get_temp_object_hitbox()
hitbox.interactType = INTERACT_DAMAGE
hitbox.downOffset = 0
hitbox.damageOrCoinValue = 0
hitbox.health = 1
hitbox.numLootCoins = 1
hitbox.radius = 70
hitbox.height = 70
hitbox.hurtboxRadius = 70
hitbox.hurtboxHeight = 70
obj_set_hitbox(obj, hitbox)

stop_background_music(get_current_background_music())

audio_stream_play(RockSolid, true, 1)

network_init_object(obj, true, {
'obomb'
})
end

-----------------------
--------------------

function bhvbomb4(obj)
obj.oGraphYOffset = 58
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oOpacity = 255
obj.oVelY = 0
obj_scale(obj, 0.6)

obj.oPosY = obj.oPosY + 350

local hitbox = get_temp_object_hitbox()
hitbox.interactType = INTERACT_DAMAGE
hitbox.downOffset = 0
hitbox.damageOrCoinValue = 0
hitbox.health = 1
hitbox.numLootCoins = 1
hitbox.radius = 70
hitbox.height = 70
hitbox.hurtboxRadius = 70
hitbox.hurtboxHeight = 70
obj_set_hitbox(obj, hitbox)

expl_play_sound()

network_init_object(obj, true, {
'obomb'
})
end

-----------------------



id_bhvbomb = hook_behavior(nil, OBJ_LIST_PUSHABLE, true, bhvbomb1, bhvbombloop)

id_bhvbom1 = hook_behavior(nil, OBJ_LIST_PUSHABLE, true, bhvbomb2, bhvbombloop)

id_bhvbom2 = hook_behavior(nil, OBJ_LIST_PUSHABLE, true, bhvbomb3, bhvbombloop)

id_bhvExplosion = hook_behavior(nil, OBJ_LIST_PUSHABLE, true, bhvbombexplosion, bhvbombloop)
 
G
do you wanna use midi or mp3/ogg/aiff

yeah, here's the code:

LUA:
local audio = audio_stream_load("audio file.ogg")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_LEVELNAME 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)

make sure to change audio file.ogg and LEVEL_LEVELNAME to level you want to replace the music, for example LEVEL_BOWSER2 or LEVEL_JRB
Replace it with what?
 
yeah, here's the code:

LUA:
local audio = audio_stream_load("audio file.ogg")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_LEVELNAME 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)

make sure to change audio file.ogg and LEVEL_LEVELNAME to level you want to replace the music, for example LEVEL_BOWSER2 or LEVEL_JRB
Thanks, but for racing and slider music? What do I do?
 
PSS is the name for princess peach's secret slide and i have yet to find out what koopa the quick's race theme is in the games code and same for all the other slides.
Don't double post! Use that edit button! Post automatically merged:

how would i replace koopa's road or the theme that plays in BITS BITDW and BITFS
You can't replace koopa's road entirely, but you can put the level names to specifically replace those. Just to be clear i mean acronyms when i say level names.
 

Users who are viewing this thread