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