share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua
changeset 14475 2113296b7a29
parent 14464 ead8928a59f8
child 14480 208359558642
equal deleted inserted replaced
14474:2c3fb87ad1c5 14475:2113296b7a29
    11 -- At first we implement the localization library using loadfile.
    11 -- At first we implement the localization library using loadfile.
    12 -- This allows us to localize strings without needing to think
    12 -- This allows us to localize strings without needing to think
    13 -- about translations.
    13 -- about translations.
    14 -- We can use the function loc(text) to localize a string.
    14 -- We can use the function loc(text) to localize a string.
    15 
    15 
       
    16 HedgewarsScriptLoad("/Scripts/Utils.lua")
    16 HedgewarsScriptLoad("/Scripts/Locale.lua")
    17 HedgewarsScriptLoad("/Scripts/Locale.lua")
    17 
    18 
    18 -- This variable will hold the number of destroyed targets.
    19 -- This variable will hold the number of destroyed targets.
    19 local score = 0
    20 local score = 0
    20 -- This variable will hold the number of shots from the sniper rifle
    21 -- This variable will hold the number of shots from the sniper rifle
   145 	-- Disable graph in stats screen
   146 	-- Disable graph in stats screen
   146 	SendHealthStatsOff()
   147 	SendHealthStatsOff()
   147 	-- Spawn the first target.
   148 	-- Spawn the first target.
   148 	spawnTarget(860,1020)
   149 	spawnTarget(860,1020)
   149 
   150 
       
   151 	local highscore = getReadableChallengeRecord("Highscore")
   150 	-- Show some nice mission goals.
   152 	-- Show some nice mission goals.
   151 	-- Parameters are: caption, sub caption, description,
   153 	-- Parameters are: caption, sub caption, description,
   152 	-- extra text, icon and time to show.
   154 	-- extra text, icon and time to show.
   153 	-- A negative icon parameter (-n) represents the n-th weapon icon
   155 	-- A negative icon parameter (-n) represents the n-th weapon icon
   154 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
   156 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
   155 	-- A timeframe of 0 is replaced with the default time to show.
   157 	-- A timeframe of 0 is replaced with the default time to show.
   156 	ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amSniperRifle, 0)
   158 	ShowMission(loc("Sniper Training"), loc("Aiming Practice"),
       
   159 	loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.")
       
   160 	.. "|" .. highscore, -amSniperRifle, 0)
   157 
   161 
   158 	-- Displayed initial player score
   162 	-- Displayed initial player score
   159 	SetTeamLabel(playerTeamName, "0")
   163 	SetTeamLabel(playerTeamName, "0")
   160 end
   164 end
   161 
   165 
   431 		SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots))
   435 		SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots))
   432 		end_score_overall = end_score_targets
   436 		end_score_overall = end_score_targets
   433 	end
   437 	end
   434 	SendStat(siPointType, loc("points"))
   438 	SendStat(siPointType, loc("points"))
   435 	SendStat(siPlayerKills, tostring(end_score_overall), playerTeamName)
   439 	SendStat(siPlayerKills, tostring(end_score_overall), playerTeamName)
   436 end
   440 	updateChallengeRecord("Highscore", end_score_overall)
   437 
   441 end
       
   442