Jump to content

Triggered danger conflict


Tykvesh
  • Pending

If two sources push music with different levels they will constantly override each other.

 


Steps to Reproduce

Either:

  • Trigger Moon Stone event level 2 and use a Clout Snout
  • Fight the unchained Klaus and use a Clout Snout
  • Fight the defensive Ancient Fuelweaver and use a Clout Snout



User Feedback


This edit of DynamicMusic should do the trick.

Events with different levels (see Steps to Reproduce) won't override each other, but simply extend the current music.

local _lasttriggeredevent = nil

local function StartTriggeredDanger(player, data)
	local name = data ~= nil and data.name or "default"
	local level = math.max(1, math.floor(data ~= nil and data.level or 1))	
	local duration = data ~= nil and data.duration or 10
	
	if _triggeredlevel == level or (_triggeredlevel ~= nil and _lasttriggeredevent ~= name) then
		_extendtime = math.max(_extendtime, GetTime() + duration)
	elseif _isenabled then
		StopBusy()
		StopDanger()
		
		local music = TRIGGERED_DANGER_MUSIC[name] or TRIGGERED_DANGER_MUSIC.default
		music = music[level] or music[1]
		if #music > 0 then
			_soundemitter:PlaySound(music, "danger")
			if _hasinspirationbuff then
				_soundemitter:SetParameter("danger", "wathgrithr_intensity", _hasinspirationbuff)
			end
		end
		
		_dangertask = inst:DoTaskInTime(duration, StopDanger, true)
		_lasttriggeredevent = name
		_triggeredlevel = level
		_extendtime = 0
	end
end

Share this comment


Link to comment
Share on other sites



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...