Fidooop Posted May 20, 2014 Share Posted May 20, 2014 (edited) Hey, thanks for looking at the thread! I have this Markiplier mod and it has custom fight music in it (borrowed some code from other mods that did the same thing) though it has errors... the 2 things I want to accomplish is making it fade out instead of instantly pausing and making it play the normal music whenever anybody except markiplier is playing! here is the code I am using... (in the modmain) function MarkPostInit(markiplier) ---Music replacementsRemapSoundEvent( "dontstarve/music/music_danger", "markiplier_dance_party/music/danger_mark" )RemapSoundEvent( "dontstarve/music/music_danger_cave", "markiplier_dance_party/music/danger_mark_cave" )RemapSoundEvent( "dontstarve/music/music_danger_ruins", "markiplier_dance_party/music/danger_mark_ruins" )RemapSoundEvent( "dontstarve/music/music_danger_winter", "markiplier_dance_party/music/danger_mark_winter" )----Music dynamicslocal DynamicMusic = Class(function(self, inst) self.enabled = true self.is_busy = false self.busy_timeout = 0 self.playing_danger = falseend) function DynamicMusic:OnStartDanger() if not self.enabled then return end self.danger_timeout = 10 if not self.playing_danger then local epic = GetClosestInstWithTag("epic", self.inst, 30) local soundpath = nil if epic then soundpath = "dontstarve/music/music_epicfight" elseif GetWorld():IsCave() then soundpath = "dontstarve/music/music_danger_cave" else soundpath = "dontstarve/music/music_danger" end self.inst.SoundEmitter:PlaySound(soundpath, "danger") self:StopPlayingBusy() self.playing_danger = true endend function DynamicMusic:StopPlayingDanger() self.inst.SoundEmitter:KillSound("danger") self.playing_danger = falseend function DynamicMusic:OnUpdate(dt) if self.danger_timeout and self.danger_timeout > 0 then self.danger_timeout = self.danger_timeout - dt if self.danger_timeout <= 0 then self:StopPlayingDanger() end end if self.busy_timeout and self.busy_timeout > 0 then self.busy_timeout = self.busy_timeout - dt if self.busy_timeout <= 0 then self:StopPlayingBusy() self.is_busy = false end endendend ------------------------------------------------------------------------If not playing as Markiplierfunction NotMarkPostInit(markiplier) ---Music replacementsRemapSoundEvent( "dontstarve/music/music_danger", "dontstarve/music/music_danger" )RemapSoundEvent("dontstarve/music/music_danger_cave", "dontstarve/music/music_danger_cave" )RemapSoundEvent( "dontstarve/music/music_danger_ruins", "dontstarve/music/music_danger_ruins" )RemapSoundEvent("dontstarve/music/music_danger_winter", "dontstarve/music/music_danger_winter" )----Music dynamicslocal DynamicMusic = Class(function(self, inst) self.enabled = true self.is_busy = false self.busy_timeout = 0 self.playing_danger = falseend) function DynamicMusic:OnStartDanger() if not self.enabled then return end self.danger_timeout = 10 if not self.playing_danger then local epic = GetClosestInstWithTag("epic", self.inst, 30) local soundpath = nil if epic then soundpath = "dontstarve/music/music_epicfight" elseif GetWorld():IsCave() then soundpath = "dontstarve/music/music_danger_cave" else soundpath = "dontstarve/music/music_danger" end self.inst.SoundEmitter:PlaySound(soundpath, "danger") self:StopPlayingBusy() self.playing_danger = true endend function DynamicMusic:StopPlayingDanger() self.inst.SoundEmitter:KillSound("danger") self.playing_danger = falseend function DynamicMusic:OnUpdate(dt) if self.danger_timeout and self.danger_timeout > 0 then self.danger_timeout = self.danger_timeout - dt if self.danger_timeout <= 0 then self:StopPlayingDanger() end end if self.busy_timeout and self.busy_timeout > 0 then self.busy_timeout = self.busy_timeout - dt if self.busy_timeout <= 0 then self:StopPlayingBusy() self.is_busy = false end endendend AddSimPostInit(function(inst) if inst.prefab == "markiplier" then MarkPostInit(inst) else NotMarkPostInit(inst) endend) thanks so much if you got any ideas on how to fix these problems!!! Edited May 20, 2014 by Fidooop Link to comment https://forums.kleientertainment.com/forums/topic/36654-custom-fight-music-problems-help-please/ Share on other sites More sharing options...
DirtyDan Posted May 31, 2014 Share Posted May 31, 2014 I also need help with this, as I am adding custom music to my mod. Link to comment https://forums.kleientertainment.com/forums/topic/36654-custom-fight-music-problems-help-please/#findComment-491860 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now