author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 21 Dec 2018 23:17:10 +0100 | |
changeset 14522 | 4e7fbbdca061 |
parent 14509 | 7bb7e5e54f70 |
child 14533 | 3b6976beb58b |
permissions | -rw-r--r-- |
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 |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
16 |
local radius = 75 -- Ring radius. Will become smaller and smaller |
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
17 |
local totalTime = 15000 -- Total available time. Initial value is start time; is added to later when player wins extra time |
9463
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 |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
20 |
local heroTurn = false |
9576
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
21 |
local RED = 0xff0000ff |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
22 |
local GREEN = 0x00ff00ff |
12426
9f3387907e06
Fix even more bad/broken loc()'s in scripts (hopefully the last one)
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
23 |
local challengeObjectives = loc("To win the game you have to pass into the rings in time.").. |
9f3387907e06
Fix even more bad/broken loc()'s in scripts (hopefully the last one)
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
24 |
"|"..loc("You'll get extra time in case you need it when you pass a ring.").."|".. |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
25 |
loc("Green double rings also give you a new flying saucer.").."|".. |
12426
9f3387907e06
Fix even more bad/broken loc()'s in scripts (hopefully the last one)
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
26 |
loc("Use the attack key twice to change the flying saucer while floating in mid-air.") |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
27 |
local timeRecord |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
28 |
-- dialogs |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
29 |
local dialog01 = {} |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
30 |
-- hogs |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
31 |
local hero = {} |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
local ally = {} |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
-- teams |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
34 |
local teamA = {} |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
35 |
local teamB = {} |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
36 |
-- hedgehogs values |
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9463
diff
changeset
|
37 |
hero.name = loc("Hog Solo") |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
38 |
hero.x = 750 |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
39 |
hero.y = 130 |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
40 |
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
|
41 |
ally.name = loc("Paul McHoggy") |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
42 |
ally.x = 860 |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
43 |
ally.y = 130 |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
44 |
teamA.name = loc("Hog Solo") |
13583
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
12909
diff
changeset
|
45 |
teamA.color = -6 |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
46 |
teamB.name = loc("Allies") |
13583
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
12909
diff
changeset
|
47 |
teamB.color = -6 |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
48 |
-- way points |
9757 | 49 |
local waypoints = { |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
50 |
[1] = {x=1450, y=140}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
51 |
[2] = {x=990, y=580}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
52 |
[3] = {x=1650, y=950}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
53 |
[4] = {x=620, y=630}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
54 |
[5] = {x=1470, y=540}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
55 |
[6] = {x=1960, y=60}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
56 |
[7] = {x=1600, y=400}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
57 |
[8] = {x=240, y=940}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
58 |
[9] = {x=200, y=530}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
59 |
[10] = {x=1180, y=120}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
60 |
[11] = {x=1950, y=660}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
61 |
[12] = {x=1280, y=980}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
62 |
[13] = {x=590, y=1100}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
63 |
[14] = {x=20, y=620}, |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
64 |
[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
|
65 |
} |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
66 |
|
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
67 |
-------------- LuaAPI EVENT HANDLERS ------------------ |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
68 |
|
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
69 |
function onGameInit() |
12571
903a30fb49e6
Fix team colors of most teams in A Space Adventure to denote correct ally status
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
70 |
GameFlags = gfInvulnerable + gfOneClanMode |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
71 |
Seed = 1 |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
72 |
TurnTime = totalTime |
12577
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
73 |
Ready = 25000 |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
74 |
CaseFreq = 0 |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
75 |
MinesNum = 0 |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
76 |
MinesTime = 1 |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
77 |
Explosives = 0 |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
78 |
Map = "ice02_map" |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
79 |
Theme = "Snow" |
12468
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12426
diff
changeset
|
80 |
-- Disable Sudden Death |
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12426
diff
changeset
|
81 |
WaterRise = 0 |
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12426
diff
changeset
|
82 |
HealthDecrease = 0 |
9757 | 83 |
|
14509
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13894
diff
changeset
|
84 |
-- Hero |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13894
diff
changeset
|
85 |
teamA.name = AddMissionTeam(teamA.color) |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13894
diff
changeset
|
86 |
hero.gear = AddMissionHog(100) |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13894
diff
changeset
|
87 |
hero.name = GetHogName(hero.gear) |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
88 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
89 |
-- Ally |
14509
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13894
diff
changeset
|
90 |
teamB.name = AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face") |
9629 | 91 |
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
|
92 |
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
|
93 |
HogTurnLeft(ally.gear, true) |
9757 | 94 |
|
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
95 |
timeRecord = tonumber(GetCampaignVar("IceStadiumBestTime")) |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
96 |
|
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9576
diff
changeset
|
97 |
initCheckpoint("ice02") |
9757 | 98 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12085
diff
changeset
|
99 |
AnimInit(true) |
9590
347e799f01de
fruit side mission map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9582
diff
changeset
|
100 |
AnimationSetup() |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
101 |
end |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
102 |
|
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
103 |
function ShowGoals() |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
104 |
-- mission objectives |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
105 |
local goalStr = challengeObjectives |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
106 |
if timeRecord ~= nil then |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
107 |
local personalBestStr = string.format(loc("Personal best: %.3f seconds"), timeRecord/1000) |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
108 |
goalStr = goalStr .. "|" .. personalBestStr |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
109 |
end |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
110 |
ShowMission(missionName, loc("Getting ready"), goalStr, 1, 25000) |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
111 |
end |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
112 |
|
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
113 |
function onGameStart() |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
114 |
AnimWait(hero.gear, 3000) |
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
115 |
FollowGear(hero.gear) |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
116 |
ShowGoals() |
12577
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
117 |
HideMission() |
9757 | 118 |
|
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
119 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
9757 | 120 |
|
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
121 |
AddAmmo(hero.gear, amJetpack, 3) |
9757 | 122 |
|
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
123 |
-- place a waypoint |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
124 |
placeNextWaypoint() |
9757 | 125 |
|
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
126 |
SendHealthStatsOff() |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
127 |
AddAnim(dialog01) |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
128 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
129 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
130 |
function onNewTurn() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
131 |
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
|
132 |
heroLost() |
9645
da7b4d8c181e
autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9642
diff
changeset
|
133 |
elseif not hero.dead and CurrentHedgehog == hero.gear and challengeStarted then |
10289 | 134 |
SetWeapon(amJetpack) |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
135 |
end |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
136 |
heroTurn = CurrentHedgehog == hero.gear |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
137 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
138 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
139 |
function onGameTick() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
140 |
AnimUnWait() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
141 |
if ShowAnimation() == false then |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
142 |
return |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
143 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
144 |
ExecuteAfterAnimations() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
145 |
CheckEvents() |
9455
4bf3fac0e49d
added iceplanet sidequest map and stub lua
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
146 |
end |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
147 |
|
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
148 |
function onGameTick20() |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
149 |
if checkIfHeroInWaypoint() then |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
150 |
if not gameEnded and not placeNextWaypoint() then |
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
151 |
gameEnded = true |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
152 |
-- GAME OVER, WIN! |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
153 |
totalTime = totalTime - TurnTimeLeft |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
154 |
local totalTimePrinted = totalTime / 1000 |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
155 |
local saucersLeft = GetAmmoCount(hero.gear, amJetpack) |
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
156 |
local saucersUsed = totalSaucers - saucersLeft |
13894
4608300bc2fc
ASA, ice02: Change time strings for consistency with other time strings
Wuzzy <Wuzzy2@mail.ru>
parents:
13838
diff
changeset
|
157 |
SetTeamLabel(teamA.name, string.format(loc("%.3fs"), totalTimePrinted)) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
158 |
SendStat(siGameResult, loc("Hooray! You are a champion!")) |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
159 |
SendStat(siCustomAchievement, string.format(loc("You completed the mission in %.3f seconds."), totalTimePrinted)) |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
160 |
if timeRecord ~= nil and totalTime >= timeRecord then |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
161 |
SendStat(siCustomAchievement, string.format(loc("Your personal best time so far: %.3f seconds"), timeRecord/1000)) |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
162 |
end |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
163 |
if timeRecord == nil or totalTime < timeRecord then |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
164 |
SaveCampaignVar("IceStadiumBestTime", tostring(totalTime)) |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
165 |
if timeRecord ~= nil then |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
166 |
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:
11692
diff
changeset
|
167 |
end |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
168 |
end |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
169 |
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:
11692
diff
changeset
|
170 |
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:
11692
diff
changeset
|
171 |
|
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
172 |
local leastSaucersRecord = tonumber(GetCampaignVar("IceStadiumLeastSaucersUsed")) |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
173 |
if leastSaucersRecord == nil or saucersUsed < leastSaucersRecord then |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
174 |
SaveCampaignVar("IceStadiumLeastSaucersUsed", tostring(saucersUsed)) |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
175 |
end |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
176 |
|
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
177 |
SendStat(siPointType, loc("milliseconds")) |
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
178 |
SendStat(siPlayerKills, totalTime, GetHogTeamName(hero.gear)) |
11952
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
11890
diff
changeset
|
179 |
SaveCampaignVar("Mission6Won", "true") |
11965
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
180 |
checkAllMissionsCompleted() |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
181 |
SetTurnTimeLeft(MAX_TURN_TIME) |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
182 |
EndGame() |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
183 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
184 |
end |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
185 |
if heroTurn and challengeStarted and not gameEnded and not hero.dead and ReadyTimeLeft == 0 then |
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
186 |
local time = totalTime - TurnTimeLeft |
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
187 |
local timePrinted = time / 1000 |
13894
4608300bc2fc
ASA, ice02: Change time strings for consistency with other time strings
Wuzzy <Wuzzy2@mail.ru>
parents:
13838
diff
changeset
|
188 |
SetTeamLabel(teamA.name, string.format(loc("%.1fs"), timePrinted)) |
13838
bf8c454a9f93
ASA, ice02: Display current flying time next to team bar
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset
|
189 |
end |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
190 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
191 |
|
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
192 |
function onGearDelete(gear) |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
193 |
if gear == hero.gear then |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
194 |
hero.dead = true |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
195 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
196 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
197 |
|
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
198 |
function onGearAdd(gear) |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
199 |
if GetGearType(gear) == gtJetpack then |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
200 |
HideMission() |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
201 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
202 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
203 |
|
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
204 |
function onPrecise() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
205 |
if GameTime > 3000 then |
9757 | 206 |
SetAnimSkip(true) |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
207 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
208 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
209 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
210 |
-------------- EVENTS ------------------ |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
211 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
212 |
function onHeroDeath(gear) |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
213 |
if hero.dead then |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
214 |
return true |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
215 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
216 |
return false |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
217 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
218 |
|
9639
6b2ae2eaf1b2
remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9629
diff
changeset
|
219 |
-------------- ACTIONS ------------------ |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
220 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
221 |
function heroDeath(gear) |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
222 |
heroLost() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
223 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
224 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
225 |
-------------- ANIMATIONS ------------------ |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
226 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
227 |
function Skipanim(anim) |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
228 |
ShowGoals() |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12571
diff
changeset
|
229 |
startFlying() |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
230 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
231 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
232 |
function AnimationSetup() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
233 |
-- DIALOG 01 - Start, some story telling |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
234 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
235 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
12900
a9e4e8fa852c
Fix various typos in translatable strings
Wuzzy <Wuzzy2@mail.ru>
parents:
12587
diff
changeset
|
236 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the stadium, where the best pilots compete ..."), 5000}}) |
a9e4e8fa852c
Fix various typos in translatable strings
Wuzzy <Wuzzy2@mail.ru>
parents:
12587
diff
changeset
|
237 |
table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the Olympic Stadium of Saucer Flying."), SAY_SAY, 4000}}) |
9757 | 238 |
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}}) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
239 |
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
|
240 |
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
|
241 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
12909
b5d3b79c90cf
ASA, Hard Flying: Show personal best at mission start
Wuzzy <Wuzzy2@mail.ru>
parents:
12900
diff
changeset
|
242 |
table.insert(dialog01, {func = ShowGoals, args = {}}) |
9757 | 243 |
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
|
244 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
245 |
|
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
246 |
------------------ Other Functions ------------------- |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
247 |
|
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
248 |
function startFlying() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
249 |
AnimSwitchHog(ally.gear) |
12514
d89dabfd07ce
Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents:
12468
diff
changeset
|
250 |
EndTurn(true) |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
251 |
challengeStarted = true |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
252 |
end |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
253 |
|
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
254 |
function placeNextWaypoint() |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
255 |
if currentWaypoint > 1 then |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
256 |
local wp = waypoints[currentWaypoint-1] |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
257 |
DeleteVisualGear(wp.gear) |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
258 |
DeleteVisualGear(wp.gear2) |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
259 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
260 |
if currentWaypoint < 16 then |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
261 |
local wp = waypoints[currentWaypoint] |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
262 |
wp.gear = AddVisualGear(1,1,vgtCircle,1,true) |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
263 |
-- 1st, 3rd, 5th, 7th, 9th, ... ring |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
264 |
if currentWaypoint % 2 == 0 then |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
265 |
-- Render single red ring |
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
266 |
SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, RED) |
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
267 |
-- Give 1 flying saucer and, if needed, extra time |
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
268 |
AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1) |
12085
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
269 |
PlaySound(sndShotgunReload) |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
270 |
totalSaucers = totalSaucers + 1 |
12085
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
271 |
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:
12049
diff
changeset
|
272 |
if vgear ~= nil then |
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
273 |
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:
12049
diff
changeset
|
274 |
end |
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
275 |
local message |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
276 |
if TurnTimeLeft <= 22000 then |
13742
2bb7141496a9
Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
277 |
SetTurnTimeLeft(TurnTimeLeft + 8000) |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
278 |
totalTime = totalTime + 8000 |
12085
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
279 |
PlaySound(sndExtraTime) |
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
280 |
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:
12049
diff
changeset
|
281 |
else |
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
282 |
message = loc("Got 1 more saucer") |
9576
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
283 |
end |
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
284 |
AnimCaption(hero.gear, message, 4000) |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
285 |
-- 2nd, 4th, 6th, 8th, 10th, ... ring |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
286 |
else |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
287 |
-- Render double green ring |
9576
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
288 |
SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, GREEN) |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
289 |
wp.gear2 = AddVisualGear(1,1,vgtCircle,1,true) |
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
290 |
SetVisualGearValues(wp.gear2, wp.x,wp.y, 20, 200, 0, 0, 100, radius - 6, 2, GREEN) |
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
291 |
-- Give extra time, if needed |
9463
653af9cec589
stats in case of win
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9461
diff
changeset
|
292 |
if TurnTimeLeft <= 16000 then |
9576
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
293 |
if currentWaypoint ~= 1 then |
13837
25de751feb02
ASA, ice02: Fix recorded time being 6 seconds more than reality
Wuzzy <Wuzzy2@mail.ru>
parents:
13836
diff
changeset
|
294 |
SetTurnTimeLeft(TurnTimeLeft + 6000) |
25de751feb02
ASA, ice02: Fix recorded time being 6 seconds more than reality
Wuzzy <Wuzzy2@mail.ru>
parents:
13836
diff
changeset
|
295 |
totalTime = totalTime + 6000 |
12085
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
296 |
PlaySound(sndExtraTime) |
9576
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
297 |
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
|
298 |
end |
9459
8c653c0dd332
making it a little bit more difficult
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9457
diff
changeset
|
299 |
end |
9757 | 300 |
end |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
301 |
radius = radius - 4 |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
302 |
currentWaypoint = currentWaypoint + 1 |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
303 |
return true |
9576
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
304 |
else |
8d8bad7d78de
more chanllenge details in ice02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
305 |
AnimCaption(hero.gear, loc("Congratulations, you won!"), 4000) |
12085
e9a4afec9a3a
Give visual and audible feedback for flying through rings in Hard Flying mission
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
306 |
PlaySound(sndVictory, hero.gear) |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
307 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
308 |
return false |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
309 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
310 |
|
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
311 |
function checkIfHeroInWaypoint() |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
312 |
if not hero.dead then |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
313 |
local wp = waypoints[currentWaypoint-1] |
9810
54c0fdec4600
changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9757
diff
changeset
|
314 |
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
|
315 |
SetWind(GetRandom(201)-100) |
9457
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
316 |
return true |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
317 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
318 |
end |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
319 |
return false |
934f4d8370f1
finally most of the mission mechanics seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9455
diff
changeset
|
320 |
end |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
321 |
|
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
322 |
function heroLost() |
9642
8a691e0f117a
use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9639
diff
changeset
|
323 |
SendStat(siGameResult, loc("Oh man! Learn how to fly!")) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
324 |
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
|
325 |
SendStat(siCustomAchievement, loc("You'll get extra time in case you need it when you pass a ring.")) |
13836
8d1c54c684a8
ASA: ice02: Render green rings as double rings
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
326 |
SendStat(siCustomAchievement, loc("Green double rings also give you a new flying saucer.")) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
327 |
SendStat(siCustomAchievement, loc("Use the attack key twice to change the flying saucer while being in air.")) |
12539
19192a3cb674
Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents:
12514
diff
changeset
|
328 |
sendSimpleTeamRankings({teamA.name}) |
9461
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
329 |
EndGame() |
0058a9863724
dialogs and events for hero lose
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9459
diff
changeset
|
330 |
end |