author | Wuzzy <almikes@aol.com> |
Tue, 11 Apr 2017 02:44:59 +0200 | |
changeset 12224 | d62d6f8ebef1 |
parent 11968 | 1de4d6b35748 |
child 12586 | 7510fe66bfbb |
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 |
|
11687 | 7 |
local finishTime |
7889 | 8 |
|
9 |
local HogData = { |
|
10 |
{"Bufon", "ShaggyYeti",false}, |
|
11 |
{"burp", "lambda",false}, |
|
12 |
{"Blue", "cap_blue",false}, |
|
13 |
{"bender", "NoHat",false}, |
|
14 |
{"Castell", "NoHat",false}, |
|
15 |
{"cekoto", "NoHat",false}, |
|
16 |
{"CheezeMonkey", "NoHat",false}, |
|
17 |
{"claymore", "NoHat",false}, |
|
18 |
{"CIA-144", "cyborg1",false}, |
|
19 |
{"doomy ", "NoHat",false}, |
|
20 |
{"Falkenauge", "NoHat",false}, |
|
21 |
{"FadeOne", "NoHat",false}, |
|
22 |
{"hayaa", "NoHat",false}, |
|
23 |
{"Hermes", "laurel",false}, |
|
24 |
{"HedgeKing", "NoHat",false}, |
|
25 |
{"Izack1535", "NoHat",false}, |
|
26 |
{"Kiofspa", "NoHat",false}, |
|
27 |
{"Komplex", "NoHat",false}, |
|
28 |
{"koda", "poke_mudkip",false}, |
|
29 |
{"Lalo", "NoHat",false}, |
|
30 |
{"Logan", "NoHat",false}, |
|
31 |
{"lollkiller", "NoHat",false}, |
|
32 |
{"Luelle", "NoHat",false}, |
|
33 |
{"mikade", "Skull",false}, |
|
34 |
{"Mushi", "sm_daisy",false}, |
|
35 |
{"Naboo", "NoHat",false}, |
|
36 |
{"nemo", "bb_bub",false}, |
|
37 |
{"practice", "NoHat",false}, |
|
38 |
{"Prof. Panic", "NoHat",false}, |
|
39 |
{"Randy", "zoo_Sheep",false}, |
|
40 |
{"rhino", "NinjaTriangle",false}, |
|
41 |
{"Radissthor", "NoHat",false}, |
|
42 |
{"Sami", "sm_peach",false}, |
|
43 |
{"soreau", "NoHat",false}, |
|
44 |
{"sdw195", "NoHat",false}, |
|
45 |
{"sphrix", "TeamTopHat",false}, |
|
46 |
{"sheepluva", "zoo_Sheep",false}, |
|
47 |
{"Smaxx", "NoHat",false}, |
|
48 |
{"shadowzero", "NoHat",false}, |
|
49 |
{"Star and Moon", "SparkleSuperFun",false}, |
|
50 |
{"The 24", "NoHat",false}, |
|
51 |
{"TLD", "NoHat",false}, |
|
52 |
{"Tiyuri", "sf_ryu",false}, |
|
53 |
{"unC0Rr", "cyborg1",false}, |
|
54 |
{"Waldsau", "cyborg1",false}, |
|
55 |
{"wolfmarc", "knight",false}, |
|
56 |
{"Xeli", "android",false} |
|
57 |
||
58 |
} |
|
59 |
||
60 |
function GenericEnd() |
|
11687 | 61 |
EndGame() |
7889 | 62 |
end |
63 |
||
64 |
function GameOverMan() |
|
65 |
missionWon = false |
|
11687 | 66 |
ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0) |
67 |
SendStat(siGameResult, loc("Challenge over!")) |
|
68 |
local score = math.ceil((hogsKilled / 16)*6000) |
|
69 |
SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score)) |
|
70 |
SendStat(siPointType, "points") |
|
71 |
SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta")) |
|
7889 | 72 |
PlaySound(sndHellish) |
73 |
end |
|
74 |
||
75 |
function GG() |
|
76 |
missionWon = true |
|
11687 | 77 |
local completeTime = (TurnTime - finishTime) / 1000 |
78 |
ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0) |
|
7889 | 79 |
PlaySound(sndHomerun) |
11687 | 80 |
SendStat(siGameResult, loc("Challenge completed!")) |
81 |
local hogScore = math.ceil((hogsKilled / 16)*6000) |
|
82 |
local timeScore = math.ceil((finishTime/TurnTime)*6000) |
|
83 |
local score = hogScore + timeScore |
|
84 |
SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore)) |
|
85 |
SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore)) |
|
86 |
SendStat(siPointType, "points") |
|
87 |
SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta")) |
|
7889 | 88 |
end |
89 |
||
90 |
function AssignCharacter(p) |
|
91 |
||
92 |
done = false |
|
93 |
sanityCheck = 0 |
|
94 |
||
95 |
while(done == false) do |
|
96 |
||
97 |
i = 1+ GetRandom(#HogData) |
|
98 |
if HogData[i][3] == false then |
|
99 |
HogData[i][3] = true |
|
100 |
done = true |
|
101 |
SetHogName(hhs[p], HogData[i][1]) |
|
102 |
SetHogHat(hhs[p], HogData[i][2]) |
|
103 |
elseif HogData[i][3] == true then |
|
104 |
sanityCheck = sanityCheck +1 |
|
105 |
if sanityCheck == 100 then |
|
106 |
done = true |
|
107 |
SetHogName(hhs[p], "Newbie") |
|
108 |
SetHogHat(hhs[p], "NoHat") |
|
109 |
end |
|
110 |
end |
|
111 |
||
112 |
end |
|
113 |
||
114 |
end |
|
115 |
||
116 |
function onGameInit() |
|
117 |
||
118 |
--Seed = 1 |
|
119 |
GameFlags = gfBorder + gfSolidLand |
|
120 |
||
121 |
TurnTime = 180 * 1000 |
|
122 |
Delay = 500 |
|
123 |
Map = "Ropes" |
|
124 |
Theme = "Eyes" |
|
125 |
||
12224
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
126 |
-- Disable Sudden Death |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
127 |
WaterRise = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
128 |
HealthDecrease = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
129 |
|
7889 | 130 |
CaseFreq = 0 |
131 |
MinesNum = 0 |
|
132 |
Explosives = 0 |
|
133 |
||
11687 | 134 |
AddTeam(loc("Wannabe Shoppsta"), 0x11F12B, "Simple", "Island", "Default", "cm_shoppa") |
7889 | 135 |
hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask") |
136 |
SetGearPosition(player, 1380, 1500) |
|
137 |
||
11687 | 138 |
AddTeam(loc("Unsuspecting Louts"), 0xDD0000, "Simple", "Island", "Default", "cm_face") |
7889 | 139 |
for i = 1, 8 do |
140 |
hhs[i] = AddHog("generic", 0, 1, "NoHat") |
|
141 |
end |
|
142 |
||
11687 | 143 |
AddTeam(loc("Unlucky Sods"), 0xDD0000, "Simple", "Island", "Default", "cm_balrog") |
7889 | 144 |
for i = 9, 16 do |
145 |
hhs[i] = AddHog("generic", 0, 1, "NoHat") |
|
146 |
end |
|
147 |
||
148 |
end |
|
149 |
||
150 |
||
151 |
||
152 |
function onGameStart() |
|
11687 | 153 |
SendHealthStatsOff() |
7889 | 154 |
|
155 |
ShowMission ( |
|
11687 | 156 |
loc("Rope-knocking Challenge"), |
157 |
loc("Challenge"), |
|
7889 | 158 |
loc("Use the rope to knock your enemies to their doom.") .. "|" .. |
11687 | 159 |
loc("Finish this challenge as fast as possible to earn bonus points."), |
160 |
-amRope, 4000) |
|
7889 | 161 |
|
11687 | 162 |
PlaceGirder(46,1783, 0) |
7889 | 163 |
|
164 |
SetGearPosition(hhs[0], 2419, 1769) |
|
165 |
SetGearPosition(hhs[1], 3350, 570) |
|
166 |
SetGearPosition(hhs[2], 3039, 1300) |
|
167 |
SetGearPosition(hhs[3], 2909, 430) |
|
168 |
SetGearPosition(hhs[4], 2150, 879) |
|
169 |
SetGearPosition(hhs[5], 1735, 1136) |
|
170 |
SetGearPosition(hhs[6], 1563, 553) |
|
171 |
SetGearPosition(hhs[7], 679, 859) |
|
172 |
SetGearPosition(hhs[8], 1034, 251) |
|
173 |
SetGearPosition(hhs[9], 255, 67) |
|
174 |
SetGearPosition(hhs[10], 2671, 7) |
|
175 |
SetGearPosition(hhs[11], 2929, 244) |
|
176 |
SetGearPosition(hhs[12], 1946, 221) |
|
177 |
SetGearPosition(hhs[13], 3849, 1067) |
|
178 |
SetGearPosition(hhs[14], 3360, 659) |
|
179 |
SetGearPosition(hhs[15], 3885, 285) |
|
180 |
SetGearPosition(hhs[16], 935, 1160) |
|
181 |
||
182 |
for i = 1, 16 do |
|
183 |
AssignCharacter(i) |
|
184 |
end |
|
185 |
||
186 |
end |
|
187 |
||
188 |
function onGameTick() |
|
189 |
||
190 |
if (TurnTimeLeft == 1) and (missionWon == nil) then |
|
191 |
GameOverMan() |
|
192 |
end |
|
193 |
||
194 |
if missionWon ~= nil then |
|
195 |
||
196 |
endTimer = endTimer - 1 |
|
197 |
if endTimer == 1 then |
|
198 |
GenericEnd() |
|
199 |
end |
|
200 |
||
201 |
if missionWon == true then |
|
11687 | 202 |
AddCaption(loc("Victory!"), 0xFFFFFFFF,capgrpGameState) |
7889 | 203 |
else |
11687 | 204 |
AddCaption(loc("Challenge over!"), 0xFFFFFFFF,capgrpGameState) |
7889 | 205 |
end |
206 |
||
207 |
end |
|
208 |
||
209 |
end |
|
210 |
||
211 |
function onGearDamage(gear, damage) |
|
212 |
||
11687 | 213 |
if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog then |
7889 | 214 |
|
215 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
216 |
DeleteGear(gear) |
|
217 |
PlaySound(sndExplosion) |
|
11687 | 218 |
AddCaption(string.format(knockTaunt(), GetHogName(gear)), 0xFFFFFFFF, capgrpMessage) |
7889 | 219 |
|
220 |
hogsKilled = hogsKilled +1 |
|
221 |
if hogsKilled == 15 then |
|
222 |
PlaySound(sndRideOfTheValkyries) |
|
223 |
elseif hogsKilled == 16 then |
|
11687 | 224 |
finishTime = TurnTimeLeft |
7889 | 225 |
GG() |
226 |
end |
|
227 |
||
228 |
end |
|
229 |
||
230 |
end |
|
231 |
||
11687 | 232 |
function knockTaunt() |
233 |
local r = math.random(0,23) |
|
234 |
local taunt |
|
235 |
if r == 0 then taunt = loc("%s has been knocked out.") |
|
236 |
elseif r == 1 then taunt = loc("%s hit the ground.") |
|
237 |
elseif r == 2 then taunt = loc("%s splatted.") |
|
238 |
elseif r == 3 then taunt = loc("%s was smashed.") |
|
239 |
elseif r == 4 then taunt = loc("%s felt unstable.") |
|
240 |
elseif r == 5 then taunt = loc("%s exploded.") |
|
241 |
elseif r == 6 then taunt = loc("%s fell from a high cliff.") |
|
242 |
elseif r == 7 then taunt = loc("%s goes the way of the lemming.") |
|
243 |
elseif r == 8 then taunt = loc("%s was knocked away.") |
|
244 |
elseif r == 9 then taunt = loc("%s was really unlucky.") |
|
245 |
elseif r == 10 then taunt = loc("%s felt victim to rope-knocking.") |
|
246 |
elseif r == 11 then taunt = loc("%s had no chance.") |
|
247 |
elseif r == 12 then taunt = loc("%s was a good target.") |
|
248 |
elseif r == 13 then taunt = loc("%s spawned at a really bad position.") |
|
249 |
elseif r == 14 then taunt = loc("%s was doomed from the beginning.") |
|
250 |
elseif r == 15 then taunt = loc("%s has fallen victim to gravity.") |
|
251 |
elseif r == 16 then taunt = loc("%s hates Newton.") -- Isaac Newton |
|
252 |
elseif r == 17 then taunt = loc("%s had it coming.") |
|
253 |
elseif r == 18 then taunt = loc("%s is eliminated!") |
|
254 |
elseif r == 19 then taunt = loc("%s fell too fast.") |
|
255 |
elseif r == 20 then taunt = loc("%s flew like a rock.") |
|
256 |
elseif r == 21 then taunt = loc("%s stumpled.") |
|
257 |
elseif r == 22 then taunt = loc("%s was shoved away.") |
|
258 |
elseif r == 23 then taunt = loc("%s didn't expect that.") |
|
259 |
end |
|
260 |
return taunt |
|
261 |
end |
|
262 |
||
7889 | 263 |
function onGearDelete(gear) |
264 |
||
265 |
if (gear == hhs[0]) and (missionWon == nil) then |
|
266 |
GameOverMan() |
|
267 |
end |
|
268 |
||
269 |
end |
|
270 |
||
271 |
function onAmmoStoreInit() |
|
272 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
273 |
end |
|
11689 | 274 |
|
275 |
function onNewTurn() |
|
276 |
SetWeapon(amRope) |
|
277 |
end |