share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua
changeset 14475 2113296b7a29
parent 14464 ead8928a59f8
child 14482 d4aa64f51c9f
equal deleted inserted replaced
14474:2c3fb87ad1c5 14475:2113296b7a29
       
     1 HedgewarsScriptLoad("/Scripts/Utils.lua")
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 
     3 
     3 local hhs = {}
     4 local hhs = {}
     4 local missionWon = nil
     5 local missionWon = nil
     5 local missionEndHandled = false
     6 local missionEndHandled = false
    96 	local score = GetKillScore()
    97 	local score = GetKillScore()
    97 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score))
    98 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score))
    98 	SendStat(siPointType, loc("points"))
    99 	SendStat(siPointType, loc("points"))
    99 	SendStat(siPlayerKills, tostring(score), playerTeamName)
   100 	SendStat(siPlayerKills, tostring(score), playerTeamName)
   100 	PlaySound(sndHellish)
   101 	PlaySound(sndHellish)
       
   102 
       
   103 	-- Update highscore
       
   104 	updateChallengeRecord("Highscore", score)
       
   105 
   101 	EndGame()
   106 	EndGame()
   102 end
   107 end
   103 
   108 
   104 function GG()
   109 function GG()
   105 	missionWon = true
   110 	missionWon = true
   114 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore))
   119 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore))
   115 	SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore))
   120 	SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore))
   116 	SendStat(siPointType, loc("points"))
   121 	SendStat(siPointType, loc("points"))
   117 	SendStat(siPlayerKills, tostring(score), playerTeamName)
   122 	SendStat(siPlayerKills, tostring(score), playerTeamName)
   118 	SetTeamLabel(playerTeamName, tostring(score))
   123 	SetTeamLabel(playerTeamName, tostring(score))
       
   124 
       
   125 	-- Update highscore
       
   126 	updateChallengeRecord("Highscore", score)
   119 
   127 
   120 	if hhs[0] and GetHealth(hhs[0]) then
   128 	if hhs[0] and GetHealth(hhs[0]) then
   121 		SetEffect(hhs[0], heInvulnerable, 1)
   129 		SetEffect(hhs[0], heInvulnerable, 1)
   122 	end
   130 	end
   123 	SetTurnTimeLeft(MAX_TURN_TIME)
   131 	SetTurnTimeLeft(MAX_TURN_TIME)
   186 
   194 
   187 
   195 
   188 function onGameStart()
   196 function onGameStart()
   189 	SendHealthStatsOff()
   197 	SendHealthStatsOff()
   190 
   198 
       
   199 	local recordInfo = getReadableChallengeRecord("Highscore")
       
   200 	if recordInfo == nil then
       
   201 		recordInfo = ""
       
   202 	else
       
   203 		recordInfo = "|" .. recordInfo
       
   204 	end
   191 	ShowMission     (
   205 	ShowMission     (
   192                         loc("Rope-knocking Challenge"),
   206                         loc("Rope-knocking Challenge"),
   193                         loc("Challenge"),
   207                         loc("Challenge"),
   194                         loc("Use the rope to knock your enemies to their doom.") .. "|" ..
   208                         loc("Use the rope to knock your enemies to their doom.") .. "|" ..
   195                         loc("Finish this challenge as fast as possible to earn bonus points."),
   209                         loc("Finish this challenge as fast as possible to earn bonus points.").. recordInfo,
   196                         -amRope, 4000)
   210                         -amRope, 4000)
   197 	SetTeamLabel(playerTeamName, "0")
   211 	SetTeamLabel(playerTeamName, "0")
   198 
   212 
   199 	PlaceGirder(46,1783, 0)
   213 	PlaceGirder(46,1783, 0)
   200 
   214