share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Fri, 06 Sep 2013 05:54:59 +0300
branchspacecampaign
changeset 9606 1d088cc31ff8
parent 9605 66cd14e5bdad
child 9608 e2d4c2198e55
permissions -rw-r--r--
mission mechanioncs seems ok
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")
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
local challengeObjectives = loc("Use the rc plane and destroy the all the targets").."|"..
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
	loc("Each time you destroy your level targets you'll get teleported to the next level").."|"..
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    14
	loc("You'll have only one rc plane at the start of the mission").."|"..
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    15
	loc("During the game you can get new plane by getting the weapon crates")
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
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
-- hogs
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
local hero = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
	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
    20
	x = 100,
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
	y = 170
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    22
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    23
-- teams
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
local teamA = {
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
	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
    27
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
-- creates & targets
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
local rcCrates = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
	{ 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
    31
	{ x = 2810, y = 720},
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    32
	{ x = 2440, y = 660},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    33
	{ 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
    34
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
local targets = {
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
	{ 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
    37
	{ x = 3880, y = 1430},
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    38
	{ x = 4000, y = 1430},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    39
	{ x = 2190, y = 1160},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    40
	{ x = 2190, y = 1460},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    41
	{ x = 2110, y = 1700},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    42
	{ x = 2260, y = 1700},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    43
	{ x = 2085, y = 1330},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    44
	{ x = 156, y = 1400},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    45
	{ x = 324, y = 1400},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    46
	{ x = 660, y = 1310},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    47
	{ x = 1200, y = 1310},
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    48
	{ 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
    49
}
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
-------------- 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
    52
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
function onGameInit()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
	GameFlags = gfOneClanMode
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
	Seed = 1
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
	TurnTime = -1
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
	CaseFreq = 0
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
	MinesNum = 0
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	MinesTime = 1
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	Explosives = 0
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
	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
    62
	Theme = "Desert"
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
	
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	-- Hog Solo
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	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
    66
	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
    67
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	initCheckpoint("desert03")
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
	AnimInit()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
	--AnimationSetup()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
function onGameStart()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	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
    77
	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
    78
	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
    79
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    81
	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
    82
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	-- 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
    84
	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
    85
	targets[1].gear = AddGear(targets[1].x, targets[1].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
    86
	
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	-- hero ammo
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	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
    89
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	SendHealthStatsOff()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    93
function onGameTick()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    94
	AnimUnWait()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    95
	if ShowAnimation() == false then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    96
		return
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    97
	end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    98
	ExecuteAfterAnimations()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
    99
	CheckEvents()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   100
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   101
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   102
function onGameTick20()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   103
	checkTargetsDestroied()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   105
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
function onAmmoStoreInit()
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   107
	SetAmmo(amNothing, 0, 0, 0, 0)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   108
	SetAmmo(amRCPlane, 0, 0, 0, 1)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   109
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   110
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   111
function onPrecise()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   112
	if GameTime > 3000 then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   113
		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
   114
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   116
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   117
-------------- EVENTS ------------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   118
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   119
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
   120
	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
   121
		return true
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
	return false
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   125
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   126
function onLose(gear)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   127
	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
   128
		return true
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   129
	end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   130
	return false
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   131
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   132
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   133
-------------- ACTIONS ------------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   134
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   135
function heroDeath(gear)
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   136
	gameOver()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   137
end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   138
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   139
function lose(gear)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   140
	gameOver()
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   141
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   142
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   143
----------------- Other Functions -----------------
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   144
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   145
function checkTargetsDestroied()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   146
	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
   147
		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
   148
			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
   149
			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
   150
			currentTarget = 2
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
			setTargets(currentTarget)
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   152
		end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   153
	elseif currentTarget == 2 then
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   154
		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
   155
			AddCaption(loc("Level 2 clear!"))
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   156
			SetGearPosition(hero.gear, 1110, 580)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   157
			currentTarget = 3
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   158
			setTargets(currentTarget)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   159
		end
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   160
	elseif currentTarget == 3 then
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   161
		
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   162
	else
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   163
		win()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   164
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   165
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   166
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   167
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
   168
	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
   169
		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
   170
		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
   171
			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
   172
		end
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   173
	elseif ct == 3 then
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   174
		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   175
		SpawnAmmoCrate(rcCrates[3].x, rcCrates[3].y, amRCPlane)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   176
		SpawnAmmoCrate(rcCrates[4].x, rcCrates[4].y, amNothing)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   177
		for i=4,13 do
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   178
			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
   179
		end
9605
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   180
	end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   181
end
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   182
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   183
function win()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   184
	EndGame()
66cd14e5bdad part of desert03 side mission - map not finished yet, will be commited later
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   185
end
9606
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   186
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   187
function gameOver()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   188
	SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   189
	SendStat('siCustomAchievement', loc("You have to destroy all the targets")) --11		
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   190
	SendStat('siCustomAchievement', loc("You will fail if you run out of ammo and there are still targets available")) --11		
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   191
	SendStat('siCustomAchievement', loc("Read the Challenge Objectives from within the mission for more details")) --11		
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   192
	SendStat('siPlayerKills','0',teamA.name)
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   193
	EndGame()
1d088cc31ff8 mission mechanioncs seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9605
diff changeset
   194
end