author | mikade |
Tue, 22 Feb 2011 18:51:22 +0200 | |
changeset 4953 | ebd3dae634ca |
parent 4871 | 4a99a45ea886 |
child 5325 | 261b79ba22b1 |
permissions | -rw-r--r-- |
4786 | 1 |
-------------------------------- |
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
2 |
-- CTF_BLIZZARD 0.8 |
4786 | 3 |
-------------------------------- |
4 |
||
5 |
--------- |
|
6 |
-- 0.2 |
|
7 |
--------- |
|
8 |
||
9 |
-- disabled super weapons |
|
10 |
||
11 |
-- theme modifications |
|
12 |
||
13 |
-- improved hog placement system: teams can now be put |
|
14 |
-- in any order and be of any size |
|
15 |
||
16 |
--------- |
|
17 |
-- 0.3 |
|
18 |
--------- |
|
19 |
||
20 |
-- In this version: |
|
21 |
||
22 |
-- changed starting weapons |
|
23 |
-- changed crate drop contents and rate of drops |
|
24 |
||
25 |
-- completely removed super weapons and super weapon scripts |
|
26 |
||
27 |
-- removed custom respawning |
|
28 |
-- removed set respawn points |
|
29 |
||
30 |
-- added AIRespawn-esque respawning |
|
31 |
-- added simple left vs right respawn points |
|
32 |
||
33 |
-- added non-lethal poison to flag carriers as an indicator |
|
34 |
||
35 |
-- improved flag mechanics and player-flag feedback |
|
36 |
-- flag now instantly respawns if you kill enemy hog and return it, |
|
37 |
-- or if the flag falls in water, _BUT_ not if it is blown up |
|
38 |
||
39 |
--------- |
|
40 |
-- 0.4 |
|
41 |
--------- |
|
42 |
||
43 |
-- tweaked crate drop rates and crate contents |
|
44 |
-- improved the teleporters, they should now be able to handle rope... hopefully |
|
45 |
-- updated SetEffect calls to be in line with 0.9.15 definitions |
|
46 |
-- added visual gears when hogs respawn |
|
47 |
-- added visual gears when hogs teleport |
|
48 |
-- added visual gear to track flag and flag carriers |
|
49 |
-- removed poisoning of flag carriers |
|
50 |
-- removed health adjustments for flag carriers due to aforementioned poisons |
|
51 |
||
52 |
--------- |
|
53 |
-- 0.5 |
|
54 |
--------- |
|
55 |
||
56 |
-- added translation support, hopefully |
|
57 |
-- added ctf rules |
|
58 |
-- added effects to the teleporters |
|
59 |
-- added aura round spawning area |
|
60 |
-- changed the aura around the flag carrier / flag to an aura and added some support for this |
|
61 |
-- changed things so the seed is no longer always the same... |
|
62 |
||
4843 | 63 |
--------- |
64 |
-- 0.6 |
|
65 |
--------- |
|
66 |
||
67 |
-- removed branding and version number |
|
68 |
-- removed teleport from starting weapons |
|
69 |
-- increased captures to 3 |
|
4786 | 70 |
|
4871 | 71 |
----------- |
72 |
-- 0.7 |
|
73 |
------------ |
|
74 |
||
75 |
-- hopefully fixed a bug with the teleporters |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
76 |
-- added a fix for crate possibly getting imbedded in land when it was near the water line |
4871 | 77 |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
78 |
----------- |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
79 |
-- 0.8 |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
80 |
------------ |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
81 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
82 |
-- fixed version control fail with missing check on onGearDelete |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
83 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
84 |
-- changed hog placements code so that they start in the same place for both teams |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
85 |
-- and hogs move in the same order, not backwards to each other. |
4871 | 86 |
|
4786 | 87 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
88 |
||
89 |
--------------------------------------------------------------- |
|
90 |
----------lots of bad variables and things |
|
91 |
----------because someone is too lazy |
|
92 |
----------to read about tables properly |
|
93 |
------------------ "Oh well, they probably have the memory" |
|
94 |
||
95 |
local actionReset = 0 -- used in CheckTeleporters() |
|
96 |
||
97 |
local roundsCounter = 0 -- used to determine when to spawn more crates |
|
98 |
-- currently every 6 TURNS, should this work |
|
99 |
-- on ROUNDS instead? |
|
100 |
local effectTimer = 0 |
|
101 |
||
4871 | 102 |
local ropeGear = nil |
103 |
||
4786 | 104 |
-------------------------- |
105 |
-- hog and team tracking variales |
|
106 |
-------------------------- |
|
107 |
||
108 |
local numhhs = 0 -- store number of hedgehogs |
|
109 |
local hhs = {} -- store hedgehog gears |
|
110 |
||
111 |
local numTeams -- store the number of teams in the game |
|
112 |
local teamNameArr = {} -- store the list of teams |
|
113 |
local teamSize = {} -- store how many hogs per team |
|
114 |
local teamIndex = {} -- at what point in the hhs{} does each team begin |
|
115 |
||
116 |
------------------- |
|
117 |
-- flag variables |
|
118 |
------------------- |
|
119 |
||
120 |
local fGear = {} -- pointer to the case gears that represent the flag |
|
121 |
local fThief = {} -- pointer to the hogs who stole the flags |
|
122 |
local fIsMissing = {} -- have the flags been destroyed or captured |
|
123 |
local fNeedsRespawn = {} -- do the flags need to be respawned |
|
124 |
local fCaptures = {} -- the team "scores" how many captures |
|
125 |
local fSpawnX = {} -- spawn X for flags |
|
126 |
local fSpawnY = {} -- spawn Y for flags |
|
127 |
||
128 |
local fThiefX = {} |
|
129 |
local fThiefY = {} |
|
130 |
local FTTC = 0 -- flag thief tracker counter |
|
131 |
--local fThiefsHealed = false |
|
132 |
||
133 |
local fSpawnC = {} |
|
134 |
local fCirc = {} -- flag/carrier marker circles |
|
135 |
local fCol = {} -- colour of the clans |
|
136 |
||
137 |
local vCircX = {} |
|
138 |
local vCircY = {} |
|
139 |
local vCircMinA = {} |
|
140 |
local vCircMaxA = {} |
|
141 |
local vCircType = {} |
|
142 |
local vCircPulse = {} |
|
143 |
local vCircFuckAll = {} |
|
144 |
local vCircRadius = {} |
|
145 |
local vCircWidth = {} |
|
146 |
local vCircCol = {} |
|
147 |
||
148 |
||
149 |
-------------------------------- |
|
150 |
--zone and teleporter variables |
|
151 |
-------------------------------- |
|
152 |
||
153 |
local redTel |
|
154 |
local orangeTel |
|
155 |
--local areaArr = {} -- no longer used |
|
156 |
||
157 |
local zXMin = {} |
|
158 |
local zWidth = {} |
|
159 |
local zYMin = {} |
|
160 |
local zHeight = {} |
|
161 |
local zOccupied = {} |
|
162 |
local zCount = 0 |
|
163 |
||
164 |
------------------------ |
|
165 |
-- zone methods |
|
166 |
------------------------ |
|
167 |
-- see on gameTick also |
|
168 |
||
169 |
function ManageTeleporterEffects() |
|
170 |
effectTimer = effectTimer + 1 |
|
171 |
if effectTimer > 50 then -- 100 |
|
172 |
effectTimer = 0 |
|
4843 | 173 |
|
174 |
for i = 0,1 do |
|
4786 | 175 |
eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10) |
176 |
eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110) |
|
177 |
||
4843 | 178 |
-- steam and smoke and DUST look good, smokering looks trippy |
4786 | 179 |
-- smoketrace and eviltrace are not effected by wind? |
180 |
-- chunk is a LR falling gear |
|
181 |
tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
|
182 |
if tempE ~= 0 then |
|
183 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
184 |
SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, g8, g9, fCol[i]) |
|
185 |
end |
|
186 |
end |
|
4843 | 187 |
end |
4786 | 188 |
end |
189 |
||
190 |
function CreateZone(xMin, yMin, width, height) |
|
191 |
||
192 |
||
193 |
zXMin[zCount] = xMin |
|
194 |
zYMin[zCount] = yMin |
|
195 |
zWidth[zCount] = width |
|
196 |
zHeight[zCount] = height |
|
197 |
zOccupied[zCount] = false |
|
198 |
zCount = zCount + 1 |
|
199 |
||
200 |
return (zCount-1) |
|
201 |
||
202 |
end |
|
203 |
||
204 |
function GearIsInZone(gear, zI) |
|
205 |
||
206 |
if (GetX(gear) > zXMin[zI]) and (GetX(gear) < (zXMin[zI]+zWidth[zI])) and (GetY(gear) > zYMin[zI]) and (GetY(gear) < (zYMin[zI]+zHeight[zI])) then |
|
207 |
zOccupied[zI] = true |
|
208 |
else |
|
209 |
zOccupied[zI] = false |
|
210 |
end |
|
211 |
||
212 |
return zOccupied[zI] |
|
213 |
||
214 |
end |
|
215 |
||
216 |
------------------------ |
|
217 |
--flag methods |
|
218 |
------------------------ |
|
219 |
||
220 |
function CheckScore(teamID) |
|
221 |
||
222 |
if teamID == 0 then |
|
223 |
alt = 1 |
|
224 |
winner = "Red" |
|
225 |
||
226 |
elseif teamID == 1 then |
|
227 |
alt = 0 |
|
228 |
winner = "Blue" |
|
229 |
end |
|
230 |
||
4843 | 231 |
if fCaptures[teamID] == 3 then |
4786 | 232 |
for i = 0, (numhhs-1) do |
233 |
if GetHogClan(hhs[i]) == alt then |
|
234 |
SetEffect(hhs[i], heResurrectable, false) |
|
235 |
SetHealth(hhs[i],0) |
|
236 |
end |
|
237 |
end |
|
238 |
--ShowMission("GAME OVER!", "Victory for the " .. winner .. " Team!", "Hooray!", 0, 0) |
|
239 |
ShowMission(loc("GAME OVER!"), loc("Victory for the ") .. GetHogTeamName(CurrentHedgehog), loc("Hooray!"), 0, 0) |
|
240 |
end |
|
241 |
||
242 |
end |
|
243 |
||
244 |
function HandleRespawns() |
|
245 |
||
246 |
for i = 0, 1 do |
|
247 |
||
248 |
if fNeedsRespawn[i] == true then |
|
249 |
fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
|
250 |
--fGear[i] = SpawnHealthCrate(fSpawnX[i],fSpawnY[i]) |
|
251 |
fNeedsRespawn[i] = false |
|
252 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
|
253 |
AddCaption(loc("Flag respawned!")) |
|
254 |
end |
|
255 |
||
256 |
end |
|
257 |
||
258 |
end |
|
259 |
||
260 |
function FlagDeleted(gear) |
|
261 |
||
262 |
if (gear == fGear[0]) then |
|
263 |
wtf = 0 |
|
264 |
bbq = 1 |
|
265 |
elseif (gear == fGear[1]) then |
|
266 |
wtf = 1 |
|
267 |
bbq = 0 |
|
268 |
end |
|
269 |
||
270 |
--ShowMission("OH HAI!", "FlagDeleted was called", "Oh noes!", -amBazooka, 0) |
|
271 |
||
272 |
if CurrentHedgehog ~= nil then |
|
273 |
||
274 |
--ShowMission("GUESS WAT?", "I'm not nil", "Oh noes!", -amBazooka, 0) |
|
275 |
--if the player picks up the flag |
|
276 |
if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then |
|
277 |
||
278 |
fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it |
|
279 |
||
280 |
-- player has successfully captured the enemy flag |
|
281 |
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
|
282 |
fIsMissing[wtf] = false |
|
283 |
fNeedsRespawn[wtf] = true |
|
284 |
fIsMissing[bbq] = false |
|
285 |
fNeedsRespawn[bbq] = true |
|
286 |
fCaptures[wtf] = fCaptures[wtf] +1 --fCaptures[wtf] |
|
4843 | 287 |
|
4786 | 288 |
--ShowMission(loc("You have SCORED!!"), "Red Team: " .. fCaptures[0], "Blue Team: " .. fCaptures[1], -amBazooka, 0) |
289 |
ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
|
290 |
||
291 |
PlaySound(sndVictory) |
|
292 |
--SetEffect(fThief[bbq], hePoisoned, false) |
|
293 |
fThief[bbq] = nil -- player no longer has the enemy flag |
|
294 |
CheckScore(wtf) |
|
295 |
||
296 |
--if the player is returning the flag |
|
297 |
elseif GetHogClan(CurrentHedgehog) == wtf then |
|
298 |
||
299 |
fNeedsRespawn[wtf] = true |
|
300 |
||
301 |
-- NEW ADDIITON, does this work? Should make it possible to return your flag and then score in the same turn |
|
302 |
if fIsMissing[wtf] == true then |
|
303 |
HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
|
304 |
AddCaption(loc("Flag returned!")) |
|
305 |
elseif fIsMissing[wtf] == false then |
|
306 |
AddCaption(loc("That was pointless.") .. loc("The flag will respawn next round.")) |
|
307 |
end |
|
308 |
||
309 |
--fIsMissing[wtf] = false |
|
310 |
--ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0) |
|
311 |
||
312 |
--if the player is taking the enemy flag |
|
313 |
elseif GetHogClan(CurrentHedgehog) == bbq then |
|
314 |
fIsMissing[wtf] = true |
|
315 |
for i = 0,numhhs-1 do |
|
316 |
if CurrentHedgehog == hhs[i] then |
|
317 |
fThief[wtf] = hhs[i] |
|
318 |
--SetEffect(fThief[wtf], hePoisoned, true) |
|
319 |
end |
|
320 |
end |
|
321 |
||
322 |
AddCaption(loc("Flag captured!")) |
|
323 |
||
324 |
else --below line doesnt usually get called |
|
325 |
AddCaption("Hmm... that wasn't supposed to happen...") |
|
326 |
||
327 |
end |
|
328 |
||
329 |
-- if flag has been destroyed, probably |
|
330 |
else |
|
331 |
||
332 |
if GetY(fGear[wtf]) > 2025 then |
|
333 |
fGear[wtf] = nil |
|
334 |
fIsMissing[wtf] = true |
|
335 |
fNeedsRespawn[wtf] = true |
|
336 |
HandleRespawns() |
|
337 |
else |
|
338 |
fGear[wtf] = nil |
|
339 |
fIsMissing[wtf] = true |
|
340 |
fNeedsRespawn[wtf] = true |
|
341 |
AddCaption(loc("Boom!") .. " " .. loc("The flag will respawn next round.")) |
|
342 |
end |
|
343 |
||
344 |
end |
|
345 |
||
346 |
-- if flag has been destroyed deep underwater and player is now nil |
|
347 |
-- probably only gets called if the flag thief drowns himself |
|
348 |
-- otherwise the above one will work fine |
|
349 |
else |
|
350 |
--ShowMission("NIL PLAYER!", "Oh snap", "Oh noes!", -amBazooka, 0) |
|
351 |
fGear[wtf] = nil |
|
352 |
fIsMissing[wtf] = true |
|
353 |
fNeedsRespawn[wtf] = true |
|
354 |
AddCaption(loc("The flag will respawn next round.")) |
|
355 |
end |
|
356 |
||
357 |
end |
|
358 |
||
359 |
function FlagThiefDead(gear) |
|
360 |
||
361 |
if (gear == fThief[0]) then |
|
362 |
wtf = 0 |
|
363 |
bbq = 1 |
|
364 |
elseif (gear == fThief[1]) then |
|
365 |
wtf = 1 |
|
366 |
bbq = 0 |
|
367 |
end |
|
368 |
||
369 |
if fThief[wtf] ~= nil then |
|
4871 | 370 |
|
371 |
if fThiefY[wtf] > 2040 then |
|
372 |
fGear[wtf] = SpawnAmmoCrate(fThiefX[wtf],(fThiefY[wtf]+10),amSkip) |
|
373 |
else |
|
374 |
fGear[wtf] = SpawnAmmoCrate(fThiefX[wtf],(fThiefY[wtf]-50),amSkip) |
|
375 |
end |
|
376 |
||
4786 | 377 |
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
378 |
fThief[wtf] = nil |
|
379 |
end |
|
380 |
||
381 |
end |
|
382 |
||
383 |
function HandleCircles() |
|
4843 | 384 |
|
4786 | 385 |
for i = 0, 1 do |
386 |
if fIsMissing[i] == false then -- draw a circle at the flag's spawning place |
|
387 |
--SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
388 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
389 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
|
390 |
if fThief[i] ~= nil then -- draw circle round flag carrier |
|
391 |
--SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
392 |
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
393 |
elseif fThief[i] == nil then -- draw cirle round dropped flag |
|
394 |
--SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
395 |
SetVisualGearValues(fCirc[i], GetX(fGear[i]),GetY(fGear[i]), vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
396 |
end |
|
397 |
end |
|
4843 | 398 |
|
4786 | 399 |
if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
400 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
|
401 |
end |
|
402 |
end |
|
403 |
||
404 |
end |
|
405 |
||
406 |
------------------------ |
|
407 |
-- general methods |
|
408 |
------------------------ |
|
409 |
||
410 |
function CheckDistance(gear1, gear2) |
|
411 |
||
412 |
g1X, g1Y = GetGearPosition(gear1) |
|
413 |
g2X, g2Y = GetGearPosition(gear2) |
|
414 |
||
415 |
g1X = g1X - g2X |
|
416 |
g1Y = g1Y - g2Y |
|
417 |
z = (g1X*g1X) + (g1Y*g1Y) |
|
418 |
||
419 |
--dist = math.sqrt(z) |
|
420 |
||
421 |
dist = z |
|
422 |
||
423 |
return dist |
|
424 |
||
425 |
end |
|
426 |
||
427 |
function CheckTeleporters() |
|
428 |
||
429 |
teleportActive = false |
|
430 |
||
431 |
if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then |
|
432 |
teleportActive = true |
|
433 |
destinationX = 1402 |
|
434 |
destinationY = 321 |
|
435 |
elseif (GearIsInZone(CurrentHedgehog, orangeTel) == true) and (GetHogClan(CurrentHedgehog) == 1) then |
|
436 |
teleportActive = true |
|
437 |
destinationX = 2692 |
|
438 |
destinationY = 321 |
|
439 |
end |
|
440 |
||
441 |
if teleportActive == true then |
|
442 |
if actionReset == 0 then |
|
4871 | 443 |
if ropeGear ~= nil then |
444 |
if GetGearElasticity(ropeGear) ~= 0 then |
|
445 |
SetGearMessage(CurrentHedgehog, gmAttack) |
|
446 |
end |
|
447 |
end |
|
4786 | 448 |
--AddCaption(actionReset .. ";" .. "attack") |
449 |
elseif actionReset == 10 then |
|
450 |
SetGearMessage(CurrentHedgehog, 0) |
|
451 |
--AddCaption(actionReset .. ";" .. "reset") |
|
452 |
elseif actionReset == 20 then |
|
453 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
|
454 |
SetGearPosition(CurrentHedgehog,destinationX,destinationY) |
|
455 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
|
456 |
--AddCaption(actionReset .. ";" .. "teleport") |
|
457 |
end |
|
458 |
||
459 |
actionReset = actionReset + 1 |
|
460 |
if actionReset >= 30 then |
|
461 |
actionReset = 0 |
|
462 |
end |
|
463 |
||
464 |
end |
|
465 |
||
466 |
end |
|
467 |
||
468 |
function RebuildTeamInfo() |
|
469 |
||
470 |
||
471 |
-- make a list of individual team names |
|
472 |
for i = 0, 5 do |
|
473 |
teamNameArr[i] = i |
|
474 |
teamSize[i] = 0 |
|
475 |
teamIndex[i] = 0 |
|
476 |
end |
|
477 |
numTeams = 0 |
|
478 |
||
479 |
for i = 0, (numhhs-1) do |
|
480 |
||
481 |
z = 0 |
|
482 |
unfinished = true |
|
483 |
while(unfinished == true) do |
|
484 |
||
485 |
newTeam = true |
|
486 |
tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name |
|
487 |
||
488 |
if tempHogTeamName == teamNameArr[z] then |
|
489 |
newTeam = false |
|
490 |
unfinished = false |
|
491 |
end |
|
492 |
||
493 |
z = z + 1 |
|
494 |
||
495 |
if z == TeamsCount then |
|
496 |
unfinished = false |
|
497 |
if newTeam == true then |
|
498 |
teamNameArr[numTeams] = tempHogTeamName |
|
499 |
numTeams = numTeams + 1 |
|
500 |
end |
|
501 |
end |
|
502 |
||
503 |
end |
|
504 |
||
505 |
end |
|
506 |
||
507 |
-- find out how many hogs per team, and the index of the first hog in hhs |
|
508 |
for i = 0, numTeams-1 do |
|
509 |
||
510 |
for z = 0, numhhs-1 do |
|
511 |
if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
|
512 |
if teamSize[i] == 0 then |
|
513 |
teamIndex[i] = z -- should give starting index |
|
514 |
end |
|
515 |
teamSize[i] = teamSize[i] + 1 |
|
516 |
--add a pointer so this hog appears at i in hhs |
|
517 |
end |
|
518 |
end |
|
519 |
||
520 |
end |
|
521 |
||
522 |
end |
|
523 |
||
524 |
function HandleCrateDrops() |
|
525 |
||
526 |
roundsCounter = roundsCounter +1 |
|
527 |
||
528 |
if roundsCounter == 5 then |
|
529 |
||
530 |
roundsCounter = 0 |
|
531 |
||
532 |
r = GetRandom(8) |
|
533 |
if r == 0 then |
|
534 |
SpawnUtilityCrate(0,0,amSwitch) |
|
535 |
elseif r == 1 then |
|
536 |
SpawnUtilityCrate(0,0,amTeleport) |
|
537 |
elseif r == 2 then |
|
538 |
SpawnUtilityCrate(0,0,amJetpack) |
|
539 |
elseif r == 3 then |
|
540 |
SpawnUtilityCrate(0,0,amExtraTime) |
|
541 |
elseif r == 4 then |
|
542 |
SpawnUtilityCrate(0,0,amGirder) |
|
543 |
elseif r == 5 then |
|
544 |
SpawnAmmoCrate(0,0,amDynamite) |
|
545 |
elseif r == 6 then |
|
546 |
SpawnAmmoCrate(0,0,amFlamethrower) |
|
547 |
elseif r == 7 then |
|
548 |
SpawnUtilityCrate(0,0,amPortalGun) |
|
549 |
end |
|
550 |
||
551 |
end |
|
552 |
||
553 |
end |
|
554 |
||
555 |
------------------------ |
|
556 |
-- game methods |
|
557 |
------------------------ |
|
558 |
||
559 |
function onGameInit() |
|
560 |
||
561 |
-- Things we don't modify here will use their default values. |
|
562 |
GameFlags = gfDivideTeams -- Game settings and rules |
|
563 |
TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
|
564 |
CaseFreq = 0 -- The frequency of crate drops |
|
565 |
MinesNum = 0 -- The number of mines being placed |
|
566 |
MinesTime = 2000 |
|
567 |
Explosives = 0 -- The number of explosives being placed |
|
568 |
Delay = 10 -- The delay between each round |
|
569 |
SuddenDeathTurns = 99 -- suddendeath is off, effectively |
|
570 |
Map = "Blizzard" -- The map to be played |
|
571 |
Theme = "Snow" -- The theme to be used "Nature" |
|
572 |
||
573 |
end |
|
574 |
||
575 |
||
576 |
function onGameStart() |
|
577 |
||
578 |
--ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
|
4843 | 579 |
ShowMission(loc("CTF_BLIZZARD"), "", loc(" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"), 0, 0) |
4786 | 580 |
|
581 |
||
582 |
-- initialize teleporters |
|
583 |
redTel = CreateZone(342,1316,42,449) -- red teleporter |
|
584 |
orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter |
|
585 |
||
586 |
||
587 |
--new improved placement schematics aw yeah |
|
588 |
RebuildTeamInfo() |
|
589 |
--ShowMission("Team Info Rebuilt", "Here you go:", "TeamCount: " .. TeamsCount .. "|" .. teamNameArr[0] .. ": " .. teamSize[0] .. " Hogs|" .. teamNameArr[1] .. ": " .. teamSize[1] .. " Hogs|" .. teamNameArr[2] .. ": " .. teamSize[2] .. " Hogs|", 0, 0) |
|
590 |
team1Placed = 0 |
|
591 |
team2Placed = 0 |
|
592 |
for i = 0, (TeamsCount-1) do |
|
593 |
for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
|
594 |
if GetHogClan(hhs[g]) == 0 then |
|
595 |
SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570) |
|
596 |
team1Placed = team1Placed +1 |
|
597 |
if team1Placed > 6 then |
|
598 |
team1Placed = 0 |
|
599 |
end |
|
600 |
elseif GetHogClan(hhs[g]) == 1 then |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
601 |
SetGearPosition(hhs[g],2691- ((team2Placed+1)*50),1570) |
4786 | 602 |
team2Placed = team2Placed +1 |
603 |
if team2Placed > 6 then |
|
604 |
team2Placed = 0 |
|
605 |
end |
|
606 |
end |
|
607 |
end |
|
608 |
end |
|
609 |
||
610 |
||
611 |
||
612 |
--spawn starting ufos and or super weapons |
|
613 |
SpawnAmmoCrate(2048,1858,amJetpack) |
|
614 |
--SpawnUtilityCrate(2048,1858,amExtraTime) |
|
615 |
||
616 |
--set flag spawn points and spawn the flags |
|
617 |
fSpawnX[0] = 957 |
|
618 |
fSpawnY[0] = 1747 |
|
619 |
fSpawnX[1] = 3123 |
|
620 |
fSpawnY[1] = 1747 |
|
621 |
||
622 |
for i = 0, 1 do |
|
623 |
fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
|
624 |
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
4843 | 625 |
fCol[i] = GetClanColor(i) |
4786 | 626 |
|
627 |
fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
4843 | 628 |
SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 10, 200, 1, 10, 0, 300, 5, fCol[i]) |
629 |
||
630 |
||
4786 | 631 |
fIsMissing[i] = false |
632 |
fNeedsRespawn[i] = false |
|
633 |
fCaptures[i] = 0 |
|
634 |
||
635 |
vCircMinA[i] = 20 |
|
636 |
vCircMaxA[i] = 255 |
|
637 |
vCircType[i] = 1 |
|
638 |
vCircPulse[i] = 10 |
|
639 |
vCircFuckAll[i] = 0 |
|
640 |
vCircRadius[i] = 150 |
|
641 |
vCircWidth[i] = 5 |
|
642 |
vCircCol[i] = fCol[i] |
|
643 |
||
644 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
645 |
||
646 |
end |
|
647 |
||
648 |
end |
|
649 |
||
650 |
||
651 |
function onNewTurn() |
|
652 |
||
653 |
if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
|
654 |
lastTeam = GetHogTeamName(CurrentHedgehog) |
|
655 |
end |
|
656 |
||
657 |
for i = 0, 1 do |
|
658 |
if fThief[i] ~= nil then |
|
659 |
--adjust = 5 + GetHealth(fThief[i]) |
|
660 |
--SetHealth(fThief[i], adjust) |
|
661 |
--AddCaption('Helped out the flag poisoned flag thiefs') |
|
662 |
end |
|
663 |
end |
|
664 |
||
665 |
--AddCaption("Handling respawns") |
|
666 |
HandleRespawns() |
|
667 |
HandleCrateDrops() |
|
668 |
||
669 |
--myC = AddVisualGear(GetX(CurrentHedgehog),GetY(CurrentHedgehog),vgtCircle,0,true) |
|
4843 | 670 |
--SetVisualGearValues(myC, GetX(CurrentHedgehog),GetY(CurrentHedgehog), 20, 200, 0, 0, 100, 50, 3, GetClanColor(GetHogClan(CurrentHedgehog))) |
4786 | 671 |
|
672 |
end |
|
673 |
||
674 |
function onGameTick() |
|
675 |
||
676 |
-- onRessurect calls AFTER you have resurrected, |
|
677 |
-- so keeping track of x,y a few milliseconds before |
|
678 |
-- is useful |
|
679 |
--FTTC = FTTC + 1 |
|
680 |
--if FTTC == 100 then |
|
681 |
-- FTTC = 0 |
|
682 |
for i = 0,1 do |
|
683 |
if fThief[i] ~= nil then |
|
684 |
fThiefX[i] = GetX(fThief[i]) |
|
685 |
fThiefY[i] = GetY(fThief[i]) |
|
686 |
end |
|
687 |
end |
|
688 |
--end |
|
689 |
||
690 |
-- things we wanna check often |
|
691 |
if (CurrentHedgehog ~= nil) then |
|
692 |
--AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog)) |
|
693 |
--AddCaption("Checking Teleporters") |
|
694 |
CheckTeleporters() |
|
695 |
end |
|
696 |
||
697 |
HandleCircles() |
|
698 |
ManageTeleporterEffects() |
|
699 |
||
700 |
end |
|
701 |
||
702 |
||
703 |
function onAmmoStoreInit() |
|
704 |
||
705 |
SetAmmo(amDrill,9,0,0,0) |
|
706 |
SetAmmo(amMortar,9,0,0,0) |
|
707 |
||
708 |
SetAmmo(amGrenade,9,0,0,0) |
|
709 |
SetAmmo(amClusterBomb,4,0,0,0) |
|
710 |
||
711 |
--SetAmmo(amDEagle, 4, 0, 0, 0) |
|
712 |
SetAmmo(amShotgun, 9, 0, 0, 0) |
|
713 |
SetAmmo(amFlamethrower, 1, 0, 0, 1) |
|
714 |
||
715 |
SetAmmo(amFirePunch, 9, 0, 0, 0) |
|
716 |
SetAmmo(amBaseballBat, 2, 0, 0, 0) |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
717 |
--SetAmmo(amKamikaze, 2, 0, 0, 0) |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
718 |
|
4786 | 719 |
|
720 |
SetAmmo(amDynamite,2,0,0,1) |
|
721 |
SetAmmo(amSMine,4,0,0,0) |
|
722 |
||
723 |
SetAmmo(amBlowTorch, 9, 0, 0, 0) |
|
724 |
SetAmmo(amPickHammer, 9, 0, 0, 0) |
|
725 |
SetAmmo(amGirder, 2, 0, 0, 2) |
|
726 |
SetAmmo(amPortalGun, 2, 0, 0, 2) |
|
727 |
||
728 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
729 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
4843 | 730 |
SetAmmo(amTeleport, 0, 0, 0, 1) |
4786 | 731 |
SetAmmo(amJetpack, 1, 0, 0, 1) |
732 |
||
733 |
SetAmmo(amSwitch, 2, 0, 0, 1) |
|
734 |
SetAmmo(amExtraTime,1,0,0,1) |
|
735 |
SetAmmo(amLowGravity,1,0,0,0) |
|
736 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
737 |
||
738 |
end |
|
739 |
||
740 |
||
741 |
function onGearResurrect(gear) |
|
742 |
||
743 |
--AddCaption("A gear has been resurrected!") |
|
744 |
||
745 |
-- mark the flag thief as dead if he needed a respawn |
|
746 |
for i = 0,1 do |
|
747 |
if gear == fThief[i] then |
|
748 |
FlagThiefDead(gear) |
|
749 |
end |
|
750 |
end |
|
751 |
||
752 |
-- place hogs belonging to each clan either left or right side of map |
|
753 |
if GetHogClan(gear) == 0 then |
|
754 |
FindPlace(gear, false, 0, 2048) |
|
755 |
elseif GetHogClan(gear) == 1 then |
|
756 |
FindPlace(gear, false, 2048, LAND_WIDTH) |
|
757 |
end |
|
4843 | 758 |
|
4786 | 759 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
760 |
||
761 |
end |
|
762 |
||
763 |
function onGearDamage(gear, damage) |
|
764 |
||
4843 | 765 |
-- >_< damn, occurs too fast, before the hog has finished moving / updated his health |
4786 | 766 |
--if GetGearType(gear) == gtHedgehog then |
767 |
-- if damage > GetHealth(gear) then |
|
4843 | 768 |
-- AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
4786 | 769 |
-- end |
770 |
--end |
|
771 |
||
772 |
end |
|
773 |
||
774 |
function onGearAdd(gear) |
|
775 |
||
776 |
if GetGearType(gear) == gtHedgehog then |
|
777 |
||
778 |
hhs[numhhs] = gear |
|
779 |
numhhs = numhhs + 1 |
|
780 |
SetEffect(gear, heResurrectable, true) |
|
781 |
||
782 |
end |
|
783 |
||
4871 | 784 |
if GetGearType(gear) == gtRope then |
785 |
ropeGear = gear |
|
786 |
end |
|
787 |
||
4786 | 788 |
end |
789 |
||
790 |
function onGearDelete(gear) |
|
791 |
||
792 |
if (gear == fGear[0]) or (gear == fGear[1]) then |
|
793 |
FlagDeleted(gear) |
|
794 |
end |
|
795 |
||
4871 | 796 |
if GetGearType(gear) == gtRope then |
797 |
ropeGear = nil |
|
798 |
end |
|
799 |
||
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
800 |
if GetGearType(gear) == gtHedgehog then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
801 |
for i = 0, (numhhs-1) do |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
802 |
if gear == hhs[i] then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
803 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
804 |
for k = 0,1 do |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
805 |
if gear == fThief[k] then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
806 |
FlagThiefDead(gear) |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
807 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
808 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
809 |
hhs[i] = nil |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
810 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
811 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
812 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
813 |
|
4786 | 814 |
end |