author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 18 Jan 2019 00:36:48 +0100 | |
changeset 14652 | 92ebe33c5eb6 |
parent 14515 | cc358e997e32 |
child 14669 | be8af70adf2c |
permissions | -rw-r--r-- |
14496
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14485
diff
changeset
|
1 |
HedgewarsScriptLoad("/Scripts/Utils.lua") |
11015 | 2 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
13501
cbda0f842364
Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents:
13066
diff
changeset
|
3 |
HedgewarsScriptLoad("/Scripts/Achievements.lua") |
11015 | 4 |
|
5 |
local player = nil |
|
14515
cc358e997e32
Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
Wuzzy <Wuzzy2@mail.ru>
parents:
14501
diff
changeset
|
6 |
local playerTeamName = nil |
11015 | 7 |
local RCGear = nil |
8 |
local planesUsed = 0 |
|
9 |
local planeTimer = 0 |
|
10 |
local planeUhOh = false |
|
11 |
local cratesLeft = 0 |
|
12 |
local crateStreak = 0 |
|
13 |
local longestCrateStreak = 0 |
|
14 |
local commentTimer = 0 |
|
15 |
local missiles = 0 |
|
16 |
local totalMissiles = 0 |
|
17 |
local missileScanTimer = 0 |
|
18 |
local nextComment = sndNone |
|
19 |
||
20 |
function onGameInit() |
|
21 |
||
22 |
Seed = 1 |
|
23 |
GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode + gfSolidLand |
|
24 |
||
12225
93079fecbc77
Set infinite turn time in RC Plane Challenge
Wuzzy <almikes@aol.com>
parents:
12224
diff
changeset
|
25 |
-- Basically unlimited turn time |
13752
110d6c1e817f
Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
26 |
TurnTime = MAX_TURN_TIME |
11015 | 27 |
|
28 |
Map = "Ropes" |
|
29 |
Theme = "Eyes" |
|
30 |
||
12224
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
31 |
-- Disable Sudden Death |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
32 |
WaterRise = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
33 |
HealthDecrease = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
34 |
|
11015 | 35 |
CaseFreq = 0 |
36 |
MinesNum = 0 |
|
37 |
Explosives = 0 |
|
38 |
||
14515
cc358e997e32
Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
Wuzzy <Wuzzy2@mail.ru>
parents:
14501
diff
changeset
|
39 |
playerTeamName = AddMissionTeam(-1) |
14501
208359558642
Use player-chosen team identity for training and a few challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14496
diff
changeset
|
40 |
player = AddMissionHog(80) |
11015 | 41 |
SetGearPosition(player, 1380, 1500) |
42 |
||
43 |
end |
|
44 |
||
45 |
||
46 |
||
47 |
function onGameStart() |
|
48 |
||
49 |
SendHealthStatsOff() |
|
50 |
||
14496
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14485
diff
changeset
|
51 |
local recordInfo = getReadableChallengeRecord("Lowscore") |
11015 | 52 |
ShowMission ( |
12077
ce3860c82c8b
Rewrite 2nd line of mission panel of most missions for consistency
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
53 |
loc("RC Plane Challenge"), |
ce3860c82c8b
Rewrite 2nd line of mission panel of most missions for consistency
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
54 |
loc("Challenge"), |
11015 | 55 |
|
56 |
loc("Collect or destroy all the health crates.") .. "|" .. |
|
57 |
loc("Compete to use as few planes as possible!") .. "|" .. |
|
14496
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14485
diff
changeset
|
58 |
recordInfo, -amRCPlane, 4000 |
11015 | 59 |
) |
14515
cc358e997e32
Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
Wuzzy <Wuzzy2@mail.ru>
parents:
14501
diff
changeset
|
60 |
SetTeamLabel(playerTeamName, "0") |
11015 | 61 |
|
62 |
PlaceGirder(2192, 508, 6) |
|
63 |
PlaceGirder(2192, 670, 6) |
|
64 |
PlaceGirder(2193, 792, 2) |
|
65 |
PlaceGirder(2100, 825, 4) |
|
66 |
PlaceGirder(2009, 899, 6) |
|
67 |
PlaceGirder(2084, 992, 4) |
|
68 |
PlaceGirder(2145, 1087, 6) |
|
69 |
PlaceGirder(2199, 1235, 5) |
|
70 |
PlaceGirder(2308, 1296, 0) |
|
71 |
PlaceGirder(2424, 1234, 7) |
|
72 |
PlaceGirder(2473, 1129, 2) |
|
73 |
PlaceGirder(2437, 1046, 1) |
|
74 |
PlaceGirder(2409, 927, 6) |
|
75 |
PlaceGirder(2408, 763, 6) |
|
76 |
PlaceGirder(2404, 540, 6) |
|
77 |
PlaceGirder(2426, 423, 3) |
|
78 |
PlaceGirder(2550, 400, 4) |
|
79 |
PlaceGirder(2668, 425, 1) |
|
80 |
PlaceGirder(2707, 541, 6) |
|
81 |
PlaceGirder(2706, 703, 6) |
|
82 |
PlaceGirder(2705, 867, 6) |
|
83 |
PlaceGirder(2779, 962, 4) |
|
84 |
PlaceGirder(2894, 924, 3) |
|
85 |
PlaceGirder(2908, 802, 6) |
|
86 |
PlaceGirder(2907, 639, 6) |
|
87 |
PlaceGirder(3052, 566, 4) |
|
88 |
PlaceGirder(2971, 394, 4) |
|
89 |
PlaceGirder(3103, 448, 7) |
|
90 |
PlaceGirder(3047, 654, 0) |
|
91 |
PlaceGirder(3043, 746, 6) |
|
92 |
PlaceGirder(3265, 1583, 6) |
|
93 |
PlaceGirder(3256, 1491, 4) |
|
94 |
PlaceGirder(3187, 1401, 6) |
|
95 |
PlaceGirder(3326, 1400, 6) |
|
96 |
PlaceGirder(774, 530, 5) |
|
97 |
PlaceGirder(922, 595, 4) |
|
98 |
PlaceGirder(1079, 533, 7) |
|
99 |
PlaceGirder(1139, 386, 6) |
|
100 |
PlaceGirder(1074, 237, 5) |
|
101 |
PlaceGirder(723, 381, 6) |
|
102 |
PlaceGirder(781, 229, 7) |
|
103 |
PlaceGirder(927, 746, 6) |
|
104 |
PlaceGirder(874, 736, 0) |
|
105 |
PlaceGirder(982, 737, 0) |
|
106 |
PlaceGirder(2430, 1730, 4) |
|
107 |
||
108 |
PlaceGirder(1613, 1104, 7) |
|
109 |
PlaceGirder(1564, 1256, 6) |
|
110 |
PlaceGirder(1643, 1341, 5) |
|
111 |
PlaceGirder(1780, 1372, 4) |
|
112 |
PlaceGirder(1869, 1296, 7) |
|
113 |
PlaceGirder(1858, 1163, 5) |
|
114 |
PlaceGirder(1739, 1044, 5) |
|
115 |
PlaceGirder(1621, 926, 5) |
|
116 |
PlaceGirder(1597, 985, 5) |
|
117 |
PlaceGirder(1449, 939, 4) |
|
118 |
PlaceGirder(1473, 874, 4) |
|
119 |
PlaceGirder(2092, 1352, 7) |
|
120 |
PlaceGirder(2145, 1444, 7) |
|
121 |
PlaceGirder(2004, 1443, 3) |
|
122 |
PlaceGirder(1978, 1523, 2) |
|
123 |
PlaceGirder(2021, 1596, 1) |
|
124 |
PlaceGirder(2103, 1625, 0) |
|
125 |
PlaceGirder(2208, 1551, 7) |
|
126 |
PlaceGirder(2327, 1431, 7) |
|
127 |
PlaceGirder(2395, 1478, 6) |
|
128 |
PlaceGirder(2396, 1600, 2) |
|
129 |
PlaceGirder(2495, 1285, 6) |
|
130 |
PlaceGirder(2494, 1408, 2) |
|
131 |
PlaceGirder(2547, 530, 0) |
|
132 |
||
133 |
PlaceGirder(2451, 1551, 0) |
|
134 |
PlaceGirder(2551, 706, 6) |
|
135 |
PlaceGirder(2551, 869, 6) |
|
136 |
PlaceGirder(2623, 1016, 5) |
|
137 |
PlaceGirder(2773, 1083, 4) |
|
138 |
PlaceGirder(2924, 1019, 7) |
|
139 |
PlaceGirder(2568, 1491, 7) |
|
140 |
PlaceGirder(2618, 1346, 6) |
|
141 |
PlaceGirder(2674, 1195, 7) |
|
142 |
PlaceGirder(2822, 1142, 4) |
|
143 |
PlaceGirder(2963, 1069, 7) |
|
144 |
PlaceGirder(3067, 938, 5) |
|
145 |
PlaceGirder(2803, 1373, 2) |
|
146 |
PlaceGirder(2811, 1559, 2) |
|
147 |
||
13066
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
148 |
SpawnFakeHealthCrate(930, 557, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
149 |
SpawnFakeHealthCrate(979, 692, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
150 |
SpawnFakeHealthCrate(876, 703, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
151 |
SpawnFakeHealthCrate(2309, 1260, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
152 |
SpawnFakeHealthCrate(1733, 1127, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
153 |
SpawnFakeHealthCrate(1738, 1320, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
154 |
SpawnFakeHealthCrate(3249, 1460, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
155 |
SpawnFakeHealthCrate(3051, 617, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
156 |
SpawnFakeHealthCrate(2972, 353, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
157 |
SpawnFakeHealthCrate(2548, 358, false, false) |
11015 | 158 |
|
13066
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
159 |
SpawnFakeHealthCrate(2090, 1580, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
160 |
SpawnFakeHealthCrate(1752, 1753, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
161 |
SpawnFakeHealthCrate(1865, 1758, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
162 |
SpawnFakeHealthCrate(1985, 1760, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
163 |
SpawnFakeHealthCrate(2429, 1760, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
164 |
SpawnFakeHealthCrate(2810, 1480, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
165 |
SpawnFakeHealthCrate(2800, 1277, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
166 |
SpawnFakeHealthCrate(2806, 1107, false, false) |
11015 | 167 |
|
168 |
PlaceGirder(1897, 903, 6) |
|
169 |
PlaceGirder(1916, 784, 3) |
|
170 |
PlaceGirder(2010, 732, 4) |
|
171 |
PlaceGirder(2082, 639, 6) |
|
172 |
PlaceGirder(2081, 516, 2) |
|
173 |
PlaceGirder(1985, 487, 4) |
|
174 |
PlaceGirder(1862, 407, 5) |
|
175 |
PlaceGirder(1855, 224, 7) |
|
176 |
PlaceGirder(2006, 163, 4) |
|
177 |
PlaceGirder(2128, 187, 1) |
|
178 |
PlaceGirder(2251, 213, 4) |
|
179 |
PlaceGirder(2413, 213, 4) |
|
180 |
PlaceGirder(1952, 618, 0) |
|
181 |
PlaceGirder(957, 1068, 4) |
|
182 |
PlaceGirder(794, 1069, 4) |
|
183 |
PlaceGirder(728, 1163, 6) |
|
184 |
PlaceGirder(728, 1287, 2) |
|
185 |
PlaceGirder(802, 1342, 4) |
|
186 |
PlaceGirder(966, 1342, 4) |
|
187 |
PlaceGirder(674, 1032, 1) |
|
188 |
PlaceGirder(554, 1011, 4) |
|
189 |
PlaceGirder(445, 1056, 3) |
|
190 |
PlaceGirder(422, 1174, 6) |
|
191 |
PlaceGirder(369, 1341, 5) |
|
192 |
PlaceGirder(495, 1313, 5) |
|
193 |
PlaceGirder(568, 1379, 3) |
|
194 |
PlaceGirder(577, 1202, 2) |
|
195 |
PlaceGirder(744, 1490, 5) |
|
196 |
PlaceGirder(760, 1617, 7) |
|
197 |
PlaceGirder(622, 1693, 4) |
|
198 |
PlaceGirder(476, 1623, 5) |
|
199 |
PlaceGirder(376, 1697, 1) |
|
200 |
PlaceGirder(955, 1746, 2) |
|
201 |
PlaceGirder(1025, 1746, 2) |
|
202 |
PlaceGirder(1090, 1745, 2) |
|
203 |
PlaceGirder(1156, 1746, 2) |
|
204 |
PlaceGirder(3806, 1530, 2) |
|
205 |
PlaceGirder(3880, 1464, 2) |
|
206 |
PlaceGirder(3738, 1458, 2) |
|
207 |
PlaceGirder(3806, 1390, 2) |
|
208 |
PlaceGirder(3805, 1588, 0) |
|
209 |
PlaceGirder(3676, 1609, 3) |
|
210 |
PlaceGirder(3930, 1615, 1) |
|
211 |
PlaceGirder(3719, 1295, 0) |
|
212 |
PlaceGirder(3888, 1294, 0) |
|
213 |
PlaceGirder(3661, 1385, 2) |
|
214 |
PlaceGirder(3955, 1377, 2) |
|
215 |
PlaceGirder(3982, 1518, 0) |
|
216 |
PlaceGirder(3378, 440, 2) |
|
217 |
PlaceGirder(3447, 492, 4) |
|
218 |
PlaceGirder(3564, 529, 1) |
|
219 |
PlaceGirder(3596, 647, 6) |
|
220 |
PlaceGirder(3521, 740, 4) |
|
221 |
PlaceGirder(3524, 838, 4) |
|
222 |
PlaceGirder(3644, 819, 3) |
|
223 |
PlaceGirder(3691, 708, 6) |
|
224 |
PlaceGirder(3690, 545, 6) |
|
225 |
PlaceGirder(3612, 433, 5) |
|
226 |
PlaceGirder(3463, 383, 4) |
|
227 |
PlaceGirder(2815, 122, 7) |
|
228 |
PlaceGirder(2960, 72, 4) |
|
229 |
PlaceGirder(3032, 123, 2) |
|
230 |
PlaceGirder(3063, 174, 0) |
|
231 |
PlaceGirder(3095, 124, 2) |
|
232 |
PlaceGirder(3169, 71, 4) |
|
233 |
PlaceGirder(3320, 124, 5) |
|
234 |
PlaceGirder(3210, 179, 2) |
|
235 |
PlaceGirder(2932, 181, 2) |
|
236 |
||
13066
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
237 |
SpawnFakeHealthCrate(3804, 1461, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
238 |
SpawnFakeHealthCrate(3269, 1742, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
239 |
SpawnFakeHealthCrate(3066, 121, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
240 |
SpawnFakeHealthCrate(3207, 104, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
241 |
SpawnFakeHealthCrate(2928, 103, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
242 |
SpawnFakeHealthCrate(1997, 202, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
243 |
SpawnFakeHealthCrate(2253, 159, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
244 |
SpawnFakeHealthCrate(2132, 774, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
245 |
SpawnFakeHealthCrate(2549, 490, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
246 |
SpawnFakeHealthCrate(3527, 694, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
247 |
SpawnFakeHealthCrate(3777, 78, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
248 |
SpawnFakeHealthCrate(1124, 1746, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
249 |
SpawnFakeHealthCrate(1056, 1740, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
250 |
SpawnFakeHealthCrate(993, 1742, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
251 |
SpawnFakeHealthCrate(799, 1298, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
252 |
SpawnFakeHealthCrate(577, 1126, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
253 |
SpawnFakeHealthCrate(596, 1463, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
254 |
SpawnFakeHealthCrate(3854, 1043, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
255 |
SpawnFakeHealthCrate(1944, 567, false, false) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
256 |
SpawnFakeHealthCrate(338, 1748, false, false) |
11015 | 257 |
|
258 |
end |
|
259 |
||
260 |
function onGameTick20() |
|
261 |
if RCGear ~= nil then |
|
262 |
if(GetTimer(RCGear) < 3000 and planeUhOh == false) then |
|
263 |
PlaySound(sndUhOh, player) |
|
264 |
planeUhOh = true |
|
265 |
end |
|
266 |
planeTimer = planeTimer + 20 |
|
267 |
end |
|
268 |
if commentTimer > 0 then |
|
269 |
commentTimer = commentTimer - 20 |
|
270 |
elseif(nextComment ~= sndNone) then |
|
271 |
PlaySound(nextComment, player) |
|
272 |
nextComment = sndNone |
|
273 |
end |
|
274 |
if missileScanTimer > 0 then |
|
275 |
missileScanTimer = missileScanTimer - 20 |
|
276 |
else |
|
277 |
if crateStreak == 0 and missiles == 3 then |
|
278 |
PlaySound(sndMissed, player) |
|
279 |
missiles = 4 |
|
280 |
end |
|
281 |
end |
|
282 |
end |
|
283 |
||
284 |
function onNewTurn() |
|
13752
110d6c1e817f
Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
285 |
SetTurnTimeLeft(MAX_TURN_TIME) |
11015 | 286 |
end |
287 |
||
288 |
function onGearAdd(gear) |
|
289 |
||
290 |
if GetGearType(gear) == gtRCPlane then |
|
291 |
RCGear = gear |
|
292 |
planesUsed = planesUsed + 1 |
|
14515
cc358e997e32
Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
Wuzzy <Wuzzy2@mail.ru>
parents:
14501
diff
changeset
|
293 |
SetTeamLabel(playerTeamName, tostring(planesUsed)) |
11015 | 294 |
planeTimer = 0 |
295 |
missiles = 0 |
|
296 |
end |
|
297 |
||
298 |
if GetGearType(gear) == gtCase then |
|
299 |
cratesLeft = cratesLeft + 1 |
|
300 |
end |
|
301 |
||
302 |
if GetGearType(gear) == gtAirBomb then |
|
303 |
totalMissiles = totalMissiles + 1 |
|
304 |
end |
|
305 |
end |
|
306 |
||
307 |
function onGearDelete(gear) |
|
308 |
||
309 |
if GetGearType(gear) == gtRCPlane then |
|
310 |
||
311 |
RCGear = nil |
|
312 |
planeUhOh = false |
|
313 |
missiles = 0 |
|
314 |
||
315 |
if(planeTimer < 2000 and crateStreak == 0) then |
|
316 |
nextComment = sndStupid |
|
317 |
commentTimer = math.min(2000-planeTimer, 800) |
|
318 |
elseif(planeTimer < 5000 and crateStreak == 0) then |
|
319 |
PlaySound(sndOops, player) |
|
320 |
elseif(planesUsed == 72) then |
|
321 |
PlaySound(sndStupid, player) |
|
322 |
elseif(planesUsed == 50) then |
|
323 |
PlaySound(sndNutter, player) |
|
324 |
elseif(planesUsed == 30) then |
|
325 |
PlaySound(sndOops, player) |
|
326 |
end |
|
327 |
||
328 |
crateStreak = 0 |
|
329 |
||
330 |
elseif GetGearType(gear) == gtAirBomb then |
|
331 |
missiles = missiles + 1 |
|
332 |
missileScanTimer = 500 |
|
333 |
||
334 |
elseif GetGearType(gear) == gtCase then |
|
335 |
||
336 |
cratesLeft = cratesLeft - 1 |
|
337 |
crateStreak = crateStreak + 1 |
|
338 |
if(crateStreak > longestCrateStreak) then |
|
339 |
longestCrateStreak = crateStreak |
|
340 |
end |
|
341 |
||
13066
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
342 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 then |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
343 |
-- Crate collection sound |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
344 |
PlaySound(sndShotgunReload) |
ad75ed9a1e15
RC Plane Challenge: Switch to using fake crates only
Wuzzy <Wuzzy2@mail.ru>
parents:
13065
diff
changeset
|
345 |
end |
11015 | 346 |
AddCaption(string.format(loc("Crates left: %d"), cratesLeft)) |
347 |
||
348 |
if cratesLeft == 0 then |
|
349 |
||
350 |
local rank = "unknown" |
|
13643 | 351 |
local color = capcolDefault |
11015 | 352 |
local sound = sndVictory |
353 |
if planesUsed >= 156 then |
|
354 |
rank = loc("Destroyer of planes") |
|
355 |
color = 0xD06700FF |
|
356 |
sound = sndLaugh |
|
357 |
elseif planesUsed >= 98 then |
|
358 |
rank = loc("Hopeless case") |
|
359 |
color = 0xFF0000FF |
|
360 |
elseif planesUsed >= 72 then |
|
361 |
rank = loc("Drunk greenhorn") |
|
362 |
color = 0xFF0040FF |
|
363 |
elseif planesUsed >= 50 then |
|
364 |
rank = loc("Greenhorn") -- a.k.a. "absolute beginner" |
|
365 |
color = 0xFF0080FF |
|
366 |
elseif planesUsed >= 39 then |
|
367 |
rank = loc("Beginner") |
|
368 |
color = 0xFF00BFFF |
|
369 |
elseif planesUsed >= 30 then |
|
370 |
rank = loc("Experienced beginner") |
|
371 |
color = 0xFF00CCFF |
|
372 |
elseif planesUsed >= 21 then |
|
373 |
rank = loc("Below-average pilot") |
|
374 |
color = 0xFF00FFFF |
|
375 |
elseif planesUsed >= 17 then |
|
376 |
rank = loc("Average pilot") |
|
377 |
color = 0xBF00FFFF |
|
378 |
elseif planesUsed >= 13 then |
|
379 |
rank = loc("Above-average pilot") |
|
380 |
color = 0x8000FFFF |
|
381 |
elseif planesUsed >= 8 then |
|
382 |
rank = loc("Professional pilot") |
|
383 |
color = 0x4000FFFF |
|
384 |
elseif planesUsed >= 5 then |
|
385 |
rank = loc("Professional stunt pilot") |
|
386 |
color = 0x0000FFFF |
|
387 |
elseif planesUsed >= 3 then |
|
388 |
rank = loc("Elite pilot") |
|
389 |
color = 0x0040FFFF |
|
390 |
elseif planesUsed == 2 then |
|
391 |
rank = loc("Upper-class elite pilot") |
|
392 |
color = 0x0080FFFF |
|
393 |
elseif planesUsed == 1 then |
|
394 |
rank = loc("Top-class elite pilot") |
|
395 |
color = 0x00FFFFFF |
|
396 |
sound = sndFlawless |
|
397 |
else |
|
398 |
rank = loc("Cheater") |
|
399 |
color = 0xFF0000FF |
|
400 |
sound = sndCoward |
|
401 |
end |
|
402 |
AddCaption(string.format(loc("Rank: %s"), rank), color, capgrpMessage2) |
|
403 |
SendStat(siCustomAchievement, string.format(loc("Your rank: %s"), rank)) |
|
404 |
if planesUsed == 1 then |
|
405 |
AddCaption(loc("Flawless victory!")) |
|
406 |
SendStat(siGameResult, loc("You have perfectly beaten the challenge!")) |
|
407 |
SendStat(siCustomAchievement, loc("You have used only 1 RC plane. Outstanding!")) |
|
408 |
else |
|
409 |
AddCaption(loc("Victory!")) |
|
410 |
SendStat(siGameResult, loc("You have finished the challenge!")) |
|
411 |
SendStat(siCustomAchievement, string.format(loc("You have used %d RC planes."), planesUsed)) |
|
412 |
end |
|
14485
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
413 |
SaveMissionVar("Won", "true") |
14496
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14485
diff
changeset
|
414 |
updateChallengeRecord("Lowscore", planesUsed) |
11015 | 415 |
|
416 |
if(totalMissiles > 1) then |
|
417 |
SendStat(siCustomAchievement, string.format(loc("You have dropped %d missiles."), totalMissiles)) |
|
418 |
end |
|
419 |
||
420 |
if(longestCrateStreak > 5) then |
|
421 |
if(planesUsed == 1) then |
|
422 |
SendStat(siCustomAchievement, string.format(loc("In your best (and only) flight you took out %d crates with one RC plane!"), longestCrateStreak)) |
|
423 |
else |
|
424 |
SendStat(siCustomAchievement, string.format(loc("In your best flight you took out %d crates with one RC plane."), longestCrateStreak)) |
|
425 |
end |
|
426 |
end |
|
427 |
||
428 |
if(planesUsed == 2) then |
|
429 |
SendStat(siCustomAchievement, loc("This was an awesome performance! But this challenge can be finished with even just one RC plane. Can you figure out how?")) |
|
430 |
end |
|
431 |
if(planesUsed == 1) then |
|
432 |
SendStat(siCustomAchievement, loc("Congratulations! You have truly mastered this challenge! Don't forget to save the demo.")) |
|
13501
cbda0f842364
Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents:
13066
diff
changeset
|
433 |
awardAchievement(loc("Prestigious Pilot"), nil, false) |
11015 | 434 |
end |
435 |
||
436 |
ShowMission ( |
|
437 |
loc("CHALLENGE COMPLETE"), |
|
438 |
loc("Congratulations!"), |
|
439 |
string.format(loc("Planes used: %d"), planesUsed) .. "|" .. |
|
440 |
"", 0, 0 |
|
441 |
) |
|
442 |
SetState(player, gstWinner) |
|
443 |
PlaySound(sound, player) |
|
444 |
||
445 |
||
14515
cc358e997e32
Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
Wuzzy <Wuzzy2@mail.ru>
parents:
14501
diff
changeset
|
446 |
DismissTeam(playerTeamName) |
11015 | 447 |
EndGame() |
448 |
end |
|
449 |
||
450 |
if RCGear ~= nil then |
|
451 |
SetTimer(RCGear, GetTimer(RCGear) + 10000) |
|
452 |
end |
|
453 |
end |
|
454 |
||
455 |
end |
|
456 |
||
457 |
function onAmmoStoreInit() |
|
458 |
SetAmmo(amRCPlane, 9, 0, 0, 0) |
|
11689 | 459 |
end |
460 |
||
461 |
function onNewTurn() |
|
462 |
SetWeapon(amRCPlane) |
|
463 |
end |