share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
changeset 9757 9be28be004d4
parent 9733 37f84780eb14
child 9765 6cad4393a315
equal deleted inserted replaced
9756:736abcc1915f 9757:9be28be004d4
   101 	TurnTime = 25000
   101 	TurnTime = 25000
   102 	CaseFreq = 0
   102 	CaseFreq = 0
   103 	MinesNum = 0
   103 	MinesNum = 0
   104 	MinesTime = 3000
   104 	MinesTime = 3000
   105 	Explosives = 0
   105 	Explosives = 0
   106 	Delay = 5 
   106 	Delay = 5
   107 	Map = "moon01_map"
   107 	Map = "moon01_map"
   108 	Theme = "Cheese" -- Because ofc moon is made of cheese :)
   108 	Theme = "Cheese" -- Because ofc moon is made of cheese :)
   109 	-- Hog Solo
   109 	-- Hog Solo
   110 	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy")
   110 	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy")
   111 	if tonumber(GetCampaignVar("HeroHealth")) then
   111 	if tonumber(GetCampaignVar("HeroHealth")) then
   142 	AnimSetGearPosition(minion2.gear, minion2.x, minion2.y)
   142 	AnimSetGearPosition(minion2.gear, minion2.x, minion2.y)
   143 	HogTurnLeft(minion2.gear, true)
   143 	HogTurnLeft(minion2.gear, true)
   144 	minion3.gear = AddHog(minion3.name, 1, 50, "Gasmask")
   144 	minion3.gear = AddHog(minion3.name, 1, 50, "Gasmask")
   145 	AnimSetGearPosition(minion3.gear, minion3.x, minion3.y)
   145 	AnimSetGearPosition(minion3.gear, minion3.x, minion3.y)
   146 	HogTurnLeft(minion3.gear, true)
   146 	HogTurnLeft(minion3.gear, true)
   147 	
   147 
   148 	-- get the check point
   148 	-- get the check point
   149 	checkPointReached = initCheckpoint("moon01")
   149 	checkPointReached = initCheckpoint("moon01")
   150 	if checkPointReached == 1 then
   150 	if checkPointReached == 1 then
   151 		-- Start of the game
   151 		-- Start of the game
   152 	elseif checkPointReached == 2 then
   152 	elseif checkPointReached == 2 then
   153 		AnimSetGearPosition(hero.gear, parachuteX, weaponsY)
   153 		AnimSetGearPosition(hero.gear, parachuteX, weaponsY)
   154 		if GetHealth(hero.gear) + 5 > 100 then			
   154 		if GetHealth(hero.gear) + 5 > 100 then
   155 			SaveCampaignVar("HeroHealth", 100)
   155 			SaveCampaignVar("HeroHealth", 100)
   156 		else
   156 		else
   157 			SaveCampaignVar("HeroHealth", GetHealth(hero.gear) + 5)
   157 			SaveCampaignVar("HeroHealth", GetHealth(hero.gear) + 5)
   158 		end
   158 		end
   159 	end
   159 	end
   160 	
   160 
   161 	AnimInit()
   161 	AnimInit()
   162 	AnimationSetup()	
   162 	AnimationSetup()
   163 end
   163 end
   164 
   164 
   165 function onGameStart()
   165 function onGameStart()
   166 	-- wait for the first turn to start
   166 	-- wait for the first turn to start
   167 	AnimWait(hero.gear, 3000)
   167 	AnimWait(hero.gear, 3000)
   168 	FollowGear(hero.gear)
   168 	FollowGear(hero.gear)
   169 	
   169 
   170 	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
   170 	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
   171 	"|"..loc("Rescue the imprisoned PAotH team and get your fuels!"), -amSkip, 0)
   171 	"|"..loc("Rescue the imprisoned PAotH team and get the fuel!"), -amSkip, 0)
   172 	
   172 
   173 	AddAmmo(minion1.gear, amDEagle, 10)
   173 	AddAmmo(minion1.gear, amDEagle, 10)
   174 	AddAmmo(minion2.gear, amDEagle, 10)
   174 	AddAmmo(minion2.gear, amDEagle, 10)
   175 	AddAmmo(minion3.gear, amDEagle, 10)
   175 	AddAmmo(minion3.gear, amDEagle, 10)
   176 	AddAmmo(minion1.gear, amBazooka, 2)
   176 	AddAmmo(minion1.gear, amBazooka, 2)
   177 	AddAmmo(minion2.gear, amBazooka, 2)
   177 	AddAmmo(minion2.gear, amBazooka, 2)
   178 	AddAmmo(minion3.gear, amBazooka, 2)
   178 	AddAmmo(minion3.gear, amBazooka, 2)
   179 	AddAmmo(minion1.gear, amGrenade, 2)
   179 	AddAmmo(minion1.gear, amGrenade, 2)
   180 	AddAmmo(minion2.gear, amGrenade, 2)
   180 	AddAmmo(minion2.gear, amGrenade, 2)
   181 	AddAmmo(minion3.gear, amGrenade, 2)
   181 	AddAmmo(minion3.gear, amGrenade, 2)
   182 	
   182 
   183 	-- check for death has to go first
   183 	-- check for death has to go first
   184 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   184 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   185 	AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
   185 	AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
   186 	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
   186 	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
   187 	AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
   187 	AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
   193 		SpawnAmmoCrate(grenadeX, weaponsY, amGrenade)
   193 		SpawnAmmoCrate(grenadeX, weaponsY, amGrenade)
   194 		SpawnAmmoCrate(deserteagleX, weaponsY, amDEagle)
   194 		SpawnAmmoCrate(deserteagleX, weaponsY, amDEagle)
   195 		AddEvent(onWeaponsPlatform, {hero.gear}, weaponsPlatform, {hero.gear}, 0)
   195 		AddEvent(onWeaponsPlatform, {hero.gear}, weaponsPlatform, {hero.gear}, 0)
   196 		TurnTimeLeft = 0
   196 		TurnTimeLeft = 0
   197 		AddAnim(dialog01)
   197 		AddAnim(dialog01)
   198 	elseif checkPointReached == 2 then	
   198 	elseif checkPointReached == 2 then
   199 		AddAmmo(hero.gear, amBazooka, 3)
   199 		AddAmmo(hero.gear, amBazooka, 3)
   200 		AddAmmo(hero.gear, amParachute, 1)
   200 		AddAmmo(hero.gear, amParachute, 1)
   201 		AddAmmo(hero.gear, amGrenade, 6)
   201 		AddAmmo(hero.gear, amGrenade, 6)
   202 		AddAmmo(hero.gear, amDEagle, 4)
   202 		AddAmmo(hero.gear, amDEagle, 4)
   203 		SetWind(60)		
   203 		SetWind(60)
   204 		GameFlags = bor(GameFlags,gfDisableWind)
   204 		GameFlags = bor(GameFlags,gfDisableWind)
   205 		weaponsAcquired = true
   205 		weaponsAcquired = true
   206 		afterDialog02 = true
   206 		afterDialog02 = true
   207 		TurnTimeLeft = 0
   207 		TurnTimeLeft = 0
   208 		AddAnim(dialog02)
   208 		AddAnim(dialog02)
   209 	end
   209 	end
   210 	-- this event check goes here to be executed after the onWeaponsPlatform check
   210 	-- this event check goes here to be executed after the onWeaponsPlatform check
   211 	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
   211 	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
   212 	
   212 
   213 	SendHealthStatsOff()
   213 	SendHealthStatsOff()
   214 end
   214 end
   215 
   215 
   216 function onAmmoStoreInit()
   216 function onAmmoStoreInit()
   217 	SetAmmo(amBazooka, 0, 0, 0, 3)
   217 	SetAmmo(amBazooka, 0, 0, 0, 3)
   230 	if CurrentHedgehog ~= hero.gear and not battleZone then
   230 	if CurrentHedgehog ~= hero.gear and not battleZone then
   231 		TurnTimeLeft = 0
   231 		TurnTimeLeft = 0
   232 	end
   232 	end
   233 end
   233 end
   234 
   234 
   235 function onNewTurn()		
   235 function onNewTurn()
   236 	-- rounds start if hero got his weapons or got near the enemies
   236 	-- rounds start if hero got his weapons or got near the enemies
   237 	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   237 	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   238 		TurnTimeLeft = 0
   238 		TurnTimeLeft = 0
   239 	elseif weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear and afterDialog02 then
   239 	elseif weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear and afterDialog02 then
   240 		battleZone(hero.gear)
   240 		battleZone(hero.gear)
   249 	end
   249 	end
   250 end
   250 end
   251 
   251 
   252 function onPrecise()
   252 function onPrecise()
   253 	if GameTime > 3000 then
   253 	if GameTime > 3000 then
   254 		SetAnimSkip(true)   
   254 		SetAnimSkip(true)
   255 	end
   255 	end
   256 end
   256 end
   257 
   257 
   258 function onGearDelete(gear)
   258 function onGearDelete(gear)
   259 	if gear == hero.gear then
   259 	if gear == hero.gear then
   264 end
   264 end
   265 
   265 
   266 -------------- EVENTS ------------------
   266 -------------- EVENTS ------------------
   267 
   267 
   268 function onWeaponsPlatform(gear)
   268 function onWeaponsPlatform(gear)
   269 	if not hero.dead and (GetAmmoCount(hero.gear, amBazooka) > 0 or GetAmmoCount(hero.gear, amParachute) > 0 or 
   269 	if not hero.dead and (GetAmmoCount(hero.gear, amBazooka) > 0 or GetAmmoCount(hero.gear, amParachute) > 0 or
   270 			GetAmmoCount(hero.gear, amGrenade) > 0 or GetAmmoCount(hero.gear, amDEagle) > 0) and StoppedGear(hero.gear) then
   270 			GetAmmoCount(hero.gear, amGrenade) > 0 or GetAmmoCount(hero.gear, amDEagle) > 0) and StoppedGear(hero.gear) then
   271 		return true
   271 		return true
   272 	end
   272 	end
   273 	return false
   273 	return false
   274 end
   274 end
   318 function weaponsPlatform(gear)
   318 function weaponsPlatform(gear)
   319 	saveCheckpoint("2")
   319 	saveCheckpoint("2")
   320 	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
   320 	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
   321 	TurnTimeLeft = 0
   321 	TurnTimeLeft = 0
   322 	weaponsAcquired = true
   322 	weaponsAcquired = true
   323 	SetWind(60)		
   323 	SetWind(60)
   324 	GameFlags = bor(GameFlags,gfDisableWind)
   324 	GameFlags = bor(GameFlags,gfDisableWind)
   325 	AddAmmo(hero.gear, amRope, 0)
   325 	AddAmmo(hero.gear, amRope, 0)
   326 	if GetX(hero.gear) < 1900 then
   326 	if GetX(hero.gear) < 1900 then
   327 		AddAnim(dialog02)
   327 		AddAnim(dialog02)
   328 	end
   328 	end
   360 	elseif GetHealth(minion3.gear) then
   360 	elseif GetHealth(minion3.gear) then
   361 		AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
   361 		AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
   362 	end
   362 	end
   363 	ParseCommand("teamgone " .. teamB.name)
   363 	ParseCommand("teamgone " .. teamB.name)
   364 	AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000)
   364 	AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000)
   365 	AnimWait(hero.gear,5000)	
   365 	AnimWait(hero.gear,5000)
   366 	
   366 
   367 	saveCompletedStatus(1)
   367 	saveCompletedStatus(1)
   368 	SendStat(siGameResult, loc("Hog Solo win, conrgatulations!"))
   368 	SendStat(siGameResult, loc("Hog Solo wins, conrgatulations!"))
   369 	SendStat(siCustomAchievement, loc("Eliminated the professor Hogevil"))
   369 	SendStat(siCustomAchievement, loc("Eliminated the Professor Hogevil"))
   370 	SendStat(siCustomAchievement, loc("Drove the minions away"))
   370 	SendStat(siCustomAchievement, loc("Drove the minions away"))
   371 	SendStat(siPlayerKills,'1',teamD.name)
   371 	SendStat(siPlayerKills,'1',teamD.name)
   372 	SendStat(siPlayerKills,'0',teamC.name)
   372 	SendStat(siPlayerKills,'0',teamC.name)
   373 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
   373 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
   374 	EndGame()
   374 	EndGame()
   375 end
   375 end
   376 
   376 
   377 function minionsDeath(gear)
   377 function minionsDeath(gear)
   378 	-- do staffs here
   378 	-- do staffs here
   379 	AnimSay(professor.gear, loc("I may lost that battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
   379 	AnimSay(professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
   380 	ParseCommand("teamgone " .. teamC.name)
   380 	ParseCommand("teamgone " .. teamC.name)
   381 	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
   381 	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
   382 	AnimWait(hero.gear,5000)	
   382 	AnimWait(hero.gear,5000)
   383 	
   383 
   384 	saveCompletedStatus(1)
   384 	saveCompletedStatus(1)
   385 	SendStat(siGameResult, loc("Congratulations, you won!"))
   385 	SendStat(siGameResult, loc("Congratulations, you won!"))
   386 	SendStat(siCustomAchievement, loc("Eliminated the evil minions"))
   386 	SendStat(siCustomAchievement, loc("Eliminated the evil minions"))
   387 	SendStat(siCustomAchievement, loc("Drove the professor away"))
   387 	SendStat(siCustomAchievement, loc("Drove the Professor away"))
   388 	SendStat(siPlayerKills,'1',teamD.name)
   388 	SendStat(siPlayerKills,'1',teamD.name)
   389 	SendStat(siPlayerKills,'0',teamC.name)
   389 	SendStat(siPlayerKills,'0',teamC.name)
   390 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels	
   390 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
   391 	EndGame()
   391 	EndGame()
   392 end
   392 end
   393 
   393 
   394 -------------- ANIMATIONS ------------------
   394 -------------- ANIMATIONS ------------------
   395 
   395 
   409 function AnimationSetup()
   409 function AnimationSetup()
   410 	-- DIALOG 01 - Start, welcome to moon
   410 	-- DIALOG 01 - Start, welcome to moon
   411 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   411 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   412 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   412 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   413 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near PAotH base at moon..."),  4000}})
   413 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near PAotH base at moon..."),  4000}})
   414 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey Hog Solo! Finaly you have come..."), SAY_SAY, 2000}})
   414 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey Hog Solo! Finally you have come..."), SAY_SAY, 2000}})
   415 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil learned for your arrival!"), SAY_SAY, 4000}})
   415 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil has prepared for your arrival!"), SAY_SAY, 4000}})
   416 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Now he have captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
   416 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("He has captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
   417 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
   417 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
   418 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 450}})
   418 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 450}})
   419 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light"), SAY_SAY, 2500}})
   419 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light"), SAY_SAY, 2500}})
   420 	table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 3200}})
   420 	table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 3200}})
   421 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Ok, then you have to go and take some of the waepons we have hidden in case of an emergency!"), SAY_SAY, 7000}})
   421 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Ok, then you have to go and take some of the weapons we have hidden in case of an emergency!"), SAY_SAY, 7000}})
   422 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take that rope and hurry!"), SAY_SAY, 7000}})
   422 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take this rope and hurry!"), SAY_SAY, 7000}})
   423 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm... ok..."), SAY_SAY, 2500}})
   423 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm... ok..."), SAY_SAY, 2500}})
   424 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   424 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   425 	-- DIALOG 02 - To the weapons platform
   425 	-- DIALOG 02 - To the weapons platform
   426 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   426 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   427 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"),  4000}})
   427 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"),  4000}})
   428 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! YEAAAAAH!"), SAY_SHOUT, 4000}})
   428 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! YEAAAAAH!"), SAY_SHOUT, 4000}})
   429 	table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry up and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}})
   429 	table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}})
   430 	table.insert(dialog02, {func = setAfterDialog02, args = {}})
   430 	table.insert(dialog02, {func = setAfterDialog02, args = {}})
   431 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   431 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   432 	-- DIALOG 03 - Hero spotted and has no weapons
   432 	-- DIALOG 03 - Hero spotted and has no weapons
   433 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   433 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   434 	table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
   434 	table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})