share/hedgewars/Data/Missions/Campaign/01#Boot Camp.lua
changeset 3761 f96b99f944e6
child 3762 aef7d95dd159
equal deleted inserted replaced
3760:d30f1ba768d7 3761:f96b99f944e6
       
     1 -- IMPORTANT -- THIS IS WORK IN PROGRESS AND VERY LIKELY TO BE CHANGED AGAIN
       
     2 -- IMPORTANT -- SAVE YOURSELF THE WORK AND DON'T TRANSLATE THE TEXTS IF YOU FEAR STARTING OVER LATER!
       
     3 
       
     4 local teamnames = {}
       
     5 local hognames = {}
       
     6 teamnames[0] = {
       
     7 	["en"] = "Bloody Rookies",
       
     8 	["de"] = "Blutige Anfänger"
       
     9 }
       
    10 
       
    11 teamnames[1] = {
       
    12 	["en"] = "Instructors",
       
    13 	["de"] = "Ausbilder"
       
    14 }
       
    15 
       
    16 hognames[0] = {
       
    17 	["en"] = "Joker",
       
    18 	["de"] = "Joker"
       
    19 }
       
    20 
       
    21 hognames[1] = {
       
    22 	["en"] = "Harthog",
       
    23 	["de"] = "Harthog"
       
    24 }
       
    25 
       
    26 local caption = {
       
    27 	["en"] = "Boot Camp",
       
    28 	["de"] = "Grundausbildung"
       
    29 }
       
    30 
       
    31 local subcaption = {
       
    32 	["en"] = "Follow the instructions!",
       
    33 	["de"] = "Befolge die Anweisungen!"
       
    34 }
       
    35 
       
    36 local goals = {}
       
    37 
       
    38 goals[0] = {
       
    39 	["en"] = "Listen to your Drill Instructor and follow his lead!",
       
    40 	["de"] = "Höre deinem Ausbilder zu und befolge seine Anweisungen!"
       
    41 }
       
    42 
       
    43 goals[1] = {
       
    44 	["en"] = "Destroy the target to finish this mission!",
       
    45 	["de"] = "Zerstöre das Ziel, um diese Mission abzuschließen!"
       
    46 }
       
    47 
       
    48 goals[2] = {
       
    49 	["en"] = "Excellent! You've passed the Boot Camp!",
       
    50 	["de"] = "Ausgezeichnet! Du hast das Ausbildungslager bestanden!"
       
    51 }
       
    52 
       
    53 local failed = {
       
    54 	["en"] = "You failed! Follow the instructions and shoot the target only!",
       
    55 	["de"] = "Du hast versagt! Befolge die Anweisungen und schieß nur auf das Ziel!"
       
    56 }
       
    57 
       
    58 local drill = {}
       
    59 
       
    60 drill[0] = {
       
    61 	["en"] = "Allright, maggot!",
       
    62 	["de"] = "Also gut, du Made!"
       
    63 }
       
    64 
       
    65 drill[1] = {
       
    66 	["en"] = "Show that you aren't that useless.",
       
    67 	["de"] = "Zeig, dass du nicht so nutzlos bist."
       
    68 }
       
    69 
       
    70 drill[2] = {
       
    71 	["en"] = "Use [left] to move to the left!",
       
    72 	["de"] = "Benutze [Links], um nach links zu gehen!"
       
    73 }
       
    74 
       
    75 drill[3] = {
       
    76 	["en"] = "Good! Now use [right] to come back!",
       
    77 	["de"] = "Gut! Nun komm mit [Rechts] zurück!"
       
    78 }
       
    79 
       
    80 drill[4] = {
       
    81 	["en"] = "Excellent!",
       
    82 	["de"] = "Ausgezeichnet!"
       
    83 }
       
    84 
       
    85 drill[5] = {
       
    86 	["en"] = "Now jump to the left using [return]!",
       
    87 	["de"] = "Jetzt springe mit [Eingabetaste] nach links!"
       
    88 }
       
    89 
       
    90 drill[6] = {
       
    91 	["en"] = "Use [up] and [down] to aim.",
       
    92 	["de"] = "Benutze [Hoch] und [Runter], um zu zielen."
       
    93 }
       
    94 
       
    95 drill[7] = {
       
    96 	["en"] = "Hold [space] to power up your shot and then release it to shoot.",
       
    97 	["de"] = "Halte [Leertaste], um deinen Schuss aufzuladen, und lasse dann rechtzeitig los."
       
    98 }
       
    99 
       
   100 drill[8] = {
       
   101 	["en"] = "Destroy the target to finish your basic training!",
       
   102 	["de"] = "Zerstöre das Ziel, um deine Grundausbildung abzuschließen!"
       
   103 }
       
   104 
       
   105 local function loc(text)
       
   106 	if text == nil then return "**missing**"
       
   107 	elseif text[L] == nil then return text["en"]
       
   108 	else return text[L]
       
   109 	end
       
   110 end
       
   111 
       
   112 local player = nil
       
   113 local instructor = nil
       
   114 local target = nil
       
   115 
       
   116 function onGameStart()
       
   117 
       
   118 end
       
   119 
       
   120 local player_start_x = 2300
       
   121 local player_start_y = 1250
       
   122 local target_x = 1900
       
   123 local target_y = 1250
       
   124 local player_health = 100
       
   125 local instructor_health = 100
       
   126 local teamcolor = 14483456
       
   127 
       
   128 local progress = 0
       
   129 local time_start = 0
       
   130 
       
   131 function onGameTick()
       
   132 	if progress == -1 and (time_start + 2500) == GameTime then
       
   133 		EndGame()
       
   134 	elseif progress == -1 then
       
   135 		
       
   136 	elseif progress > 0 and ((TurnTimeLeft == 0) or (GetHealth(player) ~= player_health) or (GetHealth(instructor) ~= instructor_health)) then
       
   137 		progress = -1
       
   138 		ShowMission(loc(caption), loc(subcaption), loc(failed), -amBazooka, 0);
       
   139 		time_start = GameTime
       
   140 		PlaySound(sndNooo)
       
   141 		TurnTimeLeft = 0
       
   142 	elseif GameTime == 0 then
       
   143 		ShowMission(loc(caption), loc(subcaption), loc(goals[0]), -amBazooka, 0);
       
   144 		TurnTimeLeft = 60000
       
   145 	elseif GameTime == 2500 then
       
   146 		FollowGear(instructor)
       
   147 		HogSay(instructor, loc(drill[0]), SAY_SAY)
       
   148 	elseif GameTime == 5000 then
       
   149 		FollowGear(instructor)
       
   150 		HogSay(instructor, loc(drill[1]), SAY_SAY)
       
   151 	elseif GameTime == 7500 then
       
   152 		FollowGear(instructor)
       
   153 		HogSay(instructor, loc(drill[2]), SAY_SHOUT)
       
   154 		progress = 1
       
   155 		TurnTimeLeft = 10000
       
   156 	elseif progress == 1 then
       
   157 		local x, y = GetGearPosition(player);
       
   158 		if x < player_start_x - 50 then
       
   159 			progress = 2
       
   160 			FollowGear(instructor)
       
   161 			HogSay(instructor, loc(drill[3]), SAY_SHOUT)
       
   162 		end
       
   163 		TurnTimeLeft = 10000
       
   164 	elseif progress == 2 then
       
   165 		local x, y = GetGearPosition(player);
       
   166 		if x > player_start_x then
       
   167 			progress = 3
       
   168 			FollowGear(instructor)
       
   169 			HogSay(instructor, loc(drill[4]), SAY_SAY)
       
   170 			time_start = GameTime
       
   171 		end
       
   172 	elseif progress == 3 and (time_start + 2500 == GameTime) then
       
   173 		progress = 4
       
   174 		FollowGear(instructor)
       
   175 		HogSay(instructor, loc(drill[5]), SAY_SHOUT)
       
   176 		HogTurnLeft(player, true)
       
   177 		TurnTimeLeft = 10000
       
   178 	elseif progress == 4 then
       
   179 		local x, y = GetGearPosition(player);
       
   180 		if y < player_start_y then
       
   181 			progress = 5
       
   182 			FollowGear(instructor)
       
   183 			HogSay(instructor, "Yeah!", SAY_SAY)
       
   184 			time_start = GameTime
       
   185 			TurnTimeLeft = 30000
       
   186 		end
       
   187 	elseif progress == 5 and (time_start + 2500 == GameTime) then
       
   188 		FollowGear(instructor)
       
   189 		HogSay(instructor, loc(drill[6]), SAY_SAY)
       
   190 	elseif progress == 5 and (time_start + 5000 == GameTime) then
       
   191 		FollowGear(instructor)
       
   192 		HogSay(instructor, loc(drill[7]), SAY_SAY)
       
   193 	elseif progress == 5 and (time_start + 7500 == GameTime) then
       
   194 		FollowGear(instructor)
       
   195 		HogSay(instructor, loc(drill[8]), SAY_SHOUT)
       
   196 		ShowMission(loc(caption), loc(subcaption), loc(goals[1]), 1, 0);
       
   197 		target = AddGear(target_x, target_y, gtTarget, 0, 0, 0, 0)
       
   198 		TurnTimeLeft = 60000
       
   199 	elseif progress == 5 and (time_start + 10000 == GameTime) then
       
   200 		FollowGear(target)
       
   201 	elseif progress == 6 then
       
   202 		progress = 7
       
   203 		ShowMission(loc(caption), loc(subcaption), loc(goals[2]), 0, 0);
       
   204 		PlaySound(sndVictory);
       
   205 		time_start = GameTime
       
   206 	elseif progress == 7 and (time_start + 2500 == GameTime) then
       
   207 		EndGame()
       
   208 	end
       
   209 end
       
   210 
       
   211 function onGameInit()
       
   212 	Seed = 0
       
   213 	GameFlags = gfMultiWeapon + gfOneClanMode
       
   214 	TurnTime = 25000
       
   215 	CaseFreq = 0
       
   216 	LandAdds = 0
       
   217 	Explosives = 0
       
   218 	Delay = 2500
       
   219 	Map = "Mushrooms"
       
   220 	Theme = "Nature"
       
   221 	
       
   222 	AddTeam(loc(teamnames[0]), teamcolor, "Simple", "Island", "Default")
       
   223 	player = AddHog(loc(hognames[0]), 0, player_health, "NoHat")
       
   224 	SetGearPosition(player, player_start_x, player_start_y);
       
   225 	
       
   226 	AddTeam(loc(teamnames[1]), teamcolor + 1, "Simple", "Island", "Default")
       
   227 	instructor = AddHog(loc(hognames[1]), 0, instructor_health, "NoHat")
       
   228 	SetGearPosition(instructor, player_start_x + 100, player_start_y)
       
   229 	HogTurnLeft(instructor, true)
       
   230 
       
   231 	FollowGear(player);
       
   232 end
       
   233 
       
   234 function onAmmoStoreInit()
       
   235 	SetAmmo(amBazooka, 9, 0, 0, 0)
       
   236 end
       
   237 
       
   238 function onGearDelete(gear)
       
   239 	if GetGearType(gear) == gtTarget then
       
   240 		progress = 6
       
   241 	end
       
   242 end