share/hedgewars/Data/Scripts/SpeedShoppa.lua
changeset 14475 2113296b7a29
parent 14464 ead8928a59f8
child 14480 208359558642
equal deleted inserted replaced
14474:2c3fb87ad1c5 14475:2113296b7a29
    19 the appropriate parameters. Really, that’s all!
    19 the appropriate parameters. Really, that’s all!
    20 See the comment of SpeedShoppaMission for a specification of all parameters.
    20 See the comment of SpeedShoppaMission for a specification of all parameters.
    21 
    21 
    22 ]=]
    22 ]=]
    23 
    23 
       
    24 HedgewarsScriptLoad("/Scripts/Utils.lua")
    24 HedgewarsScriptLoad("/Scripts/Locale.lua")
    25 HedgewarsScriptLoad("/Scripts/Locale.lua")
    25 
    26 
    26 --[[
    27 --[[
    27 SpeedShoppaMission(params)
    28 SpeedShoppaMission(params)
    28 
    29 
   113 		SetAmmo(amRope, 9, 0, 0, 1)
   114 		SetAmmo(amRope, 9, 0, 0, 1)
   114 	end
   115 	end
   115 
   116 
   116 	_G.onGameStart = function()
   117 	_G.onGameStart = function()
   117 		SendHealthStatsOff()
   118 		SendHealthStatsOff()
   118 		ShowMission(params.missionTitle, loc("Challenge"), params.goalText, -amRope, 5000) 
   119 		local append = getReadableChallengeRecord("TimeRecord")
       
   120 		ShowMission(params.missionTitle, loc("Challenge"), params.goalText .. "|" .. append, -amRope, 5000)
   119 		-- <crates collected>/<total number of crates>
   121 		-- <crates collected>/<total number of crates>
   120 		SetTeamLabel(params.teamName, string.format(loc("%d/%d"), cratesCollected, #crates))
   122 		SetTeamLabel(params.teamName, string.format(loc("%d/%d"), cratesCollected, #crates))
   121 		for i=1,#crates do
   123 		for i=1,#crates do
   122 			spawnCrate(crates[i].x, crates[i].y)
   124 			spawnCrate(crates[i].x, crates[i].y)
   123 		end
   125 		end
   174 				SendStat(siPointType, loc("milliseconds"))
   176 				SendStat(siPointType, loc("milliseconds"))
   175 				local time = startTime - endTime
   177 				local time = startTime - endTime
   176 				SendStat(siPlayerKills, tostring(time), params.teamName)
   178 				SendStat(siPlayerKills, tostring(time), params.teamName)
   177 				SendStat(siCustomAchievement, string.format(loc("You have finished the challenge in %.3f s."), (time/1000)))
   179 				SendStat(siCustomAchievement, string.format(loc("You have finished the challenge in %.3f s."), (time/1000)))
   178 				SetTurnTimeLeft(0)
   180 				SetTurnTimeLeft(0)
       
   181 				updateChallengeRecord("TimeRecord", time)
   179 			else
   182 			else
   180 				SendStat(siGameResult, loc("Challenge failed!"))
   183 				SendStat(siGameResult, loc("Challenge failed!"))
   181 				SendStat(siPointType, loc("crate(s)"))
   184 				SendStat(siPointType, loc("crate(s)"))
   182 				SendStat(siPlayerKills, tostring(cratesCollected), params.teamName)
   185 				SendStat(siPlayerKills, tostring(cratesCollected), params.teamName)
   183 				SendStat(siCustomAchievement, string.format(loc("You have collected %d out of %d crate(s)."), cratesCollected, #crates))
   186 				SendStat(siCustomAchievement, string.format(loc("You have collected %d out of %d crate(s)."), cratesCollected, #crates))