Jump to content

Recommended Posts

I know that you can replace the sound through:
RemapSoundEvent("path/to/original/music", "your/music/path/in/fmod/bank").
But some sounds are not registered in the Dynamicmusic.lua file. What should I do to replace the sound and where should I write it out? should I add it to Dynamicmusic.lua or to modmain? For example, I want to change the sound for

RemapSoundEvent («dontstarve/HUD/Together_HUD/skin_tab_active», «music_mod/music/skin_tab_active»).

I found 2 of his codes:

giftitempopup.lua:

function GiftItemPopUp:OnClose()
    TheFrontEnd:GetSound():KillSound("gift_idle")
    TheFrontEnd:GetSound():PlaySound("dontstarve/HUD/Together_HUD/player_receives_gift_animation_skinout")
    --self.spawn_portal:GetAnimState():PlayAnimation("put_away")
    self.spawn_portal:GetAnimState():PlayAnimation("skin_out")
    if self.menu then
        self.menu:Kill()
    end
    self.show_menu = false
end

thankyoupopup.lua:

function ThankYouPopup:GoAway()
    self.can_close = false
    TheFrontEnd:GetSound():KillSound("gift_idle")
    TheFrontEnd:GetSound():PlaySound("dontstarve/HUD/Together_HUD/player_receives_gift_animation_skinout", "ty_close_sound")
    self.spawn_portal:GetAnimState():PlayAnimation("skin_out")

    --self.banner:Hide()
    self.item_name:Hide()
    self.upper_banner_text:Hide()
    self.right_btn:Hide()
    self.left_btn:Hide()
    self.close_btn:Hide()
end

how to understand which code is more correct and how to rewrite it correctly so that it replaces the sound?

perhaps my question will be incorrect because it is difficult for me to communicate in two languages. I'm sorry.

8 hours ago, _zwb said:

Doesn't this change the sound? You just answered the question yourself...?

the fact is that I tried to add music during the pause of the game using this code in modmain.lua

AddClassPostConstruct("screens/redux/pausescreen", function(self)

    if self.active then GLOBAL.TheFrontEnd:GetSound():PlaySound("music_mod/music/pause", "pausemusic") end


    function self:unpause()
        GLOBAL.TheFrontEnd:GetSound():KillSound("pausemusic")
        GLOBAL.TheInput:CacheController()
        self.active = false
        GLOBAL.TheFrontEnd:PopScreen(self)
        GLOBAL.SetPause(false)
        GLOBAL.TheWorld:PushEvent("continuefrompause")
    end


end)

and no music was added, then I tried to do it through

RemapSoundEvent( "screens/redux/pausescreen", "music_mod/music/pause" )

And it didn't work out for me either. maybe I have indicated the path incorrectly?

1 hour ago, space iris said:

"sound file's issue" is it in terms of incorrectly configured in FMOD or is the sound itself incorrect?

Would the sound play if you execute this command in the console?

TheFrontEnd:GetSound():PlaySound("music_mod/music/pause")

If not then it's the sound file's issue, could be either FMOD configurations or sound itself.

7 hours ago, _zwb said:

Would the sound play if you execute this command in the console?

TheFrontEnd:GetSound():PlaySound("music_mod/music/pause")

If not then it's the sound file's issue, could be either FMOD configurations or sound itself.

well, it only works in the main menu, but when I go into the world and try to do it there through the console, it doesn't play. however, when I pause via Esc and exit, then after a pause, you can hear the music that is given during the pause playing, but it lasts a couple of seconds and stops.

Edited by space iris
6 hours ago, space iris said:

well, it only works in the main menu, but when I go into the world and try to do it there through the console, it doesn't play. however, when I pause via Esc and exit, then after a pause, you can hear the music that is given during the pause playing, but it lasts a couple of seconds and stops.

Try TheFocalPoint.SoundEmitter:PlaySound("music_mod/music/pause")

3 hours ago, _zwb said:

Try TheFocalPoint.SoundEmitter:PlaySound("music_mod/music/pause")

this console command does not work in the main menu and in the world itself. I noticed that if you disable the auto-pause when pressing Esc, the music will play, but also for a couple of seconds and silence.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...