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