3 loadfile(GetDataPath() .. "Scripts/Tracker.lua")() |
3 loadfile(GetDataPath() .. "Scripts/Tracker.lua")() |
4 |
4 |
5 --------------------------------------------------- |
5 --------------------------------------------------- |
6 --------------------------------------------------- |
6 --------------------------------------------------- |
7 --------------------------------------------------- |
7 --------------------------------------------------- |
8 --- Space Invasion Code Follows (0.8.1) |
8 --- Space Invasion Code Follows (0.9) |
9 --------------------------------------------------- |
9 --------------------------------------------------- |
10 --------------------------------------------------- |
10 --------------------------------------------------- |
11 -- VERSION HISTORY |
11 -- VERSION HISTORY |
12 ---------------- |
12 ---------------- |
13 -- version 0.1 |
13 -- version 0.1 |
84 -- Drone Hunter (Destroy 5 red circles for + 10 points) |
84 -- Drone Hunter (Destroy 5 red circles for + 10 points) |
85 -- Shield Seeker (Destroy 3 purple circles for +10 points) |
85 -- Shield Seeker (Destroy 3 purple circles for +10 points) |
86 -- Boss Slayer (Destroy 2 blue circles for +25 points) |
86 -- Boss Slayer (Destroy 2 blue circles for +25 points) |
87 |
87 |
88 -- Shield Master (disolve 5 shells for +10 points) |
88 -- Shield Master (disolve 5 shells for +10 points) |
89 -- Shield Miser (don't use your shield at all +20 points) |
89 -- Shield Miser (don't use your shield at all (2.5*roundkills)+2 points) |
90 |
90 |
91 -- Depleted Kamikaze! (kamikaze into a blue/red circ when you are out of ammo) 5pts |
91 -- Depleted Kamikaze! (kamikaze into a blue/red circ when you are out of ammo) 5pts |
92 -- Timed Kamikaze! (kamikaze into a blue/red circ when you only have 5s left) 10pts |
92 -- Timed Kamikaze! (kamikaze into a blue/red circ when you only have 5s left) 10pts |
93 -- Kamikaze Expert (combination of the above two) 15pts |
93 -- Kamikaze Expert (combination of the above two) 15pts |
94 |
94 |
95 -- Multi-shot (destroy more than 1 invader with a single bullet) 5pts |
95 -- Multi-shot (destroy more than 1 invader with a single bullet) 15pts |
96 -- X-Hit Combo (destroy another invader in less than 3 seconds) chainLength*2 points |
96 -- X-Hit Combo (destroy another invader in less than 3 seconds) chainLength*2 points |
97 |
97 |
98 -- Accuracy Bonus (80% accuracy at the end of your turn with more than 5 shots fired) 15pts |
98 -- Accuracy Bonus (80% accuracy at the end of your turn with more than 5 shots fired) 15pts |
99 |
99 |
100 --(during the length of the game) aka non-repeatable |
100 --(during the length of the game) aka non-repeatable |
110 -- version 0.8.1 |
110 -- version 0.8.1 |
111 ------------------------ |
111 ------------------------ |
112 |
112 |
113 -- stop hiding non-existant 4th Tag |
113 -- stop hiding non-existant 4th Tag |
114 -- redraw HUD on screen resolution change |
114 -- redraw HUD on screen resolution change |
|
115 |
|
116 ------------------------ |
|
117 -- version 0.9 |
|
118 ------------------------ |
|
119 -- time for more 'EXPERIMENTS' mwahahahahahaha D: |
|
120 -- (hopefully) balanced Shield Miser |
|
121 -- bosses are no longer a redunkulous 50 points, but toned down to 30 |
|
122 -- experimental radar (it's INTERACTIVE and math-heavy :D) (visual gears are safe... right? D:) |
|
123 -- bugfix and balance for multishot |
115 |
124 |
116 -------------------------- |
125 -------------------------- |
117 --notes for later |
126 --notes for later |
118 -------------------------- |
127 -------------------------- |
119 -- maybe add a check for a tie, NAH |
128 -- maybe add a check for a tie, NAH |
126 |
135 |
127 ----------------- |
136 ----------------- |
128 capgrpAmmostate |
137 capgrpAmmostate |
129 ----------------- |
138 ----------------- |
130 AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate) |
139 AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate) |
131 AddCaption(LOC_NOT("Multi-shot! +5 points!"),0xffba00ff,capgrpAmmostate) |
140 AddCaption(LOC_NOT("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate) |
132 |
141 |
133 ----------------- |
142 ----------------- |
134 capgrpAmmoinfo |
143 capgrpAmmoinfo |
135 ----------------- |
144 ----------------- |
136 AddCaption(LOC_NOT("Shield Miser! +20 points!"),0xffba00ff,capgrpAmmoinfo) |
145 AddCaption(LOC_NOT("Shield Miser! +20 points!"),0xffba00ff,capgrpAmmoinfo) |
271 local circAdjustTimer = 0 -- handle adjustment of circs direction |
281 local circAdjustTimer = 0 -- handle adjustment of circs direction |
272 local m2Count = 0 -- handle speed of circs |
282 local m2Count = 0 -- handle speed of circs |
273 |
283 |
274 local vCirc = {} |
284 local vCirc = {} |
275 local vCCount = 0 |
285 local vCCount = 0 |
|
286 |
|
287 local rCirc = {} |
|
288 local rCircX = {} |
|
289 local rCircY = {} |
|
290 local rAlpha = 255 |
|
291 local rPingTimer = 0 |
|
292 local radShotsLeft = 0 |
276 |
293 |
277 local vCircActive = {} |
294 local vCircActive = {} |
278 local vCircHealth = {} |
295 local vCircHealth = {} |
279 local vType = {} |
296 local vType = {} |
280 local vCounter = {} -- how often this circ gets to "fire" etc |
297 local vCounter = {} -- how often this circ gets to "fire" etc |
425 |
442 |
426 end |
443 end |
427 |
444 |
428 function AwardKills(t) |
445 function AwardKills(t) |
429 |
446 |
|
447 roundKills = roundKills + 1 |
|
448 |
430 for i = 0,(TeamsCount-1) do |
449 for i = 0,(TeamsCount-1) do |
431 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
450 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
432 teamCircsKilled[i] = teamCircsKilled[i] + 1 |
451 teamCircsKilled[i] = teamCircsKilled[i] + 1 |
433 |
452 |
434 if teamCircsKilled[i] == 10 then |
453 if teamCircsKilled[i] == 10 then |
785 " " .. "|" .. |
816 " " .. "|" .. |
786 |
817 |
787 loc("Movement: [Up], [Down], [Left], [Right]") .. "|" .. |
818 loc("Movement: [Up], [Down], [Left], [Right]") .. "|" .. |
788 loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" .. |
819 loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" .. |
789 loc("Toggle Shield") .. ": " .. loc("[Enter]") .. "|" .. |
820 loc("Toggle Shield") .. ": " .. loc("[Enter]") .. "|" .. |
|
821 loc("Radar Ping") .. ": " .. loc("[Backspace]") .. "|" .. |
790 |
822 |
791 --" " .. "|" .. |
823 --" " .. "|" .. |
792 --LOC_NOT("Invaders List: ") .. "|" .. |
824 --LOC_NOT("Invaders List: ") .. "|" .. |
793 --LOC_NOT("Blue Jabberwock: (50 points)") .. "|" .. |
825 --LOC_NOT("Blue Jabberwock: (50 points)") .. "|" .. |
794 --LOC_NOT("Red Warbler: (10 points)") .. "|" .. |
826 --LOC_NOT("Red Warbler: (10 points)") .. "|" .. |
934 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
968 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then |
935 --AddCaption(LOC_NOT("Good to go!")) |
969 --AddCaption(LOC_NOT("Good to go!")) |
936 tumbleStarted = true |
970 tumbleStarted = true |
937 TimeLeft = (TurnTime/1000) --45 |
971 TimeLeft = (TurnTime/1000) --45 |
938 FadeAlpha = 0 |
972 FadeAlpha = 0 |
|
973 rAlpha = 255 |
939 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
974 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
940 DrawTag(0) |
975 DrawTag(0) |
941 DrawTag(1) |
976 DrawTag(1) |
942 DrawTag(2) |
977 DrawTag(2) |
943 SetMyCircles(true) |
978 SetMyCircles(true) |
983 down = false |
1018 down = false |
984 leftOn = false |
1019 leftOn = false |
985 rightOn = false |
1020 rightOn = false |
986 SetMyCircles(false) |
1021 SetMyCircles(false) |
987 HideTags() |
1022 HideTags() |
|
1023 rAlpha = 255 |
988 --nw WriteLnToConsole("Player is out of luck") |
1024 --nw WriteLnToConsole("Player is out of luck") |
989 |
1025 |
990 if shieldMiser == true then |
1026 if shieldMiser == true then |
991 AddCaption(loc("Shield Miser!") .. " +20 " .. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo) |
1027 |
992 AwardPoints(20) |
1028 p = (roundKills*2.5) - ((roundKills*2.5)%1) + 2 |
|
1029 --p = (roundKills*2.5) + 2 |
|
1030 --if (p%2 ~= 0) then |
|
1031 -- p = p -0.5 |
|
1032 --end |
|
1033 |
|
1034 AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo) |
|
1035 AwardPoints(p) |
993 end |
1036 end |
994 |
1037 |
995 if ((shotsHit / shotsFired * 100) >= 80) and (shotsFired > 4) then |
1038 if ((shotsHit / shotsFired * 100) >= 80) and (shotsFired > 4) then |
996 AddCaption(loc("Accuracy Bonus!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
1039 AddCaption(loc("Accuracy Bonus!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
997 AwardPoints(15) |
1040 AwardPoints(15) |
1164 ------------------------------------------------------------ |
1207 ------------------------------------------------------------ |
1165 ------------------------------------------------------------ |
1208 ------------------------------------------------------------ |
1166 ------------------------------------------------------------ |
1209 ------------------------------------------------------------ |
1167 ------------------------------------------------------------ |
1210 ------------------------------------------------------------ |
1168 |
1211 |
1169 |
1212 function DoHorribleThings(cUID) |
1170 |
1213 |
|
1214 -- maybe |
|
1215 -- add a check to draw it inside the circ and not past it if |
|
1216 -- it is closer than 150 or w/e |
|
1217 |
|
1218 -- work out the distance to the target |
|
1219 g1X, g1Y = GetGearPosition(CurrentHedgehog) |
|
1220 g2X, g2Y = vCircX[cUID], vCircY[cUID] |
|
1221 q = g1X - g2X |
|
1222 w = g1Y - g2Y |
|
1223 r = math.sqrt( (q*q) + (w*w) ) --alternate |
|
1224 |
|
1225 |
|
1226 opp = w |
|
1227 if opp < 0 then |
|
1228 opp = opp*-1 |
|
1229 end |
|
1230 |
|
1231 -- work out the angle (theta) to the target |
|
1232 t = math.deg ( math.asin(opp / r) ) |
|
1233 |
|
1234 -- based on the radius of the radar, calculate what x/y displacement should be |
|
1235 NR = 150 -- radius at which to draw circs |
|
1236 NX = math.cos( math.rad(t) ) * NR |
|
1237 NY = math.sin( math.rad(t) ) * NR |
|
1238 |
|
1239 -- displace xy based on where this thing actually is |
|
1240 if q > 0 then |
|
1241 rCircX[cUID] = g1X - NX |
|
1242 else |
|
1243 rCircX[cUID] = g1X + NX |
|
1244 end |
|
1245 |
|
1246 if w > 0 then |
|
1247 rCircY[cUID] = g1Y - NY |
|
1248 else |
|
1249 rCircY[cUID] = g1Y + NY |
|
1250 end |
|
1251 |
|
1252 end |
1171 |
1253 |
1172 function PlayerIsFine() |
1254 function PlayerIsFine() |
1173 return (playerIsFine) |
1255 return (playerIsFine) |
1174 end |
1256 end |
1175 |
1257 |
1227 function CreateMeSomeCircles() |
1309 function CreateMeSomeCircles() |
1228 |
1310 |
1229 for i = 0, 7 do |
1311 for i = 0, 7 do |
1230 vCCount = vCCount +1 |
1312 vCCount = vCCount +1 |
1231 vCirc[i] = AddVisualGear(0,0,vgtCircle,0,true) |
1313 vCirc[i] = AddVisualGear(0,0,vgtCircle,0,true) |
|
1314 |
|
1315 rCirc[i] = AddVisualGear(0,0,vgtCircle,0,true) |
|
1316 rCircX[i] = 0 |
|
1317 rCircY[i] = 0 |
1232 |
1318 |
1233 vCircDX[i] = 0 |
1319 vCircDX[i] = 0 |
1234 vCircDY[i] = 0 |
1320 vCircDY[i] = 0 |
1235 |
1321 |
1236 vType[i] = "generic" |
1322 vType[i] = "generic" |
1255 vCircX[i], vCircY[i] = 0,0 |
1341 vCircX[i], vCircY[i] = 0,0 |
1256 |
1342 |
1257 vCircCol[i] = 0xff00ffff |
1343 vCircCol[i] = 0xff00ffff |
1258 |
1344 |
1259 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
1345 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
1346 |
|
1347 SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i]) |
|
1348 |
1260 end |
1349 end |
1261 |
1350 |
1262 pShield = AddVisualGear(0,0,vgtCircle,0,true) |
1351 pShield = AddVisualGear(0,0,vgtCircle,0,true) |
1263 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, 200, 1, 10, 0, 200, 5, 0xff00ffff) |
1352 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, 200, 1, 10, 0, 200, 5, 0xff00ffff) |
1264 |
1353 |
1355 AwardPoints(10) |
1444 AwardPoints(10) |
1356 end |
1445 end |
1357 |
1446 |
1358 elseif (vType[i] == "blueboss") then |
1447 elseif (vType[i] == "blueboss") then |
1359 PlaySound(sndHellishImpact3) |
1448 PlaySound(sndHellishImpact3) |
1360 AddCaption(loc("Boss defeated!") .. " +50 " .. loc("points") .. "!", 0x0050ffff,capgrpMessage) |
1449 AddCaption(loc("Boss defeated!") .. " +30 " .. loc("points") .. "!", 0x0050ffff,capgrpMessage) |
1361 |
1450 |
1362 morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1) |
1451 morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1) |
1363 SetHealth(morte, 0) |
1452 SetHealth(morte, 0) |
1364 |
1453 |
1365 BK = BK + 1 |
1454 BK = BK + 1 |
1446 vType[i] = "blueboss" |
1535 vType[i] = "blueboss" |
1447 vCircRadMin[i] = 100*5 |
1536 vCircRadMin[i] = 100*5 |
1448 vCircRadMax[i] = 180*5 |
1537 vCircRadMax[i] = 180*5 |
1449 vCircWidth[i] = 1 |
1538 vCircWidth[i] = 1 |
1450 vCounterLim[i] = 2000 |
1539 vCounterLim[i] = 2000 |
1451 vCircScore[i] = 50 |
1540 vCircScore[i] = 30 |
1452 vCircHealth[i] = 3 |
1541 vCircHealth[i] = 3 |
1453 else |
1542 else |
1454 --elseif r == 1 then |
1543 --elseif r == 1 then |
1455 --vCircCol[i] = 0xffae00ff -- orange |
1544 --vCircCol[i] = 0xffae00ff -- orange |
1456 vCircCol[i] = 0xa800ffff -- purp |
1545 vCircCol[i] = 0xa800ffff -- purp |
1479 vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i]) |
1568 vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i]) |
1480 |
1569 |
1481 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
1570 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
1482 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff) |
1571 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff) |
1483 -- - -0x000000ff |
1572 -- - -0x000000ff |
|
1573 |
|
1574 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(rCirc[i]) |
|
1575 SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff) |
|
1576 |
|
1577 |
1484 vCircActive[i] = true -- new |
1578 vCircActive[i] = true -- new |
1485 |
1579 |
1486 --nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i]) |
1580 --nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i]) |
1487 --nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i]) |
1581 --nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i]) |
1488 --nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i]) |
1582 --nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i]) |
1652 g2X, g2Y = vCircX[i], vCircY[i] |
1748 g2X, g2Y = vCircX[i], vCircY[i] |
1653 |
1749 |
1654 g1X = g1X - g2X |
1750 g1X = g1X - g2X |
1655 g1Y = g1Y - g2Y |
1751 g1Y = g1Y - g2Y |
1656 dist = (g1X*g1X) + (g1Y*g1Y) |
1752 dist = (g1X*g1X) + (g1Y*g1Y) |
|
1753 |
|
1754 --DoHorribleThings(i, g1X, g1Y, g2X, g2Y, dist) |
1657 |
1755 |
1658 --nw WriteLnToConsole("Calcs done. Dist to CurrentHedgehog is " .. dist) |
1756 --nw WriteLnToConsole("Calcs done. Dist to CurrentHedgehog is " .. dist) |
1659 |
1757 |
1660 -- calculate my real radius if I am an aura |
1758 -- calculate my real radius if I am an aura |
1661 if vCircType[i] == 0 then |
1759 if vCircType[i] == 0 then |
1717 -- runOnGears(ProjectileTrack) |
1814 -- runOnGears(ProjectileTrack) |
1718 --end |
1815 --end |
1719 |
1816 |
1720 end]] |
1817 end]] |
1721 |
1818 |
|
1819 |
|
1820 if rAlpha ~= 255 then |
|
1821 |
|
1822 rPingTimer = rPingTimer + 1 |
|
1823 if rPingTimer == 100 then |
|
1824 rPingTimer = 0 |
|
1825 |
|
1826 rAlpha = rAlpha + 5 |
|
1827 if rAlpha >= 255 then |
|
1828 rAlpha = 255 |
|
1829 end |
|
1830 end |
|
1831 |
|
1832 end |
|
1833 |
1722 for i = 0,(vCCount-1) do |
1834 for i = 0,(vCCount-1) do |
|
1835 |
|
1836 --if (vCircActive[i] == true) then |
|
1837 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
|
1838 --end |
1723 |
1839 |
1724 vCounter[i] = vCounter[i] + 1 |
1840 vCounter[i] = vCounter[i] + 1 |
1725 if vCounter[i] >= vCounterLim[i] then |
1841 if vCounter[i] >= vCounterLim[i] then |
1726 |
1842 |
1727 vCounter[i] = 0 |
1843 vCounter[i] = 0 |
1868 |
1984 |
1869 m2Count = 0 |
1985 m2Count = 0 |
1870 for i = 0,(vCCount-1) do |
1986 for i = 0,(vCCount-1) do |
1871 vCircX[i] = vCircX[i] + vCircDX[i] |
1987 vCircX[i] = vCircX[i] + vCircDX[i] |
1872 vCircY[i] = vCircY[i] + vCircDY[i] |
1988 vCircY[i] = vCircY[i] + vCircDY[i] |
|
1989 |
|
1990 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
|
1991 DoHorribleThings(i)--(i, g1X, g1Y, g2X, g2Y, dist) |
|
1992 end |
|
1993 |
1873 end |
1994 end |
1874 |
1995 |
1875 if (TimeLeft == 0) and (tumbleStarted == true) then |
1996 if (TimeLeft == 0) and (tumbleStarted == true) then |
1876 |
1997 |
1877 FadeAlpha = FadeAlpha + 1 |
1998 FadeAlpha = FadeAlpha + 1 |