share/hedgewars/Data/Missions/Training/User_Mission_-_That_Sinking_Feeling.lua
changeset 5823 f906f6645e02
parent 5278 1aadb3312828
child 8043 da083f8d95e6
equal deleted inserted replaced
5822:2af237f1fd54 5823:f906f6645e02
     8 local GameOver = false
     8 local GameOver = false
     9 local introStage = 0
     9 local introStage = 0
    10 local genCounter = 0
    10 local genCounter = 0
    11 local waterCounter = 0
    11 local waterCounter = 0
    12 local waterPix = 0
    12 local waterPix = 0
       
    13 local frig = 0
       
    14 local watGear = nil
    13 
    15 
    14 -- allow skipping of the intro via hitting precise key
    16 -- allow skipping of the intro via hitting precise key
    15 function onPrecise()
    17 function onPrecise()
    16 	if introStage < 100 then
    18 	if introStage < 100 then
    17 		introStage = 110
    19 		introStage = 110
    32 	MinesTime  = 3000
    34 	MinesTime  = 3000
    33 	Explosives = 0
    35 	Explosives = 0
    34 	Delay = 10
    36 	Delay = 10
    35 	Map = "Islands"
    37 	Map = "Islands"
    36 	Theme = "City"
    38 	Theme = "City"
       
    39 	SuddenDeathTurns = 1
    37 
    40 
    38 	AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default")
    41 	AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default")
    39 	player = AddHog(loc("The Nameless One"), 0, 1, "NoHat")
    42 	player = AddHog(loc("The Nameless One"), 0, 1, "NoHat")
    40 
    43 
    41 	AddTeam(loc("Hapless Hogs"), 	1175851, "Simple", "Island", "Default")
    44 	AddTeam(loc("Hapless Hogs"), 	1175851, "Simple", "Island", "Default")
    42 	hh[0] = AddHog(loc("Sinky"), 1, 100, "lemon")
    45 	hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon")
    43 	hh[1] = AddHog(loc("Drowner"), 1, 100, "orange")
    46 	hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange")
    44 	hh[2] = AddHog(loc("Heavy"), 1, 100, "Teapot")
    47 	hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot")
    45 	hh[3] = AddHog(loc("Clumsy"), 1, 100, "SauceBoatSilver")
    48 	hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver")
    46 	hh[4] = AddHog(loc("Silly"), 1, 100, "Ladle")
    49 	hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle")
    47 	hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes")
    50 	hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes")
    48 	hh[6] = AddHog(loc("Sponge"), 1, 100, "Chunli")
    51 	hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli")
    49 	hh[7] = AddHog(loc("Deadweight"), 1, 100, "Teacup")
    52 	hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup")
    50 
    53 
    51 	SetGearPosition(player, 3992, 733)
    54 	SetGearPosition(player, 3992, 733)
    52 	SetGearPosition(hh[0], 938, 1369)
    55 	SetGearPosition(hh[0], 938, 1369)
    53 	SetGearPosition(hh[1], 1301, 1439)
    56 	SetGearPosition(hh[1], 1301, 1439)
    54 	SetGearPosition(hh[2], 2093, 447)
    57 	SetGearPosition(hh[2], 2093, 447)
    81 function onGameTick()
    84 function onGameTick()
    82 
    85 
    83 	-- intro sequence
    86 	-- intro sequence
    84 	if introStage < 100 then
    87 	if introStage < 100 then
    85 
    88 
    86 		AddCaption(loc("Press [Precise] to skip intro"))
    89 		frig = frig + 1
    87 
    90 		if frig == 50 then
       
    91 			frig = 0			
       
    92 			AddCaption(loc("Press [Precise] to skip intro"))
       
    93 			if watGear ~= nil then			
       
    94 				FollowGear(watGear)
       
    95 			end
       
    96 		end
       
    97 
       
    98 		
       
    99 		--AddCaption(loc("Press [Precise] to skip intro"))
    88 		genCounter = genCounter + 1
   100 		genCounter = genCounter + 1
    89 
   101 
    90 		if introStage == 0 then
   102 		if introStage == 0 then
    91 
   103 
    92 			FollowGear(hh[0])
   104 						
    93 
   105 			--FollowGear(hh[0])
    94 			if genCounter == 2000 then
   106 
       
   107 			if genCounter == 2000 then
       
   108 				watGear = hh[0]
    95 				HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2)
   109 				HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2)
    96 			elseif genCounter == 5000 then
   110 			elseif genCounter == 5000 then
    97 				introStage = 1
   111 				introStage = 1
    98 				genCounter = 0
   112 				genCounter = 0
    99 			end
   113 			end
   100 
   114 
   101 		elseif introStage == 1 then
   115 		elseif introStage == 1 then
   102 
   116 						
   103 			FollowGear(hh[1])
   117 			--FollowGear(hh[1])
   104 
   118 
   105 			if genCounter == 2000 then
   119 			if genCounter == 2000 then
       
   120 				watGear = hh[1]
   106 				HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2)
   121 				HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2)
   107 			elseif genCounter == 5000 then
   122 			elseif genCounter == 5000 then
   108 				introStage = 2
   123 				introStage = 2
   109 				genCounter = 0
   124 				genCounter = 0
   110 			end
   125 			end
   111 
   126 
   112 		elseif introStage == 2 then
   127 		elseif introStage == 2 then
   113 
   128 
   114 			FollowGear(hh[0])
   129 			--FollowGear(hh[0])
   115 
   130 
   116 			if genCounter == 2000 then
   131 			if genCounter == 2000 then
       
   132 				watGear = hh[0]
   117 				HogSay(hh[0], loc("You'd almost swear the water was rising!"), SAY_SHOUT,2)
   133 				HogSay(hh[0], loc("You'd almost swear the water was rising!"), SAY_SHOUT,2)
   118 			elseif genCounter == 6000 then
   134 			elseif genCounter == 6000 then
   119 				introStage = 3
   135 				introStage = 3
   120 				genCounter = 0
   136 				genCounter = 0
   121 			end
   137 			end
   122 
   138 
   123 		elseif introStage == 3 then
   139 		elseif introStage == 3 then
   124 
   140 
   125 			FollowGear(hh[1])
   141 			--FollowGear(hh[1])
   126 
   142 
   127 			if genCounter == 2000 then
   143 			if genCounter == 2000 then
       
   144 				watGear = hh[1]
   128 				HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2)
   145 				HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2)
   129 			elseif genCounter == 6000 then
   146 			elseif genCounter == 6000 then
   130 				introStage = 4
   147 				introStage = 4
   131 				genCounter = 0
   148 				genCounter = 0
   132 			end
   149 			end
   133 
   150 
   134 		elseif introStage == 4 then
   151 		elseif introStage == 4 then
   135 
   152 
   136 			FollowGear(hh[0])
   153 			--FollowGear(hh[0])
   137 
   154 
   138 			if genCounter == 2000 then
   155 			if genCounter == 2000 then
       
   156 				watGear = hh[0]
   139 				HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2)
   157 				HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2)
   140 				HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2)
   158 				HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2)
   141 			elseif genCounter == 3000 then
   159 			elseif genCounter == 3000 then
   142 				introStage = 5
   160 				introStage = 5
   143 				genCounter = 0
   161 				genCounter = 0
   144 			end
   162 			end
   145 
   163 
   146 		elseif introStage == 5 then
   164 		elseif introStage == 5 then
   147 
   165 
   148 			FollowGear(hh[1])
   166 			--FollowGear(hh[1])
   149 
   167 
   150 			if genCounter == 2000 then
   168 			if genCounter == 2000 then
       
   169 				watGear = hh[1]
   151 				HogSay(hh[0], loc("..."), SAY_THINK,2)
   170 				HogSay(hh[0], loc("..."), SAY_THINK,2)
   152 				HogSay(hh[1], loc("..."), SAY_THINK,2)
   171 				HogSay(hh[1], loc("..."), SAY_THINK,2)
   153 			elseif genCounter == 5000 then
   172 			elseif genCounter == 5000 then
   154 				introStage = 6
   173 				introStage = 6
   155 				genCounter = 0
   174 				genCounter = 0
   156 			end
   175 			end
   157 
   176 
   158 		elseif introStage == 6 then
   177 		elseif introStage == 6 then
   159 
   178 
   160 			FollowGear(hh[0])
   179 			--FollowGear(hh[0])
   161 
   180 
   162 			if genCounter == 2000 then
   181 			if genCounter == 2000 then
       
   182 				watGear = hh[0]
   163 				HogSay(hh[0], loc("It's a good thing SUDDEN DEATH is 99 turns away..."), SAY_THINK,2)
   183 				HogSay(hh[0], loc("It's a good thing SUDDEN DEATH is 99 turns away..."), SAY_THINK,2)
   164 			elseif genCounter == 6000 then
   184 			elseif genCounter == 6000 then
   165 				introStage = 7
   185 				introStage = 7
   166 				genCounter = 0
   186 				genCounter = 0
   167 			end
   187 			end
   192 			if (waterPix >= 1615) and (GameOver == false) then
   212 			if (waterPix >= 1615) and (GameOver == false) then
   193 				GameOver = true
   213 				GameOver = true
   194 				SetHealth(player, 0)
   214 				SetHealth(player, 0)
   195 				TurnTimeLeft = 1
   215 				TurnTimeLeft = 1
   196 				ShowMission(loc("That Sinking Feeling"), loc("MISSION SUCCESS"), loc("You saved") .. " " .. hhCount .. " " .. loc("Hapless Hogs") .."!", 0, 0)
   216 				ShowMission(loc("That Sinking Feeling"), loc("MISSION SUCCESS"), loc("You saved") .. " " .. hhCount .. " " .. loc("Hapless Hogs") .."!", 0, 0)
       
   217 
       
   218 				if hhCount == 8 then
       
   219 					AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Lively Lifeguard"),0xffba00ff,capgrpMessage2)
       
   220 				end
       
   221 
   197 			end
   222 			end
   198 
   223 
   199 		end
   224 		end
   200 
   225 
   201 	end
   226 	end