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