149
169
-- player has successfully captured the enemy flag
150
170
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then
152
172
DeleteVisualGear(fGear[wtf])
153
fGear[wtf] = nil -- the flag has now disappeared
173
fGear[wtf] = nil -- the flag has now disappeared
155
175
fIsMissing[wtf] = false
156
176
fNeedsRespawn[wtf] = true
157
177
fIsMissing[bbq] = false
158
178
fNeedsRespawn[bbq] = true
159
fCaptures[wtf] = fCaptures[wtf] +1
179
fCaptures[wtf] = fCaptures[wtf] +1
160
180
ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0)
161
181
PlaySound(sndVictory)
162
182
fThief[bbq] = nil -- player no longer has the enemy flag
165
185
--if the player is returning the flag
166
186
elseif (GetHogClan(CurrentHedgehog) == wtf) and (fIsMissing[wtf] == true) then
168
188
DeleteVisualGear(fGear[wtf])
169
189
fGear[wtf] = nil -- the flag has now disappeared
171
fNeedsRespawn[wtf] = true
191
fNeedsRespawn[wtf] = true
172
192
HandleRespawns() -- this will set fIsMissing[wtf] to false :)
173
193
AddCaption(loc("Flag returned!"))
175
195
--if the player is taking the enemy flag
176
196
elseif GetHogClan(CurrentHedgehog) == bbq then
178
198
DeleteVisualGear(fGear[wtf])
179
fGear[wtf] = nil -- the flag has now disappeared
199
fGear[wtf] = nil -- the flag has now disappeared
181
201
fIsMissing[wtf] = true
182
202
for i = 0,numhhs-1 do
183
if CurrentHedgehog ~= nil then
203
if CurrentHedgehog ~= nil then
184
204
if CurrentHedgehog == hhs[i] then
185
205
fThief[wtf] = hhs[i]
251
267
if fThief[wtf] ~= nil then
253
--ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0)
269
--ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0)
254
270
if (LAND_HEIGHT - fThiefY[wtf]) < 15 then
255
271
fIsMissing[wtf] = true
256
272
fNeedsRespawn[wtf] = true
258
--AddCaption("hah??")
260
275
fGearX[wtf] = fThiefX[wtf]
261
fGearY[wtf] = fThiefY[wtf]
262
fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true)
263
--fGear[wtf] = AddVisualGear(fThiefX[wtf],fThiefY[wtf],vgtCircle,0,true)
276
fGearY[wtf] = fThiefY[wtf]
277
fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true)
266
280
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false)
277
291
fGearRad = fGearRad + 1
278
292
if fGearRad > fGearRadMax then
279
fGearRad = fGearRadMin
293
fGearRad = fGearRadMin
285
299
--SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) -- draw a circ for spawning area
287
301
if fIsMissing[i] == false then -- draw a flag marker at the flag's spawning place
288
302
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i])
289
303
if fGear[i] ~= nil then -- draw the flag gear itself
290
304
SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i])
292
306
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then
293
if fThief[i] ~= nil then -- draw circle round flag carrier
294
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i])
307
if fThief[i] ~= nil then -- draw circle round flag carrier -- 33
308
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i])
295
309
--AddCaption("circle marking carrier")
296
310
elseif fThief[i] == nil then -- draw cirle round dropped flag
297
--g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i])
311
--g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i])
298
312
--SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i])
299
313
SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i])
300
--AddCaption('dropped circle marker')
314
--AddCaption('dropped circle marker')
301
315
if fGear[i] ~= nil then -- flag gear itself
302
--SetVisualGearValues(fGear[i], g1X, g1Y, 20, 200, 0, 0, 100, 10, 4, fCol[i])
316
--SetVisualGearValues(fGear[i], g1X, g1Y, 20, 200, 0, 0, 100, 10, 4, fCol[i])
303
317
SetVisualGearValues(fGear[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i])
304
318
--AddCaption('dropped flag itself')
399
-- if someone uses kamikaze downwards, this can happen as the hog won't respawn
413
-- if someone uses kamikaze downwards, this can happen as the hog won't respawn
400
414
if (LAND_HEIGHT - fSpawnY[i]) < 0 then
401
415
tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
402
FindPlace(tempG, true, 0, LAND_WIDTH, true)
416
FindPlace(tempG, true, 0, LAND_WIDTH, true)
403
417
fSpawnX[i], fSpawnY[i] = GetGearPosition(tempG)
404
418
DeleteGear(tempG)
407
421
fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
408
422
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
415
429
fIsMissing[i] = false
416
430
fNeedsRespawn[i] = false
419
--SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0))
433
--SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0))
421
435
SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i])
422
--SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i])
445
455
function onGameStart()
447
457
--ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0)
448
ShowMission(loc("CAPTURE THE FLAG"), loc("by mikade"), loc("CUSTOM BUILD 0.2"), 0, 0)
458
ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0)
450
460
RebuildTeamInfo()
452
-- should gfDivideTeams do this automatically?
462
-- should gfDivideTeams do this automatically?
453
463
--[[for i = 0, (TeamsCount-1) do
454
464
for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do
455
465
if GetHogClan(hhs[g]) == 0 then
482
492
--AddCaption("Handling respawns")
483
493
if gameStarted == true then
485
--new method of placing starting flags
495
--new method of placing starting flags
486
496
elseif gameTurns == 1 then
487
ShowMission(loc("CAPTURE THE FLAG"), loc("Flags will be placed where each team ends their turn."), "", 0, 0)
497
ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0)
488
498
elseif gameTurns == 2 then
489
499
fPlaced[0] = true
490
500
ShowMission(loc("CAPTURE THE FLAG"), loc("RULES OF THE GAME [Press ESC to view]"), 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)
491
501
elseif gameTurns == 3 then