author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 11 May 2019 04:58:11 +0200 | |
changeset 14917 | 3a53309e684b |
parent 14653 | be8af70adf2c |
child 15496 | 3dc01bbcd0d8 |
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") |
8043 | 2 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
7889 | 3 |
|
4 |
local hhs = {} |
|
5 |
local missionWon = nil |
|
14469
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
6 |
local missionEndHandled = false |
7889 | 7 |
local endTimer = 1000 |
8 |
local hogsKilled = 0 |
|
11692 | 9 |
local finishTime |
12744
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
10 |
local ouchies = false |
13982
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
11 |
local valkyriesTimer = -1 |
7889 | 12 |
|
13 |
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
|
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:
12591
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:
12591
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}, |
|
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
|
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:
12591
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:
12591
diff
changeset
|
28 |
{"Displacer", "fr_lemon",false}, |
13098
403dbadfc8fb
Rope Knock Challenge: Remove trailing space of name "doomy "
Wuzzy <Wuzzy2@mail.ru>
parents:
13072
diff
changeset
|
29 |
{"doomy", "NoHat",false}, |
7889 | 30 |
{"Falkenauge", "NoHat",false}, |
31 |
{"FadeOne", "NoHat",false}, |
|
32 |
{"hayaa", "NoHat",false}, |
|
33 |
{"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
|
34 |
{"Henek", "WizardHat",false}, |
7889 | 35 |
{"HedgeKing", "NoHat",false}, |
36 |
{"Izack1535", "NoHat",false}, |
|
37 |
{"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
|
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}, |
|
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
|
56 |
{"Solar", "pinksunhat",false}, |
12775
cf1377ab2f89
Add sparkle's name to Rope Knock Challenge
Wuzzy <Wuzzy2@mail.ru>
parents:
12744
diff
changeset
|
57 |
{"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
|
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}, |
|
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
|
71 |
{"Wuzzy", "fr_orange",false}, |
7889 | 72 |
{"Xeli", "android",false} |
73 |
||
74 |
} |
|
75 |
||
14489
764ba6182389
Change AddTeam/AddMissionTeam to return real team name and index (in that order)
Wuzzy <Wuzzy2@mail.ru>
parents:
14487
diff
changeset
|
76 |
local playerTeamName |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
77 |
|
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
78 |
function GetKillScore() |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
79 |
return math.ceil((hogsKilled / 16)*6000) |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
80 |
end |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
81 |
|
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
82 |
function ProtectEnemies() |
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
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:
13648
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:
13648
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:
13648
diff
changeset
|
86 |
end |
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
87 |
end |
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
88 |
end |
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
89 |
|
7889 | 90 |
function GameOverMan() |
13982
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
91 |
StopMusicSound(sndRideOfTheValkyries) |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
92 |
valkyriesTimer = -1 |
7889 | 93 |
missionWon = false |
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
94 |
ProtectEnemies() |
11692 | 95 |
SendStat(siGameResult, loc("Challenge over!")) |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
96 |
local score = GetKillScore() |
11692 | 97 |
SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score)) |
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14489
diff
changeset
|
98 |
SendStat(siPointType, "!POINTS") |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
99 |
SendStat(siPlayerKills, tostring(score), playerTeamName) |
14480
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
100 |
|
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
101 |
-- Update highscore |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
102 |
updateChallengeRecord("Highscore", score) |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
103 |
|
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
104 |
EndGame() |
7889 | 105 |
end |
106 |
||
107 |
function GG() |
|
108 |
missionWon = true |
|
11692 | 109 |
local completeTime = (TurnTime - finishTime) / 1000 |
110 |
ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0) |
|
7889 | 111 |
PlaySound(sndHomerun) |
11692 | 112 |
SendStat(siGameResult, loc("Challenge completed!")) |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
113 |
local hogScore = GetKillScore() |
11692 | 114 |
local timeScore = math.ceil((finishTime/TurnTime)*6000) |
115 |
local score = hogScore + timeScore |
|
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
116 |
|
11692 | 117 |
SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore)) |
118 |
SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore)) |
|
14583
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14489
diff
changeset
|
119 |
SendStat(siPointType, "!POINTS") |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
120 |
SendStat(siPlayerKills, tostring(score), playerTeamName) |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
121 |
SetTeamLabel(playerTeamName, tostring(score)) |
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
122 |
|
14480
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
123 |
-- Update highscore |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
124 |
updateChallengeRecord("Highscore", score) |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
125 |
|
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
126 |
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:
13648
diff
changeset
|
127 |
SetEffect(hhs[0], heInvulnerable, 1) |
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
128 |
end |
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
129 |
SetTurnTimeLeft(MAX_TURN_TIME) |
7889 | 130 |
end |
131 |
||
132 |
function AssignCharacter(p) |
|
133 |
||
134 |
done = false |
|
135 |
sanityCheck = 0 |
|
136 |
||
137 |
while(done == false) do |
|
138 |
||
139 |
i = 1+ GetRandom(#HogData) |
|
140 |
if HogData[i][3] == false then |
|
141 |
HogData[i][3] = true |
|
142 |
done = true |
|
143 |
SetHogName(hhs[p], HogData[i][1]) |
|
144 |
SetHogHat(hhs[p], HogData[i][2]) |
|
145 |
elseif HogData[i][3] == true then |
|
146 |
sanityCheck = sanityCheck +1 |
|
147 |
if sanityCheck == 100 then |
|
148 |
done = true |
|
149 |
SetHogName(hhs[p], "Newbie") |
|
150 |
SetHogHat(hhs[p], "NoHat") |
|
151 |
end |
|
152 |
end |
|
153 |
||
154 |
end |
|
155 |
||
156 |
end |
|
157 |
||
158 |
function onGameInit() |
|
159 |
||
160 |
--Seed = 1 |
|
161 |
GameFlags = gfBorder + gfSolidLand |
|
162 |
||
163 |
TurnTime = 180 * 1000 |
|
164 |
Map = "Ropes" |
|
165 |
Theme = "Eyes" |
|
166 |
||
12229
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
167 |
-- Disable Sudden Death |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
168 |
WaterRise = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
169 |
HealthDecrease = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
170 |
|
7889 | 171 |
CaseFreq = 0 |
172 |
MinesNum = 0 |
|
173 |
Explosives = 0 |
|
174 |
||
14489
764ba6182389
Change AddTeam/AddMissionTeam to return real team name and index (in that order)
Wuzzy <Wuzzy2@mail.ru>
parents:
14487
diff
changeset
|
175 |
playerTeamName = AddMissionTeam(-1) |
14487
d4aa64f51c9f
Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14480
diff
changeset
|
176 |
hhs[0] = AddMissionHog(1) |
7889 | 177 |
|
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
|
178 |
AddTeam(loc("Unsuspecting Louts"), -2, "Simple", "Island", "Default", "cm_face") |
7889 | 179 |
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
|
180 |
-- The name "generic" is a placeholder and will be replaced in AssignCharacter |
7889 | 181 |
hhs[i] = AddHog("generic", 0, 1, "NoHat") |
182 |
end |
|
183 |
||
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
|
184 |
AddTeam(loc("Unlucky Sods"), -2, "Simple", "Island", "Default", "cm_balrog") |
7889 | 185 |
for i = 9, 16 do |
186 |
hhs[i] = AddHog("generic", 0, 1, "NoHat") |
|
187 |
end |
|
188 |
||
189 |
end |
|
190 |
||
191 |
||
192 |
||
193 |
function onGameStart() |
|
11692 | 194 |
SendHealthStatsOff() |
7889 | 195 |
|
14480
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
196 |
local recordInfo = getReadableChallengeRecord("Highscore") |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
197 |
if recordInfo == nil then |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
198 |
recordInfo = "" |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
199 |
else |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
200 |
recordInfo = "|" .. recordInfo |
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
201 |
end |
7889 | 202 |
ShowMission ( |
11692 | 203 |
loc("Rope-knocking Challenge"), |
204 |
loc("Challenge"), |
|
7889 | 205 |
loc("Use the rope to knock your enemies to their doom.") .. "|" .. |
14480
2113296b7a29
Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
206 |
loc("Finish this challenge as fast as possible to earn bonus points.").. recordInfo, |
11692 | 207 |
-amRope, 4000) |
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
208 |
SetTeamLabel(playerTeamName, "0") |
7889 | 209 |
|
11692 | 210 |
PlaceGirder(46,1783, 0) |
7889 | 211 |
|
212 |
SetGearPosition(hhs[0], 2419, 1769) |
|
213 |
SetGearPosition(hhs[1], 3350, 570) |
|
214 |
SetGearPosition(hhs[2], 3039, 1300) |
|
215 |
SetGearPosition(hhs[3], 2909, 430) |
|
216 |
SetGearPosition(hhs[4], 2150, 879) |
|
217 |
SetGearPosition(hhs[5], 1735, 1136) |
|
218 |
SetGearPosition(hhs[6], 1563, 553) |
|
219 |
SetGearPosition(hhs[7], 679, 859) |
|
220 |
SetGearPosition(hhs[8], 1034, 251) |
|
221 |
SetGearPosition(hhs[9], 255, 67) |
|
222 |
SetGearPosition(hhs[10], 2671, 7) |
|
223 |
SetGearPosition(hhs[11], 2929, 244) |
|
224 |
SetGearPosition(hhs[12], 1946, 221) |
|
225 |
SetGearPosition(hhs[13], 3849, 1067) |
|
226 |
SetGearPosition(hhs[14], 3360, 659) |
|
227 |
SetGearPosition(hhs[15], 3885, 285) |
|
228 |
SetGearPosition(hhs[16], 935, 1160) |
|
14653
be8af70adf2c
Tweak hog spawn height and facing direction in challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
14595
diff
changeset
|
229 |
HogTurnLeft(hhs[0], true) |
7889 | 230 |
|
231 |
for i = 1, 16 do |
|
232 |
AssignCharacter(i) |
|
233 |
end |
|
234 |
||
235 |
end |
|
236 |
||
237 |
function onGameTick() |
|
238 |
||
239 |
if (TurnTimeLeft == 1) and (missionWon == nil) then |
|
240 |
GameOverMan() |
|
241 |
end |
|
242 |
||
243 |
if missionWon ~= nil then |
|
244 |
||
245 |
endTimer = endTimer - 1 |
|
246 |
if endTimer == 1 then |
|
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
247 |
EndGame() |
7889 | 248 |
end |
249 |
||
14469
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
250 |
if not missionEndHandled then |
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
251 |
if missionWon == true then |
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
252 |
SaveMissionVar("Won", "true") |
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
253 |
AddCaption(loc("Victory!"), capcolDefault, capgrpGameState) |
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
254 |
end |
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
255 |
missionEndHandled = true |
7889 | 256 |
end |
257 |
||
258 |
end |
|
259 |
||
260 |
end |
|
261 |
||
13982
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
262 |
function onGameTick20() |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
263 |
if (valkyriesTimer > 0) then |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
264 |
valkyriesTimer = valkyriesTimer - 20 |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
265 |
if valkyriesTimer <= 0 then |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
266 |
StopMusicSound(sndRideOfTheValkyries) |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
267 |
end |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
268 |
end |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
269 |
end |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
270 |
|
7889 | 271 |
function onGearDamage(gear, damage) |
272 |
||
12744
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
273 |
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
|
274 |
ouchies = true |
13982
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
275 |
StopMusicSound(sndRideOfTheValkyries) |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
276 |
valkyriesTimer = -1 |
13759
5525f69bf76b
Fix stats screwing up in Rope Knock Challenge if you lose
Wuzzy <Wuzzy2@mail.ru>
parents:
13648
diff
changeset
|
277 |
ProtectEnemies() |
12744
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
278 |
end |
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
279 |
|
2f873afda0e2
Rope Knock Challenge: Don't count hog kills after hero hurt itself
Wuzzy <Wuzzy2@mail.ru>
parents:
12743
diff
changeset
|
280 |
if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog and missionWon == nil and ouchies == false then |
7889 | 281 |
|
282 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
283 |
DeleteGear(gear) |
|
284 |
PlaySound(sndExplosion) |
|
13648 | 285 |
AddCaption(string.format(knockTaunt(), GetHogName(gear)), capcolDefault, capgrpMessage) |
7889 | 286 |
|
287 |
hogsKilled = hogsKilled +1 |
|
13070
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
288 |
SetTeamLabel(playerTeamName, tostring(GetKillScore())) |
a297e06d1607
Display score next to team bar in singleplayer challenges
Wuzzy <Wuzzy2@mail.ru>
parents:
12775
diff
changeset
|
289 |
|
7889 | 290 |
if hogsKilled == 15 then |
13982
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
291 |
PlayMusicSound(sndRideOfTheValkyries) |
e340ce5500d7
Properly play Valkyries music in Rope Knock Challenge (no more music overlap)
Wuzzy <Wuzzy2@mail.ru>
parents:
13759
diff
changeset
|
292 |
-- 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:
13759
diff
changeset
|
293 |
valkyriesTimer = 20000 |
7889 | 294 |
elseif hogsKilled == 16 then |
11692 | 295 |
finishTime = TurnTimeLeft |
7889 | 296 |
GG() |
297 |
end |
|
298 |
||
299 |
end |
|
300 |
||
301 |
end |
|
302 |
||
11692 | 303 |
function knockTaunt() |
304 |
local r = math.random(0,23) |
|
305 |
local taunt |
|
306 |
if r == 0 then taunt = loc("%s has been knocked out.") |
|
307 |
elseif r == 1 then taunt = loc("%s hit the ground.") |
|
308 |
elseif r == 2 then taunt = loc("%s splatted.") |
|
309 |
elseif r == 3 then taunt = loc("%s was smashed.") |
|
310 |
elseif r == 4 then taunt = loc("%s felt unstable.") |
|
311 |
elseif r == 5 then taunt = loc("%s exploded.") |
|
312 |
elseif r == 6 then taunt = loc("%s fell from a high cliff.") |
|
313 |
elseif r == 7 then taunt = loc("%s goes the way of the lemming.") |
|
314 |
elseif r == 8 then taunt = loc("%s was knocked away.") |
|
315 |
elseif r == 9 then taunt = loc("%s was really unlucky.") |
|
316 |
elseif r == 10 then taunt = loc("%s felt victim to rope-knocking.") |
|
317 |
elseif r == 11 then taunt = loc("%s had no chance.") |
|
318 |
elseif r == 12 then taunt = loc("%s was a good target.") |
|
319 |
elseif r == 13 then taunt = loc("%s spawned at a really bad position.") |
|
320 |
elseif r == 14 then taunt = loc("%s was doomed from the beginning.") |
|
321 |
elseif r == 15 then taunt = loc("%s has fallen victim to gravity.") |
|
322 |
elseif r == 16 then taunt = loc("%s hates Newton.") -- Isaac Newton |
|
323 |
elseif r == 17 then taunt = loc("%s had it coming.") |
|
324 |
elseif r == 18 then taunt = loc("%s is eliminated!") |
|
325 |
elseif r == 19 then taunt = loc("%s fell too fast.") |
|
326 |
elseif r == 20 then taunt = loc("%s flew like a rock.") |
|
13359 | 327 |
elseif r == 21 then taunt = loc("%s stumbled.") |
11692 | 328 |
elseif r == 22 then taunt = loc("%s was shoved away.") |
329 |
elseif r == 23 then taunt = loc("%s didn't expect that.") |
|
330 |
end |
|
331 |
return taunt |
|
332 |
end |
|
333 |
||
7889 | 334 |
function onGearDelete(gear) |
335 |
||
336 |
if (gear == hhs[0]) and (missionWon == nil) then |
|
337 |
GameOverMan() |
|
338 |
end |
|
339 |
||
340 |
end |
|
341 |
||
342 |
function onAmmoStoreInit() |
|
343 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
344 |
end |
|
11694 | 345 |
|
346 |
function onNewTurn() |
|
347 |
SetWeapon(amRope) |
|
348 |
end |