author | Wuzzy <Wuzzy2@mail.ru> |
Sun, 02 Sep 2018 21:26:44 +0200 | |
changeset 13745 | 2bb7141496a9 |
parent 13648 | 690cc84e9fd6 |
child 13759 | 5525f69bf76b |
permissions | -rw-r--r-- |
8043 | 1 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
7889 | 2 |
|
3 |
local hhs = {} |
|
4 |
local missionWon = nil |
|
5 |
local endTimer = 1000 |
|
6 |
local hogsKilled = 0 |
|
11692 | 7 |
local finishTime |
12744
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
8 |
local ouchies = false |
7889 | 9 |
|
10 |
local HogData = { |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
11 |
{"amn", "NinjaFull",false}, |
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
12 |
{"alfadur", "NoHat",false}, |
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
13 |
{"Anachron", "war_americanww2helmet",false}, |
7889 | 14 |
{"Bufon", "ShaggyYeti",false}, |
15 |
{"burp", "lambda",false}, |
|
16 |
{"Blue", "cap_blue",false}, |
|
17 |
{"bender", "NoHat",false}, |
|
18 |
{"Castell", "NoHat",false}, |
|
19 |
{"cekoto", "NoHat",false}, |
|
20 |
{"CheezeMonkey", "NoHat",false}, |
|
21 |
{"claymore", "NoHat",false}, |
|
22 |
{"CIA-144", "cyborg1",false}, |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
23 |
{"cri.the.grinch", "sf_blanka",false}, |
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
24 |
{"eldiablo", "Evil",false}, |
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
25 |
{"Displacer", "fr_lemon",false}, |
13098
403dbadfc8fb
Rope Knock Challenge: Remove trailing space of name "doomy "
Wuzzy <Wuzzy2@mail.ru>
parents:
13072
diff
changeset
|
26 |
{"doomy", "NoHat",false}, |
7889 | 27 |
{"Falkenauge", "NoHat",false}, |
28 |
{"FadeOne", "NoHat",false}, |
|
29 |
{"hayaa", "NoHat",false}, |
|
30 |
{"Hermes", "laurel",false}, |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
31 |
{"Henek", "WizardHat",false}, |
7889 | 32 |
{"HedgeKing", "NoHat",false}, |
33 |
{"Izack1535", "NoHat",false}, |
|
34 |
{"Kiofspa", "NoHat",false}, |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
35 |
{"KoBeWi", "NoHat",false}, |
7889 | 36 |
{"Komplex", "NoHat",false}, |
37 |
{"koda", "poke_mudkip",false}, |
|
38 |
{"Lalo", "NoHat",false}, |
|
39 |
{"Logan", "NoHat",false}, |
|
40 |
{"lollkiller", "NoHat",false}, |
|
41 |
{"Luelle", "NoHat",false}, |
|
42 |
{"mikade", "Skull",false}, |
|
43 |
{"Mushi", "sm_daisy",false}, |
|
44 |
{"Naboo", "NoHat",false}, |
|
45 |
{"nemo", "bb_bub",false}, |
|
46 |
{"practice", "NoHat",false}, |
|
47 |
{"Prof. Panic", "NoHat",false}, |
|
48 |
{"Randy", "zoo_Sheep",false}, |
|
49 |
{"rhino", "NinjaTriangle",false}, |
|
50 |
{"Radissthor", "NoHat",false}, |
|
51 |
{"Sami", "sm_peach",false}, |
|
52 |
{"soreau", "NoHat",false}, |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
53 |
{"Solar", "pinksunhat",false}, |
12775
cf1377ab2f89
Add sparkle's name to Rope Knock Challenge
Wuzzy <Wuzzy2@mail.ru>
parents:
12744
diff
changeset
|
54 |
{"sparkle", "NoHat",false}, |
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
55 |
{"szczur", "mp3",false}, |
7889 | 56 |
{"sdw195", "NoHat",false}, |
57 |
{"sphrix", "TeamTopHat",false}, |
|
58 |
{"sheepluva", "zoo_Sheep",false}, |
|
59 |
{"Smaxx", "NoHat",false}, |
|
60 |
{"shadowzero", "NoHat",false}, |
|
61 |
{"Star and Moon", "SparkleSuperFun",false}, |
|
62 |
{"The 24", "NoHat",false}, |
|
63 |
{"TLD", "NoHat",false}, |
|
64 |
{"Tiyuri", "sf_ryu",false}, |
|
65 |
{"unC0Rr", "cyborg1",false}, |
|
66 |
{"Waldsau", "cyborg1",false}, |
|
67 |
{"wolfmarc", "knight",false}, |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
68 |
{"Wuzzy", "fr_orange",false}, |
7889 | 69 |
{"Xeli", "android",false} |
70 |
||
71 |
} |
|
72 |
||
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
73 |
local playerTeamName = loc("Wannabe Shoppsta") |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
74 |
|
7889 | 75 |
function GenericEnd() |
11692 | 76 |
EndGame() |
7889 | 77 |
end |
78 |
||
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
79 |
function GetKillScore() |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
80 |
return math.ceil((hogsKilled / 16)*6000) |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
81 |
end |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
82 |
|
7889 | 83 |
function GameOverMan() |
84 |
missionWon = false |
|
11692 | 85 |
ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0) |
86 |
SendStat(siGameResult, loc("Challenge over!")) |
|
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
87 |
local score = GetKillScore() |
11692 | 88 |
SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score)) |
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
89 |
SendStat(siPointType, loc("points")) |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
90 |
SendStat(siPlayerKills, tostring(score), playerTeamName) |
7889 | 91 |
PlaySound(sndHellish) |
92 |
end |
|
93 |
||
94 |
function GG() |
|
95 |
missionWon = true |
|
11692 | 96 |
local completeTime = (TurnTime - finishTime) / 1000 |
97 |
ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0) |
|
7889 | 98 |
PlaySound(sndHomerun) |
11692 | 99 |
SendStat(siGameResult, loc("Challenge completed!")) |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
100 |
local hogScore = GetKillScore() |
11692 | 101 |
local timeScore = math.ceil((finishTime/TurnTime)*6000) |
102 |
local score = hogScore + timeScore |
|
103 |
SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore)) |
|
104 |
SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore)) |
|
12743
49c45424a333
Rope knock challenge: Add names of developers and Shoppa tournament players who ranked 1st/2nd/3rd
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
105 |
SendStat(siPointType, loc("points")) |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
106 |
SendStat(siPlayerKills, tostring(score), playerTeamName) |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
107 |
SetTeamLabel(playerTeamName, tostring(score)) |
7889 | 108 |
end |
109 |
||
110 |
function AssignCharacter(p) |
|
111 |
||
112 |
done = false |
|
113 |
sanityCheck = 0 |
|
114 |
||
115 |
while(done == false) do |
|
116 |
||
117 |
i = 1+ GetRandom(#HogData) |
|
118 |
if HogData[i][3] == false then |
|
119 |
HogData[i][3] = true |
|
120 |
done = true |
|
121 |
SetHogName(hhs[p], HogData[i][1]) |
|
122 |
SetHogHat(hhs[p], HogData[i][2]) |
|
123 |
elseif HogData[i][3] == true then |
|
124 |
sanityCheck = sanityCheck +1 |
|
125 |
if sanityCheck == 100 then |
|
126 |
done = true |
|
127 |
SetHogName(hhs[p], "Newbie") |
|
128 |
SetHogHat(hhs[p], "NoHat") |
|
129 |
end |
|
130 |
end |
|
131 |
||
132 |
end |
|
133 |
||
134 |
end |
|
135 |
||
136 |
function onGameInit() |
|
137 |
||
138 |
--Seed = 1 |
|
139 |
GameFlags = gfBorder + gfSolidLand |
|
140 |
||
141 |
TurnTime = 180 * 1000 |
|
142 |
Delay = 500 |
|
143 |
Map = "Ropes" |
|
144 |
Theme = "Eyes" |
|
145 |
||
12229
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
146 |
-- Disable Sudden Death |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
147 |
WaterRise = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
148 |
HealthDecrease = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
149 |
|
7889 | 150 |
CaseFreq = 0 |
151 |
MinesNum = 0 |
|
152 |
Explosives = 0 |
|
153 |
||
13588
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
154 |
AddTeam(playerTeamName, -1, "money", "Island", "Default", "cm_shoppa") |
7889 | 155 |
hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask") |
156 |
SetGearPosition(player, 1380, 1500) |
|
157 |
||
13588
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
158 |
AddTeam(loc("Unsuspecting Louts"), -2, "Simple", "Island", "Default", "cm_face") |
7889 | 159 |
for i = 1, 8 do |
13072
64aba90811a2
Change team colors in rope knock challenge to standard color scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
13070
diff
changeset
|
160 |
-- The name "generic" is a placeholder and will be replaced in AssignCharacter |
7889 | 161 |
hhs[i] = AddHog("generic", 0, 1, "NoHat") |
162 |
end |
|
163 |
||
13588
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
13359
diff
changeset
|
164 |
AddTeam(loc("Unlucky Sods"), -2, "Simple", "Island", "Default", "cm_balrog") |
7889 | 165 |
for i = 9, 16 do |
166 |
hhs[i] = AddHog("generic", 0, 1, "NoHat") |
|
167 |
end |
|
168 |
||
169 |
end |
|
170 |
||
171 |
||
172 |
||
173 |
function onGameStart() |
|
11692 | 174 |
SendHealthStatsOff() |
7889 | 175 |
|
176 |
ShowMission ( |
|
11692 | 177 |
loc("Rope-knocking Challenge"), |
178 |
loc("Challenge"), |
|
7889 | 179 |
loc("Use the rope to knock your enemies to their doom.") .. "|" .. |
11692 | 180 |
loc("Finish this challenge as fast as possible to earn bonus points."), |
181 |
-amRope, 4000) |
|
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
182 |
SetTeamLabel(playerTeamName, "0") |
7889 | 183 |
|
11692 | 184 |
PlaceGirder(46,1783, 0) |
7889 | 185 |
|
186 |
SetGearPosition(hhs[0], 2419, 1769) |
|
187 |
SetGearPosition(hhs[1], 3350, 570) |
|
188 |
SetGearPosition(hhs[2], 3039, 1300) |
|
189 |
SetGearPosition(hhs[3], 2909, 430) |
|
190 |
SetGearPosition(hhs[4], 2150, 879) |
|
191 |
SetGearPosition(hhs[5], 1735, 1136) |
|
192 |
SetGearPosition(hhs[6], 1563, 553) |
|
193 |
SetGearPosition(hhs[7], 679, 859) |
|
194 |
SetGearPosition(hhs[8], 1034, 251) |
|
195 |
SetGearPosition(hhs[9], 255, 67) |
|
196 |
SetGearPosition(hhs[10], 2671, 7) |
|
197 |
SetGearPosition(hhs[11], 2929, 244) |
|
198 |
SetGearPosition(hhs[12], 1946, 221) |
|
199 |
SetGearPosition(hhs[13], 3849, 1067) |
|
200 |
SetGearPosition(hhs[14], 3360, 659) |
|
201 |
SetGearPosition(hhs[15], 3885, 285) |
|
202 |
SetGearPosition(hhs[16], 935, 1160) |
|
203 |
||
204 |
for i = 1, 16 do |
|
205 |
AssignCharacter(i) |
|
206 |
end |
|
207 |
||
208 |
end |
|
209 |
||
210 |
function onGameTick() |
|
211 |
||
212 |
if (TurnTimeLeft == 1) and (missionWon == nil) then |
|
213 |
GameOverMan() |
|
214 |
end |
|
215 |
||
216 |
if missionWon ~= nil then |
|
217 |
||
218 |
endTimer = endTimer - 1 |
|
219 |
if endTimer == 1 then |
|
220 |
GenericEnd() |
|
221 |
end |
|
222 |
||
223 |
if missionWon == true then |
|
13648 | 224 |
AddCaption(loc("Victory!"), capcolDefault, capgrpGameState) |
7889 | 225 |
else |
13648 | 226 |
AddCaption(loc("Challenge over!"), capcolDefault, capgrpGameState) |
7889 | 227 |
end |
228 |
||
229 |
end |
|
230 |
||
231 |
end |
|
232 |
||
233 |
function onGearDamage(gear, damage) |
|
234 |
||
12744
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
235 |
if gear == hhs[0] then |
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
236 |
ouchies = true |
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
237 |
end |
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
238 |
|
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
239 |
if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog and missionWon == nil and ouchies == false then |
7889 | 240 |
|
241 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
242 |
DeleteGear(gear) |
|
243 |
PlaySound(sndExplosion) |
|
13648 | 244 |
AddCaption(string.format(knockTaunt(), GetHogName(gear)), capcolDefault, capgrpMessage) |
7889 | 245 |
|
246 |
hogsKilled = hogsKilled +1 |
|
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
247 |
SetTeamLabel(playerTeamName, tostring(GetKillScore())) |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
248 |
|
7889 | 249 |
if hogsKilled == 15 then |
250 |
PlaySound(sndRideOfTheValkyries) |
|
251 |
elseif hogsKilled == 16 then |
|
11692 | 252 |
finishTime = TurnTimeLeft |
7889 | 253 |
GG() |
254 |
end |
|
255 |
||
256 |
end |
|
257 |
||
258 |
end |
|
259 |
||
11692 | 260 |
function knockTaunt() |
261 |
local r = math.random(0,23) |
|
262 |
local taunt |
|
263 |
if r == 0 then taunt = loc("%s has been knocked out.") |
|
264 |
elseif r == 1 then taunt = loc("%s hit the ground.") |
|
265 |
elseif r == 2 then taunt = loc("%s splatted.") |
|
266 |
elseif r == 3 then taunt = loc("%s was smashed.") |
|
267 |
elseif r == 4 then taunt = loc("%s felt unstable.") |
|
268 |
elseif r == 5 then taunt = loc("%s exploded.") |
|
269 |
elseif r == 6 then taunt = loc("%s fell from a high cliff.") |
|
270 |
elseif r == 7 then taunt = loc("%s goes the way of the lemming.") |
|
271 |
elseif r == 8 then taunt = loc("%s was knocked away.") |
|
272 |
elseif r == 9 then taunt = loc("%s was really unlucky.") |
|
273 |
elseif r == 10 then taunt = loc("%s felt victim to rope-knocking.") |
|
274 |
elseif r == 11 then taunt = loc("%s had no chance.") |
|
275 |
elseif r == 12 then taunt = loc("%s was a good target.") |
|
276 |
elseif r == 13 then taunt = loc("%s spawned at a really bad position.") |
|
277 |
elseif r == 14 then taunt = loc("%s was doomed from the beginning.") |
|
278 |
elseif r == 15 then taunt = loc("%s has fallen victim to gravity.") |
|
279 |
elseif r == 16 then taunt = loc("%s hates Newton.") -- Isaac Newton |
|
280 |
elseif r == 17 then taunt = loc("%s had it coming.") |
|
281 |
elseif r == 18 then taunt = loc("%s is eliminated!") |
|
282 |
elseif r == 19 then taunt = loc("%s fell too fast.") |
|
283 |
elseif r == 20 then taunt = loc("%s flew like a rock.") |
|
13359 | 284 |
elseif r == 21 then taunt = loc("%s stumbled.") |
11692 | 285 |
elseif r == 22 then taunt = loc("%s was shoved away.") |
286 |
elseif r == 23 then taunt = loc("%s didn't expect that.") |
|
287 |
end |
|
288 |
return taunt |
|
289 |
end |
|
290 |
||
7889 | 291 |
function onGearDelete(gear) |
292 |
||
293 |
if (gear == hhs[0]) and (missionWon == nil) then |
|
294 |
GameOverMan() |
|
295 |
end |
|
296 |
||
297 |
end |
|
298 |
||
299 |
function onAmmoStoreInit() |
|
300 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
301 |
end |
|
11694 | 302 |
|
303 |
function onNewTurn() |
|
304 |
SetWeapon(amRope) |
|
305 |
end |