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