share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
branchspacecampaign
changeset 9320 1845b420cb5d
parent 9318 413dd0eab399
child 9322 18cbaf1436c7
equal deleted inserted replaced
9318:413dd0eab399 9320:1845b420cb5d
    11 -- Fix some glitches when gaining control on animations, on skip I get control of the talking hog
    11 -- Fix some glitches when gaining control on animations, on skip I get control of the talking hog
    12 -- Round time after check point 2
    12 -- Round time after check point 2
    13 -- Check if enemy weapons are good
    13 -- Check if enemy weapons are good
    14 -- Stats
    14 -- Stats
    15 -- check points
    15 -- check points
       
    16 -- add a dialog at the end and second event if all minions are dead
    16 
    17 
    17 HedgewarsScriptLoad("/Scripts/Locale.lua")
    18 HedgewarsScriptLoad("/Scripts/Locale.lua")
    18 HedgewarsScriptLoad("/Scripts/Animate.lua")
    19 HedgewarsScriptLoad("/Scripts/Animate.lua")
    19 
    20 
    20 ----------------- VARIABLES --------------------
    21 ----------------- VARIABLES --------------------
   168 	FollowGear(hero.gear)
   169 	FollowGear(hero.gear)
   169 	
   170 	
   170 	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
   171 	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
   171 	"|"..loc("Rescue the imprisoned PAoTH team and get your fuels!"), -amSkip, 0)
   172 	"|"..loc("Rescue the imprisoned PAoTH team and get your fuels!"), -amSkip, 0)
   172 	
   173 	
   173 	
       
   174 	AddAmmo(minion1.gear, amDEagle, 2)
   174 	AddAmmo(minion1.gear, amDEagle, 2)
   175 	AddAmmo(minion2.gear, amDEagle, 2)
   175 	AddAmmo(minion2.gear, amDEagle, 2)
   176 	AddAmmo(minion3.gear, amDEagle, 2)
   176 	AddAmmo(minion3.gear, amDEagle, 2)
   177 	AddAmmo(minion1.gear, amBazooka, 2)
   177 	AddAmmo(minion1.gear, amBazooka, 2)
   178 	AddAmmo(minion2.gear, amBazooka, 2)
   178 	AddAmmo(minion2.gear, amBazooka, 2)
   215 	SetAmmo(amGrenade, 0, 0, 0, 2)
   215 	SetAmmo(amGrenade, 0, 0, 0, 2)
   216 	SetAmmo(amDEagle, 0, 0, 0, 2)
   216 	SetAmmo(amDEagle, 0, 0, 0, 2)
   217 end
   217 end
   218 
   218 
   219 function onGameTick()
   219 function onGameTick()
   220 	--WriteLnToConsole("ON GAME TICK")
       
   221 	AnimUnWait()
   220 	AnimUnWait()
   222 	if ShowAnimation() == false then
   221 	if ShowAnimation() == false then
   223 		return
   222 		return
   224 	end
   223 	end
   225 	ExecuteAfterAnimations()
   224 	ExecuteAfterAnimations()
   227 	if CurrentHedgehog ~= hero.gear and not battleZone then
   226 	if CurrentHedgehog ~= hero.gear and not battleZone then
   228 		TurnTimeLeft = 0
   227 		TurnTimeLeft = 0
   229 	end
   228 	end
   230 end
   229 end
   231 
   230 
   232 function onNewTurn()
   231 function onNewTurn()		
   233 	WriteLnToConsole("ON NEW TURN")
       
   234 	WriteLnToConsole("HOG IS "..CurrentHedgehog.." minion 1 is "..minion1.gear)
       
   235 	
       
   236 	if weaponsAcquired then
       
   237 		WriteLnToConsole("weapons acq+++")
       
   238 	end
       
   239 	
       
   240 	if battleZoneReached then
       
   241 		WriteLnToConsole("battleZone acq+++")
       
   242 	end
       
   243 		
       
   244 	-- rounds start if hero got his weapons or got near the enemies
   232 	-- rounds start if hero got his weapons or got near the enemies
   245 	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   233 	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   246 		WriteLnToConsole("TURN CASE 1")
       
   247 		TurnTimeLeft = 0
   234 		TurnTimeLeft = 0
   248 	elseif not weaponsAcquired and not battleZoneReached and CurrentHedgehog == hero.gear then
   235 	elseif not weaponsAcquired and not battleZoneReached and CurrentHedgehog == hero.gear then
   249 		WriteLnToConsole("TURN CASE 2")
       
   250 		TurnTimeLeft = -1
   236 		TurnTimeLeft = -1
   251 	elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear
   237 	elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear
   252 		or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then
   238 		or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then
   253 		WriteLnToConsole("TURN CASE 3")
       
   254 		TurnTimeLeft = 0
   239 		TurnTimeLeft = 0
   255 	elseif CurrentHedgehog == professor.gear then
   240 	elseif CurrentHedgehog == professor.gear then
   256 		WriteLnToConsole("TURN CASE 4")
       
   257 		AnimSwitchHog(hero.gear)
   241 		AnimSwitchHog(hero.gear)
   258 		TurnTimeLeft = 0
   242 		TurnTimeLeft = 0
   259 	end
   243 	end
   260 end
   244 end
   261 
   245 
   262 function onPrecise()
   246 function onPrecise()
   263 	WriteLnToConsole("ON PRECISE")
       
   264 	if GameTime > 3000 then
   247 	if GameTime > 3000 then
   265 		SetAnimSkip(true)   
   248 		SetAnimSkip(true)   
   266 	end
   249 	end
   267 end
   250 end
   268 
   251 
   269 function onGearDelete(gear)
   252 function onGearDelete(gear)
   270 	if gear == hero.gear then
   253 	if gear == hero.gear then
   271 		hero.dead = true
   254 		hero.dead = true
   272 	elseif gear == professor.dead then
   255 	elseif gear == professor.gear then
   273 		professor.dead = true
   256 		professor.dead = true
   274 	end
   257 	end
   275 end
   258 end
   276 
   259 
   277 -------------- EVENTS ------------------
   260 -------------- EVENTS ------------------
   291 	return false
   274 	return false
   292 end
   275 end
   293 
   276 
   294 function onBattleZone(gear)
   277 function onBattleZone(gear)
   295 	if not hero.dead and GetX(gear) > 1900 and StoppedGear(gear) then
   278 	if not hero.dead and GetX(gear) > 1900 and StoppedGear(gear) then
   296 		WriteLnToConsole("ON BATTLE ZONE!!!")
       
   297 		return true
   279 		return true
   298 	end
   280 	end
   299 	return false
   281 	return false
   300 end
   282 end
   301 
   283 
   302 function onProfessorHit(gear)
   284 function onProfessorHit(gear)
   303 	-- TODO NOT TALK ON HERO'S TURN...
   285 	if GetHealth(gear) then
   304 	if not professor.dead and GetHealth(gear) < professor.health and CurrentHedgehog ~= hero.gear then
   286 		if CurrentHedgehog ~= hero.gear and GetHealth(gear) < professor.health then
   305 		professor.health = GetHealth(gear)
   287 			professor.health = GetHealth(gear)
   306 		return true
   288 			return true
       
   289 		elseif GetHealth(gear) < professor.health then
       
   290 			professor.health = GetHealth(gear)
       
   291 		end
   307 	end
   292 	end
   308 	return false
   293 	return false
   309 end
   294 end
   310 
   295 
   311 function onProfessorDeath(gear)
   296 function onProfessorDeath(gear)
   359 		ShowMission(unpack(goals[anim]))
   344 		ShowMission(unpack(goals[anim]))
   360     end
   345     end
   361     if anim == dialog03 then
   346     if anim == dialog03 then
   362 		startCombat()
   347 		startCombat()
   363 	else
   348 	else
   364 		--TODO check if this is ok
       
   365 		AnimSwitchHog(hero.gear)
   349 		AnimSwitchHog(hero.gear)
   366 	end
   350 	end
   367 end
   351 end
   368 
   352 
   369 function AnimationSetup()
   353 function AnimationSetup()