# HG changeset patch # User Wuzzy # Date 1540521047 -7200 # Node ID e340ce5500d7bc4ef644d545dd8c80d8904cdfb6 # Parent 2828ec67c47c8ff00ba110bc2afa30df5f1edf16 Properly play Valkyries music in Rope Knock Challenge (no more music overlap) diff -r 2828ec67c47c -r e340ce5500d7 share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua --- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua Fri Oct 26 04:07:35 2018 +0200 +++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua Fri Oct 26 04:30:47 2018 +0200 @@ -6,6 +6,7 @@ local hogsKilled = 0 local finishTime local ouchies = false +local valkyriesTimer = -1 local HogData = { {"amn", "NinjaFull",false}, @@ -85,6 +86,8 @@ end function GameOverMan() + StopMusicSound(sndRideOfTheValkyries) + valkyriesTimer = -1 missionWon = false ProtectEnemies() ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0) @@ -242,10 +245,21 @@ end +function onGameTick20() + if (valkyriesTimer > 0) then + valkyriesTimer = valkyriesTimer - 20 + if valkyriesTimer <= 0 then + StopMusicSound(sndRideOfTheValkyries) + end + end +end + function onGearDamage(gear, damage) if gear == hhs[0] then ouchies = true + StopMusicSound(sndRideOfTheValkyries) + valkyriesTimer = -1 ProtectEnemies() end @@ -260,7 +274,9 @@ SetTeamLabel(playerTeamName, tostring(GetKillScore())) if hogsKilled == 15 then - PlaySound(sndRideOfTheValkyries) + PlayMusicSound(sndRideOfTheValkyries) + -- Time in ms after which to return to normal music + valkyriesTimer = 20000 elseif hogsKilled == 16 then finishTime = TurnTimeLeft GG()