author | belphegorr <szabibibi@gmail.com> |
Mon, 16 Jul 2012 20:56:55 +0300 | |
changeset 7255 | 93cf6b3b89be |
parent 5827 | a416f1070fdf |
child 7838 | 5c2337f8dbb2 |
permissions | -rw-r--r-- |
5277 | 1 |
--------------------------------------- |
5819 | 2 |
-- CAPTURE_THE_FLAG GAMEPLAY MODE 0.5 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
3 |
-- by mikade |
5277 | 4 |
--------------------------------------- |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
5 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
6 |
-- Version History |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
7 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
8 |
-- 0.1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
9 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
10 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
11 |
-- [conversion from map-dependant CTF_Blizzard to map independant Capture the Flag] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
12 |
-- added an intial starting stage where flagspawn is decided by the players (weapon set will require a jetpack unless I set) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
13 |
-- changed the flag from a crate to a visual gear, and all associated methods and checks relating to flags (five hours later, lol) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
14 |
-- changed starting/respawning positioning to accommodate different map sizes |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
15 |
-- added another circle to mark flag spawn |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
16 |
-- added gameFlag filter |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
17 |
-- changed scoring feedback |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
18 |
-- cleaned up some code |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
19 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
20 |
-- removing own flag from spawning point no longer possible |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
21 |
-- destroying flags no longer possible. |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
22 |
-- added basic glowing circle effect to spawn area |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
23 |
-- added expanding circle to fgear itself |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
24 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
25 |
-- removed teleporters |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
26 |
-- removed random crate drops (this should be decided by scheme) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
27 |
-- removed set map criteria like minesNum, turnTime, explosives etc. except for sudden death |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
28 |
-- removed weapon defintions |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
29 |
-- removed placement and respawning methods, hopefully divideTeams will have this covered |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
30 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
31 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
32 |
-- 0.2 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
33 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
34 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
35 |
-- [now with user friendliness] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
36 |
-- flag is now placed wherever you end up at the end of your first turn, this ensures that it is always placed by turn 3 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
37 |
-- removed a bunch of backup code and no-longer needed variables / methods from CTF_Blizzard days |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
38 |
-- removed an aura that was still mistakenly hanging about |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
39 |
-- added an in-game note about placements |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
40 |
-- added an in-game note about the rules of the game |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
41 |
-- added translation support and loc()'ed everything |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
42 |
-- changed things so the seed is no longer always the same... |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
43 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
44 |
-- In this version: |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
45 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
46 |
-- 0.3 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
47 |
--------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
48 |
-- [fufufufu kamikaze fix] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
49 |
-- added nill checks to make sure the player doesn't generate errors by producing a nil value in hhs[] when he uses kamikaze |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
50 |
-- added a check to make sure the player doesn't kamikaze straight down and make the flag's starting point underwater |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
51 |
-- added a check to make sure the player drops the flag if he has it and he uses kamikaze |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
52 |
|
5277 | 53 |
-------- |
54 |
-- 0.4 |
|
55 |
-------- |
|
56 |
||
57 |
-- remove user-branding and version numbers |
|
58 |
-- removed some stuff that wasn't needed |
|
59 |
-- fix piano strike exploit |
|
60 |
-- changed delay to allow for better portals |
|
61 |
-- changed starting feedback a little |
|
62 |
-- increased the radius around the circle indicating the flag thief so that it doesn't obscure his health |
|
63 |
||
5819 | 64 |
-------- |
65 |
-- 0.5 |
|
66 |
-------- |
|
67 |
||
68 |
-- add support for more players |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5819
diff
changeset
|
69 |
-- allow limited sudden death |
5819 | 70 |
-- stop TimeBox ruining my life |
71 |
-- profit??? |
|
72 |
||
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
73 |
----------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
74 |
--SCRIPT BEGINS |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
75 |
----------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
76 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
77 |
-- enable awesome translaction support so we can use loc() wherever we want |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
78 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
79 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
80 |
--------------------------------------------------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
81 |
----------lots of bad variables and things |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
82 |
----------because someone is too lazy |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
83 |
----------to read about tables properly |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
84 |
------------------ "Oh well, they probably have the memory" |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
85 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
86 |
local gameStarted = false |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
87 |
local gameTurns = 0 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
88 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
89 |
-------------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
90 |
-- hog and team tracking variales |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
91 |
-------------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
92 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
93 |
local numhhs = 0 -- store number of hedgehogs |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
94 |
local hhs = {} -- store hedgehog gears |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
95 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
96 |
local numTeams -- store the number of teams in the game |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
97 |
local teamNameArr = {} -- store the list of teams |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
98 |
local teamSize = {} -- store how many hogs per team |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
99 |
local teamIndex = {} -- at what point in the hhs{} does each team begin |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
100 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
101 |
------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
102 |
-- flag variables |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
103 |
------------------- |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
104 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
105 |
local fPlaced = {} -- has the flag been placed TRUE/FALSE |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
106 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
107 |
local fGear = {} -- pointer to the visual gears that represent the flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
108 |
local fGearX = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
109 |
local fGearY = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
110 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
111 |
local fThief = {} -- pointer to the hogs who stole the flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
112 |
local fIsMissing = {} -- have the flags been destroyed or captured |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
113 |
local fNeedsRespawn = {} -- do the flags need to be respawned |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
114 |
local fCaptures = {} -- the team "scores" how many captures |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
115 |
local fSpawnX = {} -- spawn X for flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
116 |
local fSpawnY = {} -- spawn Y for flags |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
117 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
118 |
local fThiefX = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
119 |
local fThiefY = {} |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
120 |
local FTTC = 0 -- flag thief tracker counter |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
121 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
122 |
local fSpawnC = {} -- spawn circle marker |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
123 |
local fCirc = {} -- flag/carrier marker circles |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
124 |
local fCol = {} -- colour of the clans |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
125 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
126 |
local fGearRad = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
127 |
local fGearRadMin = 5 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
128 |
local fGearRadMax = 33 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
129 |
local fGearTimer = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
130 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
131 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
132 |
--flag methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
133 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
134 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
135 |
function CheckScore(teamID) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
136 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
137 |
if teamID == 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
138 |
alt = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
139 |
elseif teamID == 1 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
140 |
alt = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
141 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
142 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
143 |
if fCaptures[teamID] == 3 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
144 |
for i = 0, (numhhs-1) do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
145 |
if hhs[i] ~= nil then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
146 |
if GetHogClan(hhs[i]) == alt then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
147 |
SetEffect(hhs[i], heResurrectable, false) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
148 |
SetHealth(hhs[i],0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
149 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
150 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
151 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
152 |
if CurrentHedgehog ~= nil then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
153 |
ShowMission(loc("GAME OVER!"), loc("Victory for the ") .. GetHogTeamName(CurrentHedgehog), loc("Hooray!"), 0, 0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
154 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
155 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
156 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
157 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
158 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
159 |
function DoFlagStuff(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
160 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
161 |
if (gear == fGear[0]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
162 |
wtf = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
163 |
bbq = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
164 |
elseif (gear == fGear[1]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
165 |
wtf = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
166 |
bbq = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
167 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
168 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
169 |
-- player has successfully captured the enemy flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
170 |
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
171 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
172 |
DeleteVisualGear(fGear[wtf]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
173 |
fGear[wtf] = nil -- the flag has now disappeared |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
174 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
175 |
fIsMissing[wtf] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
176 |
fNeedsRespawn[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
177 |
fIsMissing[bbq] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
178 |
fNeedsRespawn[bbq] = true |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
179 |
fCaptures[wtf] = fCaptures[wtf] +1 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
180 |
ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
181 |
PlaySound(sndVictory) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
182 |
fThief[bbq] = nil -- player no longer has the enemy flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
183 |
CheckScore(wtf) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
184 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
185 |
--if the player is returning the flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
186 |
elseif (GetHogClan(CurrentHedgehog) == wtf) and (fIsMissing[wtf] == true) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
187 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
188 |
DeleteVisualGear(fGear[wtf]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
189 |
fGear[wtf] = nil -- the flag has now disappeared |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
190 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
191 |
fNeedsRespawn[wtf] = true |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
192 |
HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
193 |
AddCaption(loc("Flag returned!")) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
194 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
195 |
--if the player is taking the enemy flag |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
196 |
elseif GetHogClan(CurrentHedgehog) == bbq then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
197 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
198 |
DeleteVisualGear(fGear[wtf]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
199 |
fGear[wtf] = nil -- the flag has now disappeared |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
200 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
201 |
fIsMissing[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
202 |
for i = 0,numhhs-1 do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
203 |
if CurrentHedgehog ~= nil then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
204 |
if CurrentHedgehog == hhs[i] then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
205 |
fThief[wtf] = hhs[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
206 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
207 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
208 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
209 |
AddCaption(loc("Flag captured!")) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
210 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
211 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
212 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
213 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
214 |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
215 |
function CheckFlagProximity() |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
216 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
217 |
for i = 0, 1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
218 |
if fGear[i] ~= nil then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
219 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
220 |
g1X = fGearX[i] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
221 |
g1Y = fGearY[i] |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
222 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
223 |
g2X, g2Y = GetGearPosition(CurrentHedgehog) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
224 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
225 |
q = g1X - g2X |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
226 |
w = g1Y - g2Y |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
227 |
dist = (q*q) + (w*w) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
228 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
229 |
if dist < 500 then --1600 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
230 |
DoFlagStuff(fGear[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
231 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
232 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
233 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
234 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
235 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
236 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
237 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
238 |
function HandleRespawns() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
239 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
240 |
for i = 0, 1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
241 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
242 |
if fNeedsRespawn[i] == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
243 |
fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
244 |
fGearX[i] = fSpawnX[i] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
245 |
fGearY[i] = fSpawnY[i] |
5277 | 246 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
247 |
fNeedsRespawn[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
248 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
249 |
AddCaption(loc("Flag respawned!")) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
250 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
251 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
252 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
253 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
254 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
255 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
256 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
257 |
function FlagThiefDead(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
258 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
259 |
if (gear == fThief[0]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
260 |
wtf = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
261 |
bbq = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
262 |
elseif (gear == fThief[1]) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
263 |
wtf = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
264 |
bbq = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
265 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
266 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
267 |
if fThief[wtf] ~= nil then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
268 |
-- falls into water |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
269 |
--ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
270 |
if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
271 |
fIsMissing[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
272 |
fNeedsRespawn[wtf] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
273 |
HandleRespawns() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
274 |
else --normally |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
275 |
fGearX[wtf] = fThiefX[wtf] |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
276 |
fGearY[wtf] = fThiefY[wtf] |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
277 |
fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
278 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
279 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
280 |
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
281 |
fThief[wtf] = nil |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
282 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
283 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
284 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
285 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
286 |
function HandleCircles() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
287 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
288 |
fGearTimer = fGearTimer + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
289 |
if fGearTimer == 50 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
290 |
fGearTimer = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
291 |
fGearRad = fGearRad + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
292 |
if fGearRad > fGearRadMax then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
293 |
fGearRad = fGearRadMin |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
294 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
295 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
296 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
297 |
for i = 0, 1 do |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
298 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
299 |
--SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) -- draw a circ for spawning area |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
300 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
301 |
if fIsMissing[i] == false then -- draw a flag marker at the flag's spawning place |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
302 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
303 |
if fGear[i] ~= nil then -- draw the flag gear itself |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
304 |
SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
305 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
306 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
5277 | 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]) |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
309 |
--AddCaption("circle marking carrier") |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
310 |
elseif fThief[i] == nil then -- draw cirle round dropped flag |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
311 |
--g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i]) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
312 |
--SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
313 |
SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
314 |
--AddCaption('dropped circle marker') |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
315 |
if fGear[i] ~= nil then -- flag gear itself |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
316 |
--SetVisualGearValues(fGear[i], g1X, g1Y, 20, 200, 0, 0, 100, 10, 4, fCol[i]) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
317 |
SetVisualGearValues(fGear[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
318 |
--AddCaption('dropped flag itself') |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
319 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
320 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
321 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
322 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
323 |
if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
324 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
325 |
--AddCaption("needs respawn = true. flag 'destroyed'?") |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
326 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
327 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
328 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
329 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
330 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
331 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
332 |
-- general methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
333 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
334 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
335 |
function CheckDistance(gear1, gear2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
336 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
337 |
g1X, g1Y = GetGearPosition(gear1) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
338 |
g2X, g2Y = GetGearPosition(gear2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
339 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
340 |
g1X = g1X - g2X |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
341 |
g1Y = g1Y - g2Y |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
342 |
z = (g1X*g1X) + (g1Y*g1Y) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
343 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
344 |
dist = z |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
345 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
346 |
return dist |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
347 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
348 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
349 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
350 |
function RebuildTeamInfo() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
351 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
352 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
353 |
-- make a list of individual team names |
5819 | 354 |
for i = 0, (TeamsCount-1) do |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
355 |
teamNameArr[i] = i |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
356 |
teamSize[i] = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
357 |
teamIndex[i] = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
358 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
359 |
numTeams = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
360 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
361 |
for i = 0, (numhhs-1) do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
362 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
363 |
z = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
364 |
unfinished = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
365 |
while(unfinished == true) do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
366 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
367 |
newTeam = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
368 |
tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
369 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
370 |
if tempHogTeamName == teamNameArr[z] then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
371 |
newTeam = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
372 |
unfinished = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
373 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
374 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
375 |
z = z + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
376 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
377 |
if z == TeamsCount then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
378 |
unfinished = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
379 |
if newTeam == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
380 |
teamNameArr[numTeams] = tempHogTeamName |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
381 |
numTeams = numTeams + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
382 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
383 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
384 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
385 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
386 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
387 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
388 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
389 |
-- find out how many hogs per team, and the index of the first hog in hhs |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
390 |
for i = 0, numTeams-1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
391 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
392 |
for z = 0, numhhs-1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
393 |
if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
394 |
if teamSize[i] == 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
395 |
teamIndex[i] = z -- should give starting index |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
396 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
397 |
teamSize[i] = teamSize[i] + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
398 |
--add a pointer so this hog appears at i in hhs |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
399 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
400 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
401 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
402 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
403 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
404 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
405 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
406 |
function StartTheGame() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
407 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
408 |
gameStarted = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
409 |
AddCaption(loc("Game Started!")) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
410 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
411 |
for i = 0, 1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
412 |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
413 |
-- if someone uses kamikaze downwards, this can happen as the hog won't respawn |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
414 |
if (LAND_HEIGHT - fSpawnY[i]) < 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
415 |
tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
416 |
FindPlace(tempG, true, 0, LAND_WIDTH, true) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
417 |
fSpawnX[i], fSpawnY[i] = GetGearPosition(tempG) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
418 |
DeleteGear(tempG) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
419 |
end |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
420 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
421 |
fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
422 |
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
423 |
fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
424 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
425 |
fGearX[i] = fSpawnX[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
426 |
fGearY[i] = fSpawnY[i] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
427 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
428 |
fCol[i] = GetClanColor(i) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
429 |
fIsMissing[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
430 |
fNeedsRespawn[i] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
431 |
fCaptures[i] = 0 |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
432 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
433 |
--SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0)) |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
434 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
435 |
SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
436 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
437 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
438 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
439 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
440 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
441 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
442 |
-- game methods |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
443 |
------------------------ |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
444 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
445 |
function onGameInit() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
446 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
447 |
GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts)) |
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5819
diff
changeset
|
448 |
--SuddenDeathTurns = 999 -- suddendeath is off, effectively |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
449 |
WaterRise = 0 |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
450 |
Delay = 10 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
451 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
452 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
453 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
454 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
455 |
function onGameStart() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
456 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
457 |
--ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
5277 | 458 |
ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
459 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
460 |
RebuildTeamInfo() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
461 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
462 |
-- should gfDivideTeams do this automatically? |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
463 |
--[[for i = 0, (TeamsCount-1) do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
464 |
for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
465 |
if GetHogClan(hhs[g]) == 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
466 |
FindPlace(hhs[g], false, 0, LAND_WIDTH/2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
467 |
elseif GetHogClan(hhs[g]) == 1 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
468 |
FindPlace(hhs[g], false, LAND_WIDTH/2, LAND_WIDTH) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
469 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
470 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
471 |
end]] |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
472 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
473 |
fPlaced[0] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
474 |
fPlaced[1] = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
475 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
476 |
--zxc = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
477 |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
478 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
479 |
--SetVisualGearValues(zxc, 1000,1000, 20, 255, 1, 10, 0, 200, 1, GetClanColor(0)) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
480 |
--minO,max0 -glowyornot --pulsate timer -- fuckall -- radius -- width -- colour |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
481 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
482 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
483 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
484 |
function onNewTurn() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
485 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
486 |
gameTurns = gameTurns + 1 |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
487 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
488 |
if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
489 |
lastTeam = GetHogTeamName(CurrentHedgehog) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
490 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
491 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
492 |
--AddCaption("Handling respawns") |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
493 |
if gameStarted == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
494 |
HandleRespawns() |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
495 |
--new method of placing starting flags |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
496 |
elseif gameTurns == 1 then |
5277 | 497 |
ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
498 |
elseif gameTurns == 2 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
499 |
fPlaced[0] = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
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) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
501 |
elseif gameTurns == 3 then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
502 |
fPlaced[1] = true |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
503 |
StartTheGame() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
504 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
505 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
506 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
507 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
508 |
function onGameTick() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
509 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
510 |
-- onRessurect calls AFTER you have resurrected, |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
511 |
-- so keeping track of x,y a few milliseconds before |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
512 |
-- is useful |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
513 |
--FTTC = FTTC + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
514 |
--if FTTC == 100 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
515 |
-- FTTC = 0 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
516 |
for i = 0,1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
517 |
if fThief[i] ~= nil then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
518 |
fThiefX[i] = GetX(fThief[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
519 |
fThiefY[i] = GetY(fThief[i]) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
520 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
521 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
522 |
--end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
523 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
524 |
-- things we wanna check often |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
525 |
if (CurrentHedgehog ~= nil) then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
526 |
--AddCaption(LAND_HEIGHT - GetY(CurrentHedgehog)) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
527 |
--AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog)) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
528 |
--CheckTeleporters() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
529 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
530 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
531 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
532 |
if gameStarted == true then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
533 |
HandleCircles() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
534 |
if CurrentHedgehog ~= nil then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
535 |
CheckFlagProximity() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
536 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
537 |
elseif CurrentHedgehog ~= nil then -- if the game hasn't started yet, keep track of where we are gonna put the flags on turn end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
538 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
539 |
if GetHogClan(CurrentHedgehog) == 0 then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
540 |
i = 0 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
541 |
elseif GetHogClan(CurrentHedgehog) == 1 then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
542 |
i = 1 |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
543 |
end |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
544 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
545 |
fSpawnX[i] = GetX(CurrentHedgehog) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
546 |
fSpawnY[i] = GetY(CurrentHedgehog) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
547 |
|
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
548 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
549 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
550 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
551 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
552 |
function onGearResurrect(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
553 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
554 |
--AddCaption("A gear has been resurrected!") |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
555 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
556 |
-- mark the flag thief as dead if he needed a respawn |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
557 |
for i = 0,1 do |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
558 |
if gear == fThief[i] then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
559 |
FlagThiefDead(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
560 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
561 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
562 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
563 |
-- should be covered by gfDivideTeams, actually |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
564 |
-- place hogs belonging to each clan either left or right side of map |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
565 |
--if GetHogClan(gear) == 0 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
566 |
-- FindPlace(gear, false, 0, LAND_WIDTH/2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
567 |
--elseif GetHogClan(gear) == 1 then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
568 |
-- FindPlace(gear, false, LAND_WIDTH/2, LAND_WIDTH) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
569 |
--end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
570 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
571 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
572 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
573 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
574 |
|
5819 | 575 |
function InABetterPlaceNow(gear) |
576 |
for i = 0, (numhhs-1) do |
|
577 |
if gear == hhs[i] then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
578 |
|
5819 | 579 |
for i = 0,1 do |
580 |
if gear == fThief[i] then |
|
581 |
FlagThiefDead(gear) |
|
582 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
583 |
end |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
584 |
hhs[i] = nil |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
585 |
end |
5819 | 586 |
end |
587 |
end |
|
588 |
||
589 |
function onHogHide(gear) |
|
590 |
InABetterPlaceNow(gear) |
|
591 |
end |
|
592 |
||
593 |
function onHogRestore(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
594 |
match = false |
5819 | 595 |
for i = 0, (numhhs-1) do |
596 |
if (hhs[i] == nil) and (match == false) then |
|
597 |
hhs[i] = gear |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
598 |
--AddCaption(GetHogName(gear) .. " has reappeared it seems!") |
5819 | 599 |
match = true |
600 |
end |
|
601 |
end |
|
602 |
end |
|
603 |
||
604 |
||
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
605 |
function onGearAdd(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
606 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
607 |
if GetGearType(gear) == gtHedgehog then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
608 |
hhs[numhhs] = gear |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
609 |
numhhs = numhhs + 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
610 |
SetEffect(gear, heResurrectable, true) |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
611 |
|
5277 | 612 |
elseif GetGearType(gear) == gtPiano then |
613 |
||
614 |
for i = 0, 1 do |
|
615 |
if CurrentHedgehog == fThief[i] then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
616 |
FlagThiefDead(gear) |
5277 | 617 |
end |
618 |
end |
|
619 |
||
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
620 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
621 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
622 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
623 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
624 |
function onGearDelete(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
625 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
626 |
if GetGearType(gear) == gtHedgehog then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5821
diff
changeset
|
627 |
InABetterPlaceNow(gear) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
628 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
629 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
630 |
end |