share/hedgewars/Data/Missions/Bazooka Training.hwt
changeset 2949 d137a9da7701
parent 2816 30fc14a79aa0
child 2950 81dd71096b1f
equal deleted inserted replaced
2948:3f21a9dc93d0 2949:d137a9da7701
     5 -- by the game, no matter what kind of text is in there.
     5 -- by the game, no matter what kind of text is in there.
     6 -- It's also possible to place a comment after some real
     6 -- It's also possible to place a comment after some real
     7 -- instruction as you see below. In short, everything
     7 -- instruction as you see below. In short, everything
     8 -- following "--" is ignored.
     8 -- following "--" is ignored.
     9 
     9 
       
    10 ---------------------------------------------------------------
       
    11 -- At first we put all text we'd like to use in some arrays.
       
    12 -- This way we're able to localize the text to be shown without
       
    13 -- modifying other files.
       
    14 -- The language to be used is stored in the global variable
       
    15 -- 'L' that is set by the game (string).
       
    16 -- Text may then be accessed using "arrayname[L]".
       
    17 local caption = {
       
    18 	["en"] = "Bazooka Training",
       
    19 	["de"] = "Bazooka-Training"
       
    20 	}
       
    21 local subcaption = {
       
    22 	["en"] = "Aiming Practice",
       
    23 	["de"] = "Zielübung"
       
    24 	}
       
    25 
       
    26 local goal = {
       
    27 	["en"] = "Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.",
       
    28 	["de"] = "Eliminiere alle Ziele bevor die Zeit ausläuft.|Du hast in dieser Mission unbegrenzte Munition."
       
    29 	}
       
    30 
       
    31 local timeout = {
       
    32 	["en"] = "Oh no! Time's up! Just try again.",
       
    33 	["de"] = "Oh nein! Die Zeit ist um! Versuche es nochmal."
       
    34 	}
       
    35 
       
    36 local success = {
       
    37 	["en"] = "Congratulations! You've eliminated all targets|within the allowed time frame.",
       
    38 	["de"] = "Gratulation! Du hast alle Ziele innerhalb der|verfügbaren Zeit ausgeschaltet."
       
    39 	}
       
    40 
       
    41 local teamname = {
       
    42 	["en"] = "'Zooka Team",
       
    43 	["de"] = "Die Knalltüten"
       
    44 	}
       
    45 
       
    46 local hogname = {
       
    47 	["en"] = "Hunter",
       
    48 	["de"] = "Jäger"
       
    49 	}
    10 ---------------------------------------------------------------
    50 ---------------------------------------------------------------
    11 
    51 
    12 -- This variable will hold the number of destroyed targets.
    52 -- This variable will hold the number of destroyed targets.
    13 local score = 0
    53 local score = 0
    14 -- This variable represents the number of targets to destroy.
    54 -- This variable represents the number of targets to destroy.
    71 	Map = "Bamboo"
   111 	Map = "Bamboo"
    72 	-- The theme to be used
   112 	-- The theme to be used
    73 	Theme = "Bamboo"
   113 	Theme = "Bamboo"
    74 
   114 
    75 	-- Create the player team
   115 	-- Create the player team
    76 	AddTeam("'Zooka Team", 14483456, "Simple", "Island", "Default")
   116 	AddTeam(teamname[L], 14483456, "Simple", "Island", "Default")
    77 	-- And add a hog to it
   117 	-- And add a hog to it
    78 	player = AddHog("Hunter", 0, 1, "NoHat")
   118 	player = AddHog(hogname[L], 0, 1, "NoHat")
    79 	SetGearPosition(player, 1960, 1160);
   119 	SetGearPosition(player, 1960, 1160);
    80 end
   120 end
    81 
   121 
    82 -- This function is called when the round starts
   122 -- This function is called when the round starts
    83 -- it spawns the first target that has to be destroyed.
   123 -- it spawns the first target that has to be destroyed.
    90 	-- Parameters are: caption, sub caption, description,
   130 	-- Parameters are: caption, sub caption, description,
    91 	-- extra text, icon and time to show.
   131 	-- extra text, icon and time to show.
    92 	-- A negative icon parameter (-n) represents the n-th weapon icon
   132 	-- A negative icon parameter (-n) represents the n-th weapon icon
    93 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
   133 	-- A positive icon paramter (n) represents the (n+1)-th mission icon
    94 	-- A timeframe of 0 is replaced with the default time to show.
   134 	-- A timeframe of 0 is replaced with the default time to show.
    95 	ShowMission("Bazooka Training", "Aiming Practice", "Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.", -amBazooka, 0);
   135 	ShowMission(caption[L], subcaption[L], goal[L], -amBazooka, 0);
    96 end
   136 end
    97 
   137 
    98 -- This function is called every game tick.
   138 -- This function is called every game tick.
    99 -- Note that there are 1000 ticks within one second.
   139 -- Note that there are 1000 ticks within one second.
   100 -- You shouldn't try to calculate too complicated
   140 -- You shouldn't try to calculate too complicated
   104 	-- We actually check the time to be "1 ms" as it
   144 	-- We actually check the time to be "1 ms" as it
   105 	-- will be at "0 ms" right at the start of the game.
   145 	-- will be at "0 ms" right at the start of the game.
   106 	if TurnTimeLeft == 1 and score < score_goal then
   146 	if TurnTimeLeft == 1 and score < score_goal then
   107 		game_lost = true
   147 		game_lost = true
   108 		-- ... and show a short message.
   148 		-- ... and show a short message.
   109 		ShowMission("Bazooka Training", "Aiming Practice", "Oh no! Time's up! Just try again.", -amSkip, 0);
   149 		ShowMission(caption[L], subcaption[L], timeout[L], -amSkip, 0);
   110 		-- How about killing our poor hog due to his poor performance?
   150 		-- How about killing our poor hog due to his poor performance?
   111 		SetHealth(player, 0);
   151 		SetHealth(player, 0);
   112 		-- Just to be sure set the goal time to 1 ms
   152 		-- Just to be sure set the goal time to 1 ms
   113 		time_goal = 1
   153 		time_goal = 1
   114 	end
   154 	end
   153 			-- ... spawn another target.
   193 			-- ... spawn another target.
   154 			spawnTarget()
   194 			spawnTarget()
   155 		else
   195 		else
   156 			if not game_lost then
   196 			if not game_lost then
   157 			-- Otherwise show that the goal was accomplished
   197 			-- Otherwise show that the goal was accomplished
   158 			ShowMission("Bazooka Training", "Aiming Practice", "Congratulations! You've eliminated all targets|within the allowed time frame.", 0, 0);
   198 			ShowMission(caption[L], subcaption[L], success[L], 0, 0);
   159 			-- Also let the hogs shout "victory!"
   199 			-- Also let the hogs shout "victory!"
   160 			PlaySound(sndVictory)
   200 			PlaySound(sndVictory)
   161 			-- Save the time left so we may keep it.
   201 			-- Save the time left so we may keep it.
   162 			time_goal = TurnTimeLeft
   202 			time_goal = TurnTimeLeft
   163 			end
   203 			end