share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua
changeset 14475 2113296b7a29
parent 14464 ead8928a59f8
child 14480 208359558642
equal deleted inserted replaced
14474:2c3fb87ad1c5 14475:2113296b7a29
       
     1 HedgewarsScriptLoad("/Scripts/Utils.lua")
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Achievements.lua")
     3 HedgewarsScriptLoad("/Scripts/Achievements.lua")
     3 
     4 
     4 local player = nil
     5 local player = nil
     5 local RCGear = nil
     6 local RCGear = nil
    44 
    45 
    45 function onGameStart()
    46 function onGameStart()
    46 
    47 
    47 	SendHealthStatsOff()
    48 	SendHealthStatsOff()
    48 
    49 
       
    50 	local recordInfo = getReadableChallengeRecord("Lowscore")
    49 	ShowMission     (
    51 	ShowMission     (
    50                                 loc("RC Plane Challenge"),
    52                                 loc("RC Plane Challenge"),
    51                                 loc("Challenge"),
    53                                 loc("Challenge"),
    52 
    54 
    53                                 loc("Collect or destroy all the health crates.") .. "|" ..
    55                                 loc("Collect or destroy all the health crates.") .. "|" ..
    54                                 loc("Compete to use as few planes as possible!") .. "|" ..
    56                                 loc("Compete to use as few planes as possible!") .. "|" ..
    55 								"", -amRCPlane, 4000
    57                                 recordInfo, -amRCPlane, 4000
    56                                 )
    58                                 )
    57 	SetTeamLabel(loc("Wannabe Flyboys"), "0")
    59 	SetTeamLabel(loc("Wannabe Flyboys"), "0")
    58 
    60 
    59 	PlaceGirder(2192, 508, 6)
    61 	PlaceGirder(2192, 508, 6)
    60 	PlaceGirder(2192, 670, 6)
    62 	PlaceGirder(2192, 670, 6)
   406 				AddCaption(loc("Victory!"))
   408 				AddCaption(loc("Victory!"))
   407 				SendStat(siGameResult, loc("You have finished the challenge!"))
   409 				SendStat(siGameResult, loc("You have finished the challenge!"))
   408 				SendStat(siCustomAchievement, string.format(loc("You have used %d RC planes."), planesUsed))
   410 				SendStat(siCustomAchievement, string.format(loc("You have used %d RC planes."), planesUsed))
   409 			end
   411 			end
   410 			SaveMissionVar("Won", "true")
   412 			SaveMissionVar("Won", "true")
       
   413 			updateChallengeRecord("Lowscore", planesUsed)
   411 		
   414 		
   412 			if(totalMissiles > 1) then
   415 			if(totalMissiles > 1) then
   413 				SendStat(siCustomAchievement, string.format(loc("You have dropped %d missiles."), totalMissiles))
   416 				SendStat(siCustomAchievement, string.format(loc("You have dropped %d missiles."), totalMissiles))
   414 			end
   417 			end
   415 
   418