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