share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua
author Wuzzy <almikes@aol.com>
Sat, 22 Apr 2017 18:00:57 +0200
changeset 12304 6b25d117a904
parent 12093 1da37e2ba6fd
child 12431 9f3387907e06
permissions -rw-r--r--
Freezer allows to freeze sticky mines (currently only disables them)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- Hero has to pass as fast as possible inside the
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
     4
-- rings as in the racer mode
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
HedgewarsScriptLoad("/Scripts/Locale.lua")
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
HedgewarsScriptLoad("/Scripts/Animate.lua")
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9757
diff changeset
     8
HedgewarsScriptLoad("/Scripts/Utils.lua")
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9576
diff changeset
     9
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
----------------- VARIABLES --------------------
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
-- globals
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9463
diff changeset
    13
local missionName = loc("Hard flying")
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
    14
local challengeStarted = false
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    15
local currentWaypoint = 1
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    16
local radius = 75
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
    17
local totalTime = 15000
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
    18
local totalSaucers = 3
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
    19
local gameEnded = false
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    20
local RED = 0xff0000ff
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    21
local GREEN = 0x38d61cff
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    22
local challengeObjectives = loc("To win the game you have to pass into the rings in time")..
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    23
	"|"..loc("You'll get extra time in case you need it when you pass a ring").."|"..
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    24
	loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer").."|"..
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
    25
	loc("Use the attack key twice to change the flying saucer while floating in mid-air")
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
-- dialogs
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
local dialog01 = {}
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
-- mission objectives
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
local goals = {
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    30
	[dialog01] = {missionName, loc("Getting ready"), challengeObjectives, 1, 4500},
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
}
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
-- hogs
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
local hero = {}
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
local ally = {}
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
-- teams
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local teamA = {}
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
local teamB = {}
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9463
diff changeset
    39
hero.name = loc("Hog Solo")
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    40
hero.x = 750
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    41
hero.y = 130
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
hero.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9463
diff changeset
    43
ally.name = loc("Paul McHoggy")
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    44
ally.x = 860
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    45
ally.y = 130
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
teamA.name = loc("Hog Solo")
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
teamA.color = tonumber("38D61C",16) -- green
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
teamB.name = loc("Allies")
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
teamB.color = tonumber("FF0000",16) -- red
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    50
-- way points
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    51
local current waypoint = 1
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
    52
local waypoints = {
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    53
	[1] = {x=1450, y=140},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    54
	[2] = {x=990, y=580},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    55
	[3] = {x=1650, y=950},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    56
	[4] = {x=620, y=630},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    57
	[5] = {x=1470, y=540},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    58
	[6] = {x=1960, y=60},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    59
	[7] = {x=1600, y=400},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    60
	[8] = {x=240, y=940},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    61
	[9] = {x=200, y=530},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    62
	[10] = {x=1180, y=120},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    63
	[11] = {x=1950, y=660},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    64
	[12] = {x=1280, y=980},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    65
	[13] = {x=590, y=1100},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    66
	[14] = {x=20, y=620},
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    67
	[15] = {x=hero.x, y=hero.y}
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    68
}
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
-------------- LuaAPI EVENT HANDLERS ------------------
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
function onGameInit()
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
    73
	GameFlags = gfInvulnerable
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	Seed = 1
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    75
	TurnTime = 15000
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	CaseFreq = 0
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
	MinesNum = 0
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
	MinesTime = 1
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
	Explosives = 0
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	Map = "ice02_map"
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
	Theme = "Snow"
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
    82
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	-- Hog Solo
12054
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11970
diff changeset
    84
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "hedgewars")
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	-- Ally
12054
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11970
diff changeset
    88
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_face")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9590
diff changeset
    89
	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	AnimSetGearPosition(ally.gear, ally.x, ally.y)
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
    91
	HogTurnLeft(ally.gear, true)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
    92
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9576
diff changeset
    93
	initCheckpoint("ice02")
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
    94
12093
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12090
diff changeset
    95
	AnimInit(true)
9590
347e799f01de fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
    96
	AnimationSetup()
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
end
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
    98
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
function onGameStart()
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	AnimWait(hero.gear, 3000)
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
	FollowGear(hero.gear)
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   102
	ShowMission(missionName, loc("Challenge objectives"), challengeObjectives, -amSkip, 0)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   103
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   104
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   105
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   106
	AddAmmo(hero.gear, amJetpack, 3)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   107
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   108
	-- place a waypoint
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   109
	placeNextWaypoint()
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   110
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
	SendHealthStatsOff()
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   112
	AddAnim(dialog01)
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   113
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   114
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   115
function onNewTurn()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   116
	if not hero.dead and CurrentHedgehog == ally.gear and challengeStarted then
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   117
		heroLost()
9645
da7b4d8c181e autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   118
	elseif not hero.dead and CurrentHedgehog == hero.gear and challengeStarted then
10289
c3a77ff02a23 lua api: SetWeapon(ammoType)
sheepluva
parents: 9831
diff changeset
   119
		SetWeapon(amJetpack)
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   120
	end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   121
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   122
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   123
function onGameTick()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   124
	AnimUnWait()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   125
	if ShowAnimation() == false then
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   126
		return
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   127
	end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   128
	ExecuteAfterAnimations()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   129
	CheckEvents()
9455
4bf3fac0e49d added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   130
end
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   131
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   132
function onGameTick20()
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   133
	if checkIfHeroInWaypoint() then
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   134
		if not gameEnded and not placeNextWaypoint() then
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   135
			gameEnded = true
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   136
			-- GAME OVER, WIN!
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   137
			totalTime = totalTime - TurnTimeLeft
11895
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   138
			local totalTimePrinted  = totalTime / 1000
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   139
			local saucersLeft = GetAmmoCount(hero.gear, amJetpack)
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   140
			local saucersUsed = totalSaucers - saucersLeft
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   141
			SendStat(siGameResult, loc("Hooray! You are a champion!"))
11895
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   142
			SendStat(siCustomAchievement, string.format(loc("You completed the mission in %.3f seconds."), totalTimePrinted))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   143
			local record = tonumber(GetCampaignVar("IceStadiumBestTime"))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   144
			if record ~= nil and totalTime >= record then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   145
				SendStat(siCustomAchievement, string.format(loc("Your personal best time so far: %.3f seconds"), record/1000))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   146
			end
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   147
			if record == nil or totalTime < record then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   148
				SaveCampaignVar("IceStadiumBestTime", tostring(totalTime))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   149
				if record ~= nil then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   150
					SendStat(siCustomAchievement, loc("This is a new personal best time, congratulations!"))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   151
				end
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   152
			end
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   153
			SendStat(siCustomAchievement, string.format(loc("You have used %d flying saucers."), saucersUsed))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   154
			SendStat(siCustomAchievement, string.format(loc("You had %d additional flying saucers left."), saucersLeft))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   155
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   156
			record = tonumber(GetCampaignVar("IceStadiumLeastSaucersUsed"))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   157
			if record == nil or saucersUsed < record then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   158
				SaveCampaignVar("IceStadiumLeastSaucersUsed", tostring(saucersUsed))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   159
			end
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   160
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   161
			SendStat(siPlayerKills,'0',teamA.name)
11957
63988f36debf Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents: 11895
diff changeset
   162
			SaveCampaignVar("Mission6Won", "true")
11970
72be38f6d0c0 Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents: 11957
diff changeset
   163
			checkAllMissionsCompleted()
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   164
			EndGame()
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   165
		end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   166
	end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   167
end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   168
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   169
function onGearDelete(gear)
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   170
	if gear == hero.gear then
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   171
		hero.dead = true
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   172
	end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   173
end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   174
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   175
function onPrecise()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   176
	if GameTime > 3000 then
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   177
		SetAnimSkip(true)
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   178
	end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   179
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   180
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   181
-------------- EVENTS ------------------
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   182
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   183
function onHeroDeath(gear)
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   184
	if hero.dead then
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   185
		return true
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   186
	end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   187
	return false
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   188
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   189
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   190
-------------- ACTIONS ------------------
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   191
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   192
function heroDeath(gear)
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   193
	heroLost()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   194
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   195
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   196
-------------- ANIMATIONS ------------------
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   197
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   198
function Skipanim(anim)
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   199
	if goals[anim] ~= nil then
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   200
		ShowMission(unpack(goals[anim]))
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   201
    end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   202
    startFlying()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   203
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   204
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   205
function AnimationSetup()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   206
	-- DIALOG 01 - Start, some story telling
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   207
	AddSkipFunction(dialog01, Skipanim, {dialog01})
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   208
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   209
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Ice Planet Flying Saucer Stadium ..."), 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   210
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the Olympic stadium of saucer flying."), SAY_SAY, 4000}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   211
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream to come here one day in order to compete with the best!"), SAY_SAY, 5000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   212
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and claim the place that you deserve among the best."), SAY_SAY, 6000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   213
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use the saucer and pass through the rings."), 5000}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   214
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Pause the game by pressing the pause key (default \"P\") for more details"), 5000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   215
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Can you do it?"), SAY_SAY, 2000}})
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   216
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   217
	table.insert(dialog01, {func = startFlying, args = {hero.gear}})
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   218
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   219
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   220
------------------ Other Functions -------------------
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   221
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   222
function startFlying()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   223
	AnimSwitchHog(ally.gear)
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   224
	TurnTimeLeft = 0
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   225
	challengeStarted = true
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   226
end
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   227
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   228
function placeNextWaypoint()
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   229
	if currentWaypoint > 1 then
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   230
		local wp = waypoints[currentWaypoint-1]
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   231
		DeleteVisualGear(wp.gear)
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   232
	end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   233
	if currentWaypoint < 16 then
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   234
		local wp = waypoints[currentWaypoint]
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   235
		wp.gear = AddVisualGear(1,1,vgtCircle,1,true)
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   236
		-- add bonus time and "fuel"
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   237
		if currentWaypoint % 2 == 0 then
12090
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   238
			PlaySound(sndShotgunReload)
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   239
			SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, RED)
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   240
			AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1)
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   241
			totalSaucers = totalSaucers + 1
12090
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   242
			local vgear = AddVisualGear(GetX(hero.gear), GetY(hero.gear), vgtAmmo, 0, true)
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   243
			if vgear ~= nil then
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   244
				SetVisualGearValues(vgear,nil,nil,nil,nil,nil,amJetpack)
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   245
			end
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   246
			local message 
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   247
			if TurnTimeLeft <= 22000 then
9459
8c653c0dd332 making it a little bit more difficult
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9457
diff changeset
   248
				TurnTimeLeft = TurnTimeLeft + 8000
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   249
				totalTime = totalTime + 8000
12090
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   250
				PlaySound(sndExtraTime)
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   251
				message = loc("Got 1 more saucer and 8 more seconds added to the clock")
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   252
			else
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   253
				message = loc("Got 1 more saucer")
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   254
			end
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   255
			AnimCaption(hero.gear, message, 4000)
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   256
		else
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   257
			SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, GREEN)
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   258
			if TurnTimeLeft <= 16000 then
9459
8c653c0dd332 making it a little bit more difficult
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9457
diff changeset
   259
				TurnTimeLeft = TurnTimeLeft + 6000
9463
653af9cec589 stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9461
diff changeset
   260
				totalTime = totalTime + 6000
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   261
				if currentWaypoint ~= 1 then
12090
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   262
					PlaySound(sndExtraTime)
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   263
					AnimCaption(hero.gear, loc("6 more seconds added to the clock"), 4000)
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   264
				end
9459
8c653c0dd332 making it a little bit more difficult
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9457
diff changeset
   265
			end
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9645
diff changeset
   266
		end
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   267
		radius = radius - 4
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   268
		currentWaypoint = currentWaypoint + 1
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   269
		return true
9576
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   270
	else
8d8bad7d78de more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   271
		AnimCaption(hero.gear, loc("Congratulations, you won!"), 4000)
12090
e9a4afec9a3a Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   272
		PlaySound(sndVictory, hero.gear)
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   273
	end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   274
	return false
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   275
end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   276
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   277
function checkIfHeroInWaypoint()
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   278
	if not hero.dead then
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   279
		local wp = waypoints[currentWaypoint-1]
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9757
diff changeset
   280
		if gearIsInCircle(hero.gear, wp.x, wp.y, radius+4, false) then
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9757
diff changeset
   281
			SetWind(GetRandom(201)-100)
9457
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   282
			return true
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   283
		end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   284
	end
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   285
	return false
934f4d8370f1 finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9455
diff changeset
   286
end
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   287
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   288
function heroLost()
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   289
	SendStat(siGameResult, loc("Oh man! Learn how to fly!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   290
	SendStat(siCustomAchievement, loc("To win the game you have to pass into the rings in time."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   291
	SendStat(siCustomAchievement, loc("You'll get extra time in case you need it when you pass a ring."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   292
	SendStat(siCustomAchievement, loc("Every 2 rings you'll get extra flying saucers."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   293
	SendStat(siCustomAchievement, loc("Use the attack key twice to change the flying saucer while being in air."))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   294
	SendStat(siPlayerKills,'0',teamA.name)
9461
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   295
	EndGame()
0058a9863724 dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9459
diff changeset
   296
end