share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua
branchspacecampaign
changeset 9632 9dd1c36d8b54
child 9634 8032df67a249
equal deleted inserted replaced
9631:a9b7bfac05ee 9632:9dd1c36d8b54
       
     1 ------------------- ABOUT ----------------------
       
     2 --
       
     3 -- Hero has collected all the anti-gravity device
       
     4 -- parts but because of the size of the meteorite
       
     5 -- he needs to detonate some faulty explosives that
       
     6 -- PAotH have previously placed on it.
       
     7 
       
     8 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
     9 HedgewarsScriptLoad("/Scripts/Animate.lua")
       
    10 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
       
    11 
       
    12 ----------------- VARIABLES --------------------
       
    13 -- globals
       
    14 local missionName = loc("The big bang")
       
    15 local challengeObjectives = loc("Find a way to detonate all the explosives and stay alive!")
       
    16 
       
    17 -- hogs
       
    18 local hero = {
       
    19 	name = loc("Hog Solo"),
       
    20 	x = 790,
       
    21 	y = 70
       
    22 }
       
    23 -- teams
       
    24 local teamA = {
       
    25 	name = loc("Hog Solo"),
       
    26 	color = tonumber("38D61C",16) -- green
       
    27 }
       
    28 
       
    29 -------------- LuaAPI EVENT HANDLERS ------------------
       
    30 
       
    31 function onGameInit()
       
    32 	GameFlags = gfDisableWind + gfOneClanMode
       
    33 	Seed = 1
       
    34 	TurnTime = -1
       
    35 	CaseFreq = 0
       
    36 	MinesNum = 0
       
    37 	MinesTime = 1
       
    38 	Explosives = 0
       
    39 	HealthCaseAmount = 50
       
    40 	Map = "final_map"
       
    41 	Theme = "EarthRise"
       
    42 	
       
    43 	-- Hog Solo
       
    44 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
    45 	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
       
    46 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
       
    47 	
       
    48 	initCheckpoint("final")
       
    49 	
       
    50 	AnimInit()
       
    51 	--AnimationSetup()
       
    52 end
       
    53 
       
    54 function onGameStart()
       
    55 	AnimWait(hero.gear, 3000)
       
    56 	FollowGear(hero.gear)
       
    57 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
       
    58 	
       
    59 	-- explosives
       
    60 	x = 400
       
    61 	while x < 815 do
       
    62 		AddGear(x, 500, gtExplosives, 0, 0, 0, 0)
       
    63 		x = x + math.random(15,40)
       
    64 	end
       
    65 	-- mines
       
    66 	local x = 360
       
    67 	while x < 815 do
       
    68 		AddGear(x, 480, gtMine, 0, 0, 0, 0)
       
    69 		x = x + math.random(5,20)
       
    70 	end
       
    71 	-- health crate	
       
    72 	SpawnHealthCrate(900, 5)
       
    73 	-- ammo crates
       
    74 	SpawnAmmoCrate(930, 1000,amRCPlane)
       
    75 	SpawnAmmoCrate(1220, 672,amPickHammer)
       
    76 	SpawnAmmoCrate(1220, 672,amGirder)
       
    77 	
       
    78 	-- ammo
       
    79 	AddAmmo(hero.gear, amPortalGun, 1)	
       
    80 	AddAmmo(hero.gear, amFirePunch, 1)	
       
    81 	
       
    82 	SendHealthStatsOff()
       
    83 end
       
    84 
       
    85 function onAmmoStoreInit()
       
    86 	SetAmmo(amRCPlane, 0, 0, 0, 1)
       
    87 	SetAmmo(amPickHammer, 0, 0, 0, 2)
       
    88 	SetAmmo(amGirder, 0, 0, 0, 1)
       
    89 end