• Do not use Works in Progress as a way of avoiding the releases system! Works in Progress can be used for sharing early betas and for getting suggestions for improvement. Releases of finished content are not allowed in this forum! If you would like to submit a finished addon, click here for instructions on how to do so.

Need Help Changing The Drowning Music

Status
Not open for further replies.

Chezi

Chili Dogs
I'm attempting to make TerminalMontage's Sonic (aka Chili Dog) and I thought a neat little reference would be to replace the drowning music with the Totino's Mania version. I know how to replace music, but what I need to know is how to get it to change only when I'm playing as Chili Dog
 
I believe you need to make a new entry and type O_DROWN OR O__DROWN AND THEN PUT THE MUSIC IN



______________________
Enjoy the totinos pizza roll sonic
 
Well, yeah I know that's how you do it, but then it'll play for every character. If I have Chili Dog and Junio Sonic added on, Junio will be able to hear the Totino's version instead of the regular version. I only want Chili Dog to be able to hear it
 
Do you know lua? You will need it to make character-specific drown music
That might be simple tho. Start checking the player skin, then check if its drowning.
 
Do you know lua? You will need it to make character-specific drown music
That might be simple tho. Start checking the player skin, then check if its drowning.

I started learning lua to attempt this. So far I have this, but I'm not sure if that's overcomplicating things. It also starts playing whenever I jump into water instead of when I start drowning. O_TDRN is the name of the music lump.

Code:
addHook("ThinkFrame", do
    for player in players.iterate
        //drown
        if (player.mo and player.mo.skin == "chilidog")
        if player.powers[pw_underwater]
            S_ChangeMusic("tdrn",true,player)
        else
            P_RestoreMusic(player)
        end
        end
    end
end)
 
I started learning lua to attempt this. So far I have this, but I'm not sure if that's overcomplicating things. It also starts playing whenever I jump into water instead of when I start drowning. O_TDRN is the name of the music lump.

Code:
addHook("ThinkFrame", do
    for player in players.iterate
        //drown
        if (player.mo and player.mo.skin == "chilidog")
        if player.powers[pw_underwater]
            S_ChangeMusic("tdrn",true,player)
        else
            P_RestoreMusic(player)
        end
        end
    end
 end)


If it's possible, you should check if the drowning music is playing, not if Chilidog is in water.
 
Code:
addHook("ThinkFrame", do
    for player in players.iterate do
        if not player.isdrowning then
            player.isdrowning = 0
        end
        if player.mo and player.mo.skin == "chilidog" then
            if player.powers[pw_underwater] == 385 then
                P_PlayJingleMusic(player, "TDRN", 0, false, JT_DROWN)
                player.isdrowning = 1
            elseif player.powers[pw_underwater] == 0 and player.isdrowning == 1 then
                P_RestoreMusic(player)
                player.isdrowning = 0
            end
        end
    end
end)
The purpose of checking if the player's underwater timer is specifically 385 is so we can execute this stuff on the same frame that the drowning music starts. Thus, we're basically "overwriting" it. If you're curious, I tested this (with a few modifications) in the GFZ1 waterfall as Sonic and Knuckles. For Sonic, yes, the music did play, but not for Knuckles.
 
Last edited:
Thanks NAR! I'll try to get this code in as soon as possible. I'm still learning about lua and how things should work, but I think this should broaden my understanding
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top