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.9) |
8 --- Space Invasion Code Follows (1.0) |
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 (2.5*roundkills)+2 points) |
89 -- Shield Miser (don't use your shield at all (3.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 |
120 -- (hopefully) balanced Shield Miser |
120 -- (hopefully) balanced Shield Miser |
121 -- bosses are no longer a redunkulous 50 points, but toned down to 30 |
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:) |
122 -- experimental radar (it's INTERACTIVE and math-heavy :D) (visual gears are safe... right? D:) |
123 -- bugfix and balance for multishot |
123 -- bugfix and balance for multishot |
124 |
124 |
|
125 ------------------------ |
|
126 -- version 1.0 |
|
127 ------------------------ |
|
128 |
|
129 -- if only version numbers actually worked like this, wouldn't that be awful :D |
|
130 |
|
131 -- added surfer achievement |
|
132 -- increased value of shield miser by 1 point per kill (OP?) |
|
133 |
|
134 |
125 -------------------------- |
135 -------------------------- |
126 --notes for later |
136 --notes for later |
127 -------------------------- |
137 -------------------------- |
128 -- maybe add a check for a tie, NAH |
138 -- maybe add a check for a tie, NAH |
129 -- more achievements? (3 kamikazes in a row, long distance shooter, supreme shield expert/miser etc?) |
139 -- more achievements? (3 kamikazes in a row, long distance shooter, supreme shield expert/miser etc?) |
150 ----------------- |
160 ----------------- |
151 AddCaption(LOC_NOT("Boom! +25 points!"),0xffba00ff,capgrpVolume) |
161 AddCaption(LOC_NOT("Boom! +25 points!"),0xffba00ff,capgrpVolume) |
152 AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume) |
162 AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume) |
153 AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume) |
163 AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume) |
154 AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume) |
164 AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume) |
|
165 AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume) |
155 |
166 |
156 ----------------- |
167 ----------------- |
157 capgrpMessage |
168 capgrpMessage |
158 ----------------- |
169 ----------------- |
159 AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
170 AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
443 end |
461 end |
444 |
462 |
445 function AwardKills(t) |
463 function AwardKills(t) |
446 |
464 |
447 roundKills = roundKills + 1 |
465 roundKills = roundKills + 1 |
448 |
466 |
449 for i = 0,(TeamsCount-1) do |
467 for i = 0,(TeamsCount-1) do |
450 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
468 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
451 teamCircsKilled[i] = teamCircsKilled[i] + 1 |
469 teamCircsKilled[i] = teamCircsKilled[i] + 1 |
452 |
470 |
453 if teamCircsKilled[i] == 10 then |
471 if teamCircsKilled[i] == 10 then |
531 |
549 |
532 ShowMission("SPACE INVASION", loc("STATUS UPDATE"), loc("Rounds Complete") .. ": " .. roundNumber .. "/" .. roundLimit .. "| " .. "|" .. loc("Team Scores") .. ": |" ..entireC, 4, 1) |
550 ShowMission("SPACE INVASION", loc("STATUS UPDATE"), loc("Rounds Complete") .. ": " .. roundNumber .. "/" .. roundLimit .. "| " .. "|" .. loc("Team Scores") .. ": |" ..entireC, 4, 1) |
533 |
551 |
534 end |
552 end |
535 |
553 |
|
554 function onNewRound() |
|
555 roundNumber = roundNumber + 1 |
|
556 |
|
557 CommentOnScore() |
|
558 |
|
559 -- end game if its at round limit |
|
560 if roundNumber == roundLimit then |
|
561 |
|
562 for i = 0, (TeamsCount-1) do |
|
563 if teamScore[i] > bestScore then |
|
564 bestScore = teamScore[i] |
|
565 bestClan = teamClan[i] |
|
566 end |
|
567 end |
|
568 |
|
569 for i = 0, (numhhs-1) do |
|
570 if GetHogClan(hhs[i]) ~= bestClan then |
|
571 SetEffect(hhs[i], heResurrectable, false) |
|
572 SetHealth(hhs[i],0) |
|
573 end |
|
574 end |
|
575 gameOver = true |
|
576 TurnTimeLeft = 0 --1 |
|
577 TimeLeft = 0 |
|
578 end |
|
579 end |
|
580 |
536 -- gaudy racer |
581 -- gaudy racer |
537 function CheckForNewRound() |
582 function CheckForNewRound() |
538 |
583 |
|
584 ---------- |
|
585 -- new |
|
586 ---------- |
|
587 |
|
588 --[[if gameBegun == true then |
|
589 |
|
590 if RoundHasChanged == true then |
|
591 roundN = roundN + 1 |
|
592 RoundHasChanged = false |
|
593 onNewRound() |
|
594 end |
|
595 |
|
596 if lastRound ~= TotalRounds then -- new round, but not really |
|
597 |
|
598 if RoundHasChanged == false then |
|
599 RoundHasChanged = true |
|
600 end |
|
601 |
|
602 end |
|
603 |
|
604 --AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds) |
|
605 lastRound = TotalRounds |
|
606 |
|
607 end]] |
|
608 |
|
609 ---------- |
|
610 -- old |
|
611 ---------- |
539 if GetHogClan(CurrentHedgehog) == firstClan then |
612 if GetHogClan(CurrentHedgehog) == firstClan then |
540 |
613 onNewRound() |
541 roundNumber = roundNumber + 1 |
|
542 |
|
543 CommentOnScore() |
|
544 |
|
545 -- end game if its at round limit |
|
546 if roundNumber == roundLimit then |
|
547 |
|
548 for i = 0, (TeamsCount-1) do |
|
549 if teamScore[i] > bestScore then |
|
550 bestScore = teamScore[i] |
|
551 bestClan = teamClan[i] |
|
552 end |
|
553 end |
|
554 |
|
555 for i = 0, (numhhs-1) do |
|
556 if GetHogClan(hhs[i]) ~= bestClan then |
|
557 SetEffect(hhs[i], heResurrectable, false) |
|
558 SetHealth(hhs[i],0) |
|
559 end |
|
560 end |
|
561 gameOver = true |
|
562 TurnTimeLeft = 0 --1 |
|
563 TimeLeft = 0 |
|
564 end |
|
565 |
|
566 end |
614 end |
567 |
615 |
568 end |
616 end |
569 |
617 |
570 |
618 |
728 end |
776 end |
729 end |
777 end |
730 |
778 |
731 function onHJump() |
779 function onHJump() |
732 |
780 |
733 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and |
781 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and |
734 (rAlpha == 255) and (radShotsLeft > 0) then |
782 (rAlpha == 255) and (radShotsLeft > 0) then |
735 rPingTimer = 0 |
783 rPingTimer = 0 |
736 rAlpha = 0 |
784 rAlpha = 0 |
737 radShotsLeft = radShotsLeft -1 |
785 radShotsLeft = radShotsLeft -1 |
738 AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage) |
786 AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage) |
1022 HideTags() |
1072 HideTags() |
1023 rAlpha = 255 |
1073 rAlpha = 255 |
1024 --nw WriteLnToConsole("Player is out of luck") |
1074 --nw WriteLnToConsole("Player is out of luck") |
1025 |
1075 |
1026 if shieldMiser == true then |
1076 if shieldMiser == true then |
1027 |
1077 |
1028 p = (roundKills*2.5) - ((roundKills*2.5)%1) + 2 |
1078 p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2 |
1029 --p = (roundKills*2.5) + 2 |
|
1030 --if (p%2 ~= 0) then |
|
1031 -- p = p -0.5 |
|
1032 --end |
|
1033 |
1079 |
1034 AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo) |
1080 AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo) |
1035 AwardPoints(p) |
1081 AwardPoints(p) |
1036 end |
1082 end |
1037 |
1083 |
1071 SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) ) |
1117 SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) ) |
1072 end |
1118 end |
1073 -------------- |
1119 -------------- |
1074 -------------- |
1120 -------------- |
1075 |
1121 |
|
1122 ------------------------ |
|
1123 -- surfer achievement |
|
1124 ------------------------ |
|
1125 |
|
1126 if (WaterLine - GetY(CurrentHedgehog)) < 15 then |
|
1127 SurfTime = SurfTime -1 |
|
1128 end |
|
1129 |
|
1130 if SurfTime ~= 12 then |
|
1131 |
|
1132 SurfTime = SurfTime - 1 |
|
1133 if SurfTime <= 0 then |
|
1134 for i = 0,(TeamsCount-1) do |
|
1135 if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then |
|
1136 teamSurfer[i] = true |
|
1137 SurfTime = 12 |
|
1138 AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume) |
|
1139 AwardPoints(15) |
|
1140 end |
|
1141 end |
|
1142 end |
|
1143 end |
|
1144 |
|
1145 |
1076 dx, dy = GetGearVelocity(CurrentHedgehog) |
1146 dx, dy = GetGearVelocity(CurrentHedgehog) |
1077 |
1147 |
1078 --WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy) |
1148 --WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy) |
1079 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1149 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1080 |
1150 |
1209 ------------------------------------------------------------ |
1279 ------------------------------------------------------------ |
1210 ------------------------------------------------------------ |
1280 ------------------------------------------------------------ |
1211 |
1281 |
1212 function DoHorribleThings(cUID) |
1282 function DoHorribleThings(cUID) |
1213 |
1283 |
1214 -- maybe |
1284 -- maybe |
1215 -- add a check to draw it inside the circ and not past it if |
1285 -- add a check to draw it inside the circ and not past it if |
1216 -- it is closer than 150 or w/e |
1286 -- it is closer than 150 or w/e |
1217 |
1287 |
1218 -- work out the distance to the target |
1288 -- work out the distance to the target |
1219 g1X, g1Y = GetGearPosition(CurrentHedgehog) |
1289 g1X, g1Y = GetGearPosition(CurrentHedgehog) |
1220 g2X, g2Y = vCircX[cUID], vCircY[cUID] |
1290 g2X, g2Y = vCircX[cUID], vCircY[cUID] |
1221 q = g1X - g2X |
1291 q = g1X - g2X |
1222 w = g1Y - g2Y |
1292 w = g1Y - g2Y |
1223 r = math.sqrt( (q*q) + (w*w) ) --alternate |
1293 r = math.sqrt( (q*q) + (w*w) ) --alternate |
1224 |
1294 |
1225 |
1295 |
1226 opp = w |
1296 opp = w |
1227 if opp < 0 then |
1297 if opp < 0 then |
1228 opp = opp*-1 |
1298 opp = opp*-1 |
1229 end |
1299 end |
1230 |
1300 |
1231 -- work out the angle (theta) to the target |
1301 -- work out the angle (theta) to the target |
1232 t = math.deg ( math.asin(opp / r) ) |
1302 t = math.deg ( math.asin(opp / r) ) |
1233 |
1303 |
1234 -- based on the radius of the radar, calculate what x/y displacement should be |
1304 -- based on the radius of the radar, calculate what x/y displacement should be |
1235 NR = 150 -- radius at which to draw circs |
1305 NR = 150 -- radius at which to draw circs |
1236 NX = math.cos( math.rad(t) ) * NR |
1306 NX = math.cos( math.rad(t) ) * NR |
1237 NY = math.sin( math.rad(t) ) * NR |
1307 NY = math.sin( math.rad(t) ) * NR |
1238 |
1308 |
1239 -- displace xy based on where this thing actually is |
1309 -- displace xy based on where this thing actually is |
1240 if q > 0 then |
1310 if q > 0 then |
1241 rCircX[cUID] = g1X - NX |
1311 rCircX[cUID] = g1X - NX |
1242 else |
1312 else |
1243 rCircX[cUID] = g1X + NX |
1313 rCircX[cUID] = g1X + NX |
1571 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff) |
1641 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff) |
1572 -- - -0x000000ff |
1642 -- - -0x000000ff |
1573 |
1643 |
1574 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(rCirc[i]) |
1644 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) |
1645 SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff) |
1576 |
1646 |
1577 |
1647 |
1578 vCircActive[i] = true -- new |
1648 vCircActive[i] = true -- new |
1579 |
1649 |
1580 --nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i]) |
1650 --nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i]) |
1581 --nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i]) |
1651 --nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i]) |
1814 -- runOnGears(ProjectileTrack) |
1884 -- runOnGears(ProjectileTrack) |
1815 --end |
1885 --end |
1816 |
1886 |
1817 end]] |
1887 end]] |
1818 |
1888 |
1819 |
1889 |
1820 if rAlpha ~= 255 then |
1890 if rAlpha ~= 255 then |
1821 |
1891 |
1822 rPingTimer = rPingTimer + 1 |
1892 rPingTimer = rPingTimer + 1 |
1823 if rPingTimer == 100 then |
1893 if rPingTimer == 100 then |
1824 rPingTimer = 0 |
1894 rPingTimer = 0 |
1825 |
1895 |
1826 rAlpha = rAlpha + 5 |
1896 rAlpha = rAlpha + 5 |
1827 if rAlpha >= 255 then |
1897 if rAlpha >= 255 then |
1828 rAlpha = 255 |
1898 rAlpha = 255 |
1829 end |
1899 end |
1830 end |
1900 end |
1831 |
1901 |
1832 end |
1902 end |
1833 |
1903 |
1834 for i = 0,(vCCount-1) do |
1904 for i = 0,(vCCount-1) do |
1835 |
1905 |
1836 --if (vCircActive[i] == true) then |
1906 --if (vCircActive[i] == true) then |
1837 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
1907 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
1838 --end |
1908 --end |
1839 |
1909 |
1840 vCounter[i] = vCounter[i] + 1 |
1910 vCounter[i] = vCounter[i] + 1 |
1841 if vCounter[i] >= vCounterLim[i] then |
1911 if vCounter[i] >= vCounterLim[i] then |
1842 |
1912 |
1985 m2Count = 0 |
2055 m2Count = 0 |
1986 for i = 0,(vCCount-1) do |
2056 for i = 0,(vCCount-1) do |
1987 vCircX[i] = vCircX[i] + vCircDX[i] |
2057 vCircX[i] = vCircX[i] + vCircDX[i] |
1988 vCircY[i] = vCircY[i] + vCircDY[i] |
2058 vCircY[i] = vCircY[i] + vCircDY[i] |
1989 |
2059 |
1990 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2060 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
1991 DoHorribleThings(i)--(i, g1X, g1Y, g2X, g2Y, dist) |
2061 DoHorribleThings(i)--(i, g1X, g1Y, g2X, g2Y, dist) |
1992 end |
2062 end |
1993 |
2063 |
1994 end |
2064 end |
1995 |
2065 |
1996 if (TimeLeft == 0) and (tumbleStarted == true) then |
2066 if (TimeLeft == 0) and (tumbleStarted == true) then |