share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua
author sheepluva
Sun, 08 Dec 2013 12:19:30 +0100
changeset 9765 6cad4393a315
parent 9758 3b8058b251b8
child 11697 68eddcdc9f26
permissions -rw-r--r--
string/typo fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- Hero has to use the rc plane end perform some
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- flying tasks
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
HedgewarsScriptLoad("/Scripts/Locale.lua")
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
HedgewarsScriptLoad("/Scripts/Animate.lua")
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     8
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
-- globals
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
local missionName = loc("Precise flying")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    12
local challengeObjectives = loc("Use the RC plane and destroy the all the targets").."|"..
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    13
	loc("Each time you destroy all the targets on your current level you'll get teleported to the next level").."|"..
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    14
	loc("You'll have only one RC plane at the start of the mission").."|"..
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    15
	loc("During the game you can get new RC planes by collecting the weapon crates")
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    16
local currentTarget = 1
9608
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    17
-- dialogs
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    18
local dialog01 = {}
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    19
-- mission objectives
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    20
local goals = {
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    21
	[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500},
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    22
}
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    23
-- hogs
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
local hero = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    25
	name = loc("Hog Solo"),
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
	x = 100,
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
	y = 170
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
-- teams
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
local teamA = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
	name = loc("Hog Solo"),
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
	color = tonumber("38D61C",16) -- green
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
-- creates & targets
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
local rcCrates = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
	{ x = 1680, y = 240},
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
	{ x = 2810, y = 720},
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    38
	{ x = 2440, y = 660},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    39
	{ x = 256, y = 1090},
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
local targets = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
	{ x = 2070, y = 410},
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
	{ x = 3880, y = 1430},
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    44
	{ x = 4000, y = 1430},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    45
	{ x = 2190, y = 1160},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    46
	{ x = 2190, y = 1460},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    47
	{ x = 2110, y = 1700},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    48
	{ x = 2260, y = 1700},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    49
	{ x = 2085, y = 1330},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    50
	{ x = 156, y = 1400},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    51
	{ x = 324, y = 1400},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    52
	{ x = 660, y = 1310},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    53
	{ x = 1200, y = 1310},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    54
	{ x = 1700, y = 1310},
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
-------------- LuaAPI EVENT HANDLERS ------------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
function onGameInit()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	GameFlags = gfOneClanMode
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
	Seed = 1
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
	TurnTime = -1
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
	CaseFreq = 0
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	MinesNum = 0
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	MinesTime = 1
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
	Explosives = 0
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
	Map = "desert03_map"
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	Theme = "Desert"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    69
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	-- Hog Solo
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    72
	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    74
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
	initCheckpoint("desert03")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    76
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
	AnimInit()
9608
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    78
	AnimationSetup()
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
function onGameStart()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	AnimWait(hero.gear, 3000)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	FollowGear(hero.gear)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    87
	AddEvent(onLose, {hero.gear}, lose, {hero.gear}, 0)
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	-- original crates and targets
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	SpawnAmmoCrate(rcCrates[1].x, rcCrates[1].y, amRCPlane)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
	targets[1].gear = AddGear(targets[1].x, targets[1].y, gtTarget, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    92
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	-- hero ammo
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	AddAmmo(hero.gear, amRCPlane, 1)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	SendHealthStatsOff()
9608
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
    97
	AddAnim(dialog01)
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   100
function onGameTick()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   101
	AnimUnWait()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   102
	if ShowAnimation() == false then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   103
		return
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   104
	end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   105
	ExecuteAfterAnimations()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   106
	CheckEvents()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   107
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   108
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
function onGameTick20()
9610
fabff82cf0b8 win stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9608
diff changeset
   110
	checkTargetsDestroyed()
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
function onAmmoStoreInit()
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   114
	SetAmmo(amNothing, 0, 0, 0, 0)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   115
	SetAmmo(amRCPlane, 0, 0, 0, 1)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   116
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   117
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   118
function onPrecise()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   119
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   120
		SetAnimSkip(true)
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   121
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   122
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   123
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
-------------- EVENTS ------------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   125
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
function onHeroDeath(gear)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
	if not GetHealth(hero.gear) then
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   128
		return true
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   129
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   130
	return false
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   131
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   132
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   133
function onLose(gear)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   134
	if GetHealth(hero.gear) and currentTarget < 4 and GetAmmoCount(hero.gear, amRCPlane) == 0 then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   135
		return true
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   136
	end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   137
	return false
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   138
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   139
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   140
-------------- ACTIONS ------------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   141
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   142
function heroDeath(gear)
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   143
	gameOver()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   144
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   145
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   146
function lose(gear)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   147
	gameOver()
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   148
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   149
9608
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   150
-------------- ANIMATIONS ------------------
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   151
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   152
function Skipanim(anim)
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   153
	if goals[anim] ~= nil then
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   154
		ShowMission(unpack(goals[anim]))
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   155
    end
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   156
end
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   157
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   158
function AnimationSetup()
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   159
	-- DIALOG 01 - Start, game instructions
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   160
	AddSkipFunction(dialog01, Skipanim, {dialog01})
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   161
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   162
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("On the Desert Planet, Hog Solo found some time to play with his RC plane..."), 3000}})
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   163
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you destroy all the targets on your current level you'll get teleported to the next level"), 5000}})
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   164
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only one RC plane at the start of the mission"), 5000}})
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   165
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("During the game you can get new RC planes by collecting the weapon crates"), 5000}})
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   166
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
9608
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   167
end
e2d4c2198e55 added captions with rules and objectives
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9606
diff changeset
   168
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   169
----------------- Other Functions -----------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   170
9610
fabff82cf0b8 win stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9608
diff changeset
   171
function checkTargetsDestroyed()
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   172
	if currentTarget == 1 then
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
		if not GetHealth(targets[1].gear) then
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   174
			AddCaption(loc("Level 1 clear!"))
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   175
			SetGearPosition(hero.gear, 3590, 90)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   176
			currentTarget = 2
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   177
			setTargets(currentTarget)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   178
		end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
	elseif currentTarget == 2 then
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   180
		if not (GetHealth(targets[2].gear) or GetHealth(targets[3].gear))  then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   181
			AddCaption(loc("Level 2 clear!"))
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   182
			SetGearPosition(hero.gear, 1110, 580)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   183
			currentTarget = 3
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   184
			setTargets(currentTarget)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   185
		end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   186
	elseif currentTarget == 3 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   187
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   188
	else
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   189
		win()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   190
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   191
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   192
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   193
function setTargets(ct)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
	if ct == 2 then
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   195
		SpawnAmmoCrate(rcCrates[2].x, rcCrates[2].y, amRCPlane)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
		for i=2,3 do
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
			targets[i].gear = AddGear(targets[i].x, targets[i].y, gtTarget, 0, 0, 0, 0)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   198
		end
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   199
	elseif ct == 3 then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   200
		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   201
		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   202
		SpawnAmmoCrate(rcCrates[4].x, rcCrates[4].y, amNothing)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   203
		for i=4,13 do
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   204
			targets[i].gear = AddGear(targets[i].x, targets[i].y, gtTarget, 0, 0, 0, 0)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   205
		end
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   206
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   207
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   208
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   209
function win()
9630
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9610
diff changeset
   210
	saveBonus(1, 1)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   211
	SendStat(siGameResult, loc("Congratulations, you are the best!"))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   212
	SendStat(siCustomAchievement, loc("You have destroyed all the targets"))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   213
	SendStat(siCustomAchievement, loc("You are indeed the best PAotH pilot"))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   214
	SendStat(siCustomAchievement, loc("Next time you play \"Searching in the dust\" you'll have an RC plane available"))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   215
	SendStat(siPlayerKills,'1',teamA.name)
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   216
	EndGame()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   217
end
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   218
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   219
function gameOver()
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   220
	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   221
	SendStat(siCustomAchievement, loc("You have to destroy all the targets"))
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   222
	SendStat(siCustomAchievement, loc("You will fail if you run out of ammo and there are still targets available"))
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
   223
	SendStat(siCustomAchievement, loc("Read the Challenge Objectives from within the mission for more details"))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9631
diff changeset
   224
	SendStat(siPlayerKills,'0',teamA.name)
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   225
	EndGame()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   226
end