412 --------------------- |
407 --------------------- |
413 -- awards (for stats section, just for fun) |
408 -- awards (for stats section, just for fun) |
414 --------------------- |
409 --------------------- |
415 -- global awards |
410 -- global awards |
416 local awardTotalKills=0 -- overall killed invaders (min. 30) |
411 local awardTotalKills=0 -- overall killed invaders (min. 30) |
417 |
|
418 -- TODO: team awards (currently unused) |
|
419 local awardBoss -- most boss kills (min. 3) |
|
420 local awardKamikaze -- most kamikaze bonuses (min. 3) |
|
421 local awardSniper -- most sniper shots (min. 3) |
|
422 local awardAbsorber -- most absorbed (with shield) projectiles (min. 20) |
|
423 local awardFierceComps -- most fierce competition achievements |
|
424 local awardNoShield -- no shield used in entire game (if there are multiple teams, award goes to team with most kills) |
|
425 local awardCollector -- most ammo and shield invaders collected |
|
426 |
412 |
427 -- hog awards |
413 -- hog awards |
428 local awardRoundScore -- hog with most score in 1 round (min. 50) |
414 local awardRoundScore -- hog with most score in 1 round (min. 50) |
429 local awardRoundKills -- most kills in 1 round (min. 5) |
415 local awardRoundKills -- most kills in 1 round (min. 5) |
430 local awardAccuracy -- awarded to hog who didn’t miss once in his round, with most kills (min. 5) |
416 local awardAccuracy -- awarded to hog who didn’t miss once in his round, with most kills (min. 5) |
1031 if getGearValue(gear,"lifespan") == 0 then |
968 if getGearValue(gear,"lifespan") == 0 then |
1032 |
969 |
1033 if GetGearType(gear) == gtShell then |
970 if GetGearType(gear) == gtShell then |
1034 AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
971 AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
1035 |
972 |
1036 --AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
1037 WriteLnToConsole("about to delete a shell due to lifespan == 0") |
973 WriteLnToConsole("about to delete a shell due to lifespan == 0") |
1038 --elseif GetGearType(gear) == gtBall then |
|
1039 -- AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true) |
|
1040 elseif GetGearType(gear) == gtExplosives then |
974 elseif GetGearType(gear) == gtExplosives then |
1041 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
975 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
1042 PlaySound(sndExplosion) |
976 PlaySound(sndExplosion) |
1043 --nw WriteLnToConsole("about to delete a explosive due to lifespan == 0") |
|
1044 elseif GetGearType(gear) == gtFlame then |
977 elseif GetGearType(gear) == gtFlame then |
1045 AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
978 AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
1046 --WriteLnToConsole("about to delete flame due to lifespan == 0") |
|
1047 end |
979 end |
1048 |
980 |
1049 DeleteGear(gear) |
981 DeleteGear(gear) |
1050 |
982 |
1051 end |
983 end |
1138 AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
1068 AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
1139 ]] |
1069 ]] |
1140 |
1070 |
1141 end |
1071 end |
1142 |
1072 |
1143 --function onTimer() |
|
1144 |
|
1145 -- experimental wep |
|
1146 --[[SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xff33ffff) |
|
1147 AddCaption("boom") |
|
1148 PlaySound(sndWarp) |
|
1149 shockwaveHealth = 100 |
|
1150 shockwaveRad = 100]] |
|
1151 |
|
1152 |
|
1153 --change wep |
|
1154 --ChangeWeapon() |
|
1155 |
|
1156 -- booster |
|
1157 --[[if boosterOn == false then |
|
1158 boosterOn = true |
|
1159 else |
|
1160 boosterOn = false |
|
1161 end]] |
|
1162 |
|
1163 --end |
|
1164 |
|
1165 -- o rite dis wan iz liek synched n stuff hope full lee |
|
1166 -- old method |
|
1167 --[[function onPrecise() |
|
1168 |
|
1169 |
|
1170 -- Fire Barrel |
|
1171 if (primShotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
|
1172 |
|
1173 shotsFired = shotsFired +1 |
|
1174 |
|
1175 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1) |
|
1176 |
|
1177 primShotsLeft = primShotsLeft - 1 |
|
1178 |
|
1179 if primShotsLeft == 0 then |
|
1180 PlaySound(sndSuddenDeath) |
|
1181 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
|
1182 else |
|
1183 AddCaption(loc("Ammo") .. ": " .. primShotsLeft) |
|
1184 end |
|
1185 DrawTag(1) |
|
1186 |
|
1187 CopyPV(CurrentHedgehog, morte) -- new addition |
|
1188 x,y = GetGearVelocity(morte) |
|
1189 |
|
1190 x = x*2 |
|
1191 y = y*2 |
|
1192 SetGearVelocity(morte, x, y) |
|
1193 |
|
1194 |
|
1195 elseif (primShotsLeft == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
|
1196 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
|
1197 end |
|
1198 |
|
1199 |
|
1200 end]] |
|
1201 |
|
1202 -- derp tumbler |
1073 -- derp tumbler |
1203 function onPrecise() |
1074 function onPrecise() |
1204 |
1075 |
1205 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then |
1076 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then |
1206 |
1077 |
1207 wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 |
1078 wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 |
1208 --AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
|
1209 |
1079 |
1210 if wep[wepIndex] == loc("Barrel Launcher") then |
1080 if wep[wepIndex] == loc("Barrel Launcher") then |
1211 shotsFired = shotsFired +1 |
1081 shotsFired = shotsFired +1 |
1212 |
1082 |
1213 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1) |
1083 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1) |
1955 g1X, g1Y = GetGearPosition(gear) |
1776 g1X, g1Y = GetGearPosition(gear) |
1956 g2X, g2Y = GetGearPosition(gear2) |
1777 g2X, g2Y = GetGearPosition(gear2) |
1957 q = g1X - g2X |
1778 q = g1X - g2X |
1958 w = g1Y - g2Y |
1779 w = g1Y - g2Y |
1959 |
1780 |
1960 |
|
1961 --[[ |
|
1962 WriteLnToConsole("I just got the position of two gears and calculated the distance betwen them") |
|
1963 if gear == CurrentHedgehog then |
|
1964 WriteLnToConsole("Gear 1 is CurrentHedgehog.") |
|
1965 end |
|
1966 if gear2 == CurrentHedgehog then |
|
1967 WriteLnToConsole("Gear 2 is CurrentHedgehog.") |
|
1968 end |
|
1969 WriteLnToConsole("G1X: " .. g1X .. "; G1Y: " .. g1Y) |
|
1970 WriteLnToConsole("G2X: " .. g2X .. "; G2Y: " .. g2Y) |
|
1971 WriteLnToConsole("Their distance is " .. (q*q) + (w*w) ) |
|
1972 WriteLnToConsole("The above events occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
|
1973 ]] |
|
1974 |
|
1975 |
|
1976 return ( (q*q) + (w*w) ) |
1781 return ( (q*q) + (w*w) ) |
1977 |
1782 |
1978 end |
1783 end |
1979 |
1784 |
1980 function GetDistFromGearToXY(gear, g2X, g2Y) |
1785 function GetDistFromGearToXY(gear, g2X, g2Y) |
1981 |
1786 |
1982 g1X, g1Y = GetGearPosition(gear) |
1787 g1X, g1Y = GetGearPosition(gear) |
1983 q = g1X - g2X |
1788 q = g1X - g2X |
1984 w = g1Y - g2Y |
1789 w = g1Y - g2Y |
1985 |
1790 |
1986 |
|
1987 --[[WriteLnToConsole("I just got the position of a gear and calculated the distance betwen it and another xy") |
|
1988 if gear == CurrentHedgehog then |
|
1989 WriteLnToConsole("Gear 1 is CurrentHedgehog.") |
|
1990 end |
|
1991 |
|
1992 WriteLnToConsole("G1X: " .. g1X .. "; G1Y: " .. g1Y) |
|
1993 WriteLnToConsole("Other X: " .. g2X .. "; Other Y: " .. g2Y) |
|
1994 WriteLnToConsole("Their distance is " .. (q*q) + (w*w) ) |
|
1995 WriteLnToConsole("The above events occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
|
1996 ]] |
|
1997 |
|
1998 |
|
1999 return ( (q*q) + (w*w) ) |
1791 return ( (q*q) + (w*w) ) |
2000 |
|
2001 |
1792 |
2002 end |
1793 end |
2003 |
1794 |
2004 function CreateMeSomeCircles() |
1795 function CreateMeSomeCircles() |
2005 |
1796 |
2042 SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i]) |
1833 SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i]) |
2043 |
1834 |
2044 end |
1835 end |
2045 |
1836 |
2046 pShield = AddVisualGear(0,0,vgtCircle,0,true) |
1837 pShield = AddVisualGear(0,0,vgtCircle,0,true) |
2047 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, 200, 1, 10, 0, 200, 5, 0xff00ffff) |
|
2048 |
|
2049 |
1838 |
2050 shockwave = AddVisualGear(0,0,vgtCircle,0,true) |
1839 shockwave = AddVisualGear(0,0,vgtCircle,0,true) |
2051 |
1840 |
2052 end |
1841 end |
2053 |
1842 |
2054 function IGotMeASafeXYValue(i) |
1843 function IGotMeASafeXYValue(i) |
2055 |
1844 |
2056 acceptibleDistance = 800 |
1845 acceptibleDistance = 800 |
2057 |
|
2058 -- put this in here to thwart attempts at repositioning and test sanity limit |
|
2059 --vCircX[i] = GetX(CurrentHedgehog)+250 |
|
2060 --vCircY[i] = GetY(CurrentHedgehog)+250 |
|
2061 |
1846 |
2062 vCircX[i] = GetRandom(5000) |
1847 vCircX[i] = GetRandom(5000) |
2063 vCircY[i] = GetRandom(2000) |
1848 vCircY[i] = GetRandom(2000) |
2064 dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i]) |
1849 dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i]) |
2065 if dist > acceptibleDistance*acceptibleDistance then |
1850 if dist > acceptibleDistance*acceptibleDistance then |
2123 AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false) |
1907 AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false) |
2124 AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false) |
1908 AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false) |
2125 AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false) |
1909 AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false) |
2126 |
1910 |
2127 PlaySound(sndVaporize) |
1911 PlaySound(sndVaporize) |
2128 --sndWarp sndMineTick --sndSwitchHog --sndSuddenDeath |
|
2129 |
1912 |
2130 shieldHealth = shieldHealth + shieldBonus |
1913 shieldHealth = shieldHealth + shieldBonus |
2131 AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage) |
1914 AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage) |
2132 if shieldHealth >= 250 then |
1915 if shieldHealth >= 250 then |
2133 shieldHealth = 250 |
1916 shieldHealth = 250 |
2244 |
2017 |
2245 end |
2018 end |
2246 |
2019 |
2247 -- regenerate circle xy if too close to player or until sanity limit kicks in |
2020 -- regenerate circle xy if too close to player or until sanity limit kicks in |
2248 reN = 0 |
2021 reN = 0 |
2249 --zzz = 0 |
|
2250 while (reN < 10) do |
2022 while (reN < 10) do |
2251 if IGotMeASafeXYValue(i) == false then |
2023 if IGotMeASafeXYValue(i) == false then |
2252 reN = reN + 1 |
2024 reN = reN + 1 |
2253 --zzz = zzz + 1 |
|
2254 else |
2025 else |
2255 reN = 15 |
2026 reN = 15 |
2256 end |
2027 end |
2257 end |
2028 end |
2258 --AddCaption("Took me this many retries: " .. zzz) -- number of times it took to work |
|
2259 |
2029 |
2260 vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i]) |
2030 vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i]) |
2261 |
2031 |
2262 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
2032 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
2263 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff) |
2033 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff) |
2264 -- - -0x000000ff |
|
2265 |
2034 |
2266 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(rCirc[i]) |
2035 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(rCirc[i]) |
2267 SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff) |
2036 SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff) |
2268 |
2037 |
2269 |
2038 |
2270 vCircActive[i] = true -- new |
2039 vCircActive[i] = true |
2271 |
2040 |
2272 --nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i]) |
2041 --nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i]) |
2273 --nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i]) |
2042 --nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i]) |
2274 --nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i]) |
2043 --nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i]) |
2275 |
2044 |
2320 end |
2089 end |
2321 |
2090 |
2322 --- collision detection for weapons fire |
2091 --- collision detection for weapons fire |
2323 function CheckVarious(gear) |
2092 function CheckVarious(gear) |
2324 |
2093 |
2325 --if (GetGearType(gear) == gtExplosives) then |
|
2326 --nw WriteLnToConsole("Start of CheckVarious(): Exp ID: " .. getGearValue(gear,"ID")) |
|
2327 --elseif (GetGearType(gear) == gtShell) then |
|
2328 --nw WriteLnToConsole("Start of CheckVarious(): Shell ID: " .. getGearValue(gear,"ID")) |
|
2329 --end |
|
2330 |
|
2331 targetHit = false |
2094 targetHit = false |
2332 |
2095 |
2333 -- if circle is hit by player fire |
2096 -- if circle is hit by player fire |
2334 if (GetGearType(gear) == gtExplosives) then |
2097 if (GetGearType(gear) == gtExplosives) then |
2335 circsHit = 0 |
2098 circsHit = 0 |
2336 |
2099 |
2337 for i = 0,(vCCount-1) do |
2100 for i = 0,(vCCount-1) do |
2338 |
2101 |
2339 --nw WriteLnToConsole("Is it neccessary to check for collision with circ " .. i) |
2102 --nw WriteLnToConsole("Is it neccessary to check for collision with circ " .. i) |
2340 |
2103 |
2341 --if (vCircActive[i] == true) and ( (vType[i] == "drone") ) then |
2104 --nw WriteLnToConsole("YES. about to calc distance between gtExplosives and circ " .. i) |
2342 |
2105 |
2343 --nw WriteLnToConsole("YES. about to calc distance between gtExplosives and circ " .. i) |
2106 dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i]) |
2344 |
2107 |
2345 dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i]) |
2108 -- calculate my real radius if I am an aura |
2346 |
2109 if vCircType[i] == 0 then |
2347 -- calculate my real radius if I am an aura |
2110 NR = vCircRadius[i] |
2348 if vCircType[i] == 0 then |
2111 else |
2349 NR = vCircRadius[i] |
2112 NR = (48/100*vCircRadius[i])/2 |
2350 else |
2113 end |
2351 NR = (48/100*vCircRadius[i])/2 |
2114 |
|
2115 if dist <= NR*NR then |
|
2116 |
|
2117 |
|
2118 --nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!") |
|
2119 |
|
2120 dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR)) |
|
2121 --AddCaption(loc("Dist: ") .. dist .. "!",0xffba00ff,capgrpGameState) |
|
2122 if dist >= 1000000 then |
|
2123 sniperHits = sniperHits +1 |
|
2124 AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
2125 AwardPoints(8) |
|
2126 if sniperHits == 3 then |
|
2127 sniperHits = 0 |
|
2128 AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
2129 AwardPoints(16) |
|
2130 end |
|
2131 elseif dist <= 6000 then |
|
2132 pointBlankHits = pointBlankHits +1 |
|
2133 if pointBlankHits == 3 then |
|
2134 pointBlankHits = 0 |
|
2135 AddCaption(loc("Point Blank Combo!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
2136 AwardPoints(5) |
|
2137 end |
2352 end |
2138 end |
2353 |
2139 |
2354 if dist <= NR*NR then |
2140 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
2355 |
2141 |
2356 |
2142 targetHit = true |
2357 --nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!") |
2143 --WriteLnToConsole("set " .. "Exp ID: " .. getGearValue(gear,"ID") .. " health to 0") |
2358 |
2144 --WriteLnToConsole("targetHit set to true, explosive is at distance " .. dist .. "(within range " .. NR*NR.. ") of circ" ) |
2359 dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR)) |
2145 |
2360 --AddCaption(loc("Dist: ") .. dist .. "!",0xffba00ff,capgrpGameState) |
2146 CircleDamaged(i) |
2361 if dist >= 1000000 then |
2147 |
2362 sniperHits = sniperHits +1 |
2148 circsHit = circsHit + 1 |
2363 AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
2149 if circsHit > 1 then |
2364 AwardPoints(8) |
2150 AddCaption(loc("Multi-shot!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate) |
2365 if sniperHits == 3 then |
2151 AwardPoints(15) |
2366 sniperHits = 0 |
|
2367 AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
2368 AwardPoints(16) |
|
2369 end |
|
2370 elseif dist <= 6000 then |
|
2371 pointBlankHits = pointBlankHits +1 |
|
2372 if pointBlankHits == 3 then |
|
2373 pointBlankHits = 0 |
|
2374 AddCaption(loc("Point Blank Combo!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
2375 AwardPoints(5) |
|
2376 end |
|
2377 end |
|
2378 |
|
2379 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
|
2380 |
|
2381 targetHit = true |
|
2382 --DeleteGear(gear) |
|
2383 --SetHealth(gear,0) |
|
2384 --WriteLnToConsole("set " .. "Exp ID: " .. getGearValue(gear,"ID") .. " health to 0") |
|
2385 --WriteLnToConsole("targetHit set to true, explosive is at distance " .. dist .. "(within range " .. NR*NR.. ") of circ" ) |
|
2386 |
|
2387 CircleDamaged(i) |
|
2388 |
|
2389 circsHit = circsHit + 1 |
|
2390 if circsHit > 1 then |
|
2391 AddCaption(loc("Multi-shot!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate) |
|
2392 AwardPoints(15) |
|
2393 circsHit = 0 |
2152 circsHit = 0 |
2394 end |
|
2395 |
|
2396 shotsHit = shotsHit + 1 |
|
2397 |
|
2398 |
|
2399 |
|
2400 end |
2153 end |
2401 |
2154 |
2402 --end |
2155 shotsHit = shotsHit + 1 |
|
2156 |
|
2157 end |
2403 |
2158 |
2404 end |
2159 end |
2405 |
2160 |
2406 -- if player is hit by circle bazooka |
2161 -- if player is hit by circle bazooka |
2407 elseif (GetGearType(gear) == gtShell) then --or (GetGearType(gear) == gtBall) then |
2162 elseif (GetGearType(gear) == gtShell) then |
2408 |
2163 |
2409 dist = GetDistFromGearToGear(gear, CurrentHedgehog) |
2164 dist = GetDistFromGearToGear(gear, CurrentHedgehog) |
2410 |
2165 |
2411 if beam == true then |
2166 if beam == true then |
2412 |
2167 |
2552 |
2283 |
2553 end |
2284 end |
2554 |
2285 |
2555 for i = 0,(vCCount-1) do |
2286 for i = 0,(vCCount-1) do |
2556 |
2287 |
2557 --if (vCircActive[i] == true) then |
2288 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
2558 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
|
2559 --end |
|
2560 |
|
2561 |
|
2562 |
2289 |
2563 vCounter[i] = vCounter[i] + 1 |
2290 vCounter[i] = vCounter[i] + 1 |
2564 if vCounter[i] >= vCounterLim[i] then |
2291 if vCounter[i] >= vCounterLim[i] then |
2565 |
2292 |
2566 vCounter[i] = 0 |
2293 vCounter[i] = 0 |
2567 |
2294 |
2568 if ((vType[i] == "drone") or (vType[i] == "blueboss") ) and |
2295 if ((vType[i] == "drone") or (vType[i] == "blueboss") ) and |
2569 (vCircActive[i] == true) then |
2296 (vCircActive[i] == true) then |
2570 AddGear(vCircX[i], vCircY[i], gtShell, 0, 0, 0, 1) |
2297 AddGear(vCircX[i], vCircY[i], gtShell, 0, 0, 0, 1) |
2571 |
2298 |
2572 --WriteLnToConsole("Circle " .. i .. " just fired/added a gtShell") |
|
2573 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
|
2574 |
|
2575 --elseif (vType[i] == "bluebottle") and (vCircActive[i] == true) then |
|
2576 -- AddGear(vCircX[i], vCircY[i]-vCircRadius[i], gtBall, 0, 0, 0, 1) |
|
2577 -- AddGear(vCircX[i], vCircY[i]+vCircRadius[i], gtBall, 0, 0, 0, 1) |
|
2578 -- AddGear(vCircX[i]-vCircRadius[i], vCircY[i], gtBall, 0, 0, 0, 1) |
|
2579 -- AddGear(vCircX[i]+vCircRadius[i], vCircY[i], gtBall, 0, 0, 0, 1) |
|
2580 end |
2299 end |
2581 |
2300 |
2582 end |
2301 end |
2583 |
2302 |
2584 if (vCircActive[i] == true) then |
2303 if (vCircActive[i] == true) then |
2611 --vgtDust -- short trail on earthrise |
2330 --vgtDust -- short trail on earthrise |
2612 --vgtSmokeTrace |
2331 --vgtSmokeTrace |
2613 if vType[i] == "ammo" then |
2332 if vType[i] == "ammo" then |
2614 |
2333 |
2615 tempE = AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, true) |
2334 tempE = AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, true) |
2616 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) --0xff00ffff --0x00ff00ff |
2335 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
2617 SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, g8, g9, vCircCol[i] ) |
2336 SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, g8, g9, vCircCol[i] ) |
2618 |
2337 |
2619 --AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true) |
|
2620 |
|
2621 elseif vType[i] == "bonus" then |
2338 elseif vType[i] == "bonus" then |
2622 |
2339 |
2623 tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true) |
2340 tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true) |
2624 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) --0xff00ffff --0x00ff00ff --vCircCol[i] |
2341 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
2625 SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, 1, g9, 0xff00ffff ) |
2342 SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, 1, g9, 0xff00ffff ) |
2626 |
2343 |
2627 |
2344 |
2628 elseif vType[i] == "blueboss" then |
2345 elseif vType[i] == "blueboss" then |
2629 |
2346 |
2633 |
2350 |
2634 -- 0xffae00ff -- orange |
2351 -- 0xffae00ff -- orange |
2635 -- 0xae00ffff -- purp |
2352 -- 0xae00ffff -- purp |
2636 |
2353 |
2637 tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true) |
2354 tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true) |
2638 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) --0xff00ffff --0x00ff00ff |
2355 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
2639 SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 ) |
2356 SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 ) |
2640 |
2357 |
2641 tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true) |
2358 tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true) |
2642 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) --0xff00ffff --0x00ff00ff |
2359 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
2643 SetVisualGearValues(tempE, vCircX[i]+k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 ) |
2360 SetVisualGearValues(tempE, vCircX[i]+k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 ) |
2644 |
2361 |
2645 tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true) |
2362 tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true) |
2646 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) --0xff00ffff --0x00ff00ff |
2363 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
2647 SetVisualGearValues(tempE, vCircX[i]-k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 ) |
2364 SetVisualGearValues(tempE, vCircX[i]-k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 ) |
2648 |
2365 |
2649 |
2366 |
2650 end |
2367 end |
2651 |
2368 |
2709 for i = 0,(vCCount-1) do |
2426 for i = 0,(vCCount-1) do |
2710 vCircX[i] = vCircX[i] + vCircDX[i] |
2427 vCircX[i] = vCircX[i] + vCircDX[i] |
2711 vCircY[i] = vCircY[i] + vCircDY[i] |
2428 vCircY[i] = vCircY[i] + vCircDY[i] |
2712 |
2429 |
2713 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2430 if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then |
2714 DoHorribleThings(i)--(i, g1X, g1Y, g2X, g2Y, dist) |
2431 DoHorribleThings(i) |
2715 end |
2432 end |
2716 |
2433 |
2717 end |
2434 end |
2718 |
2435 |
2719 if (TimeLeft == 0) and (tumbleStarted == true) then |
2436 if (TimeLeft == 0) and (tumbleStarted == true) then |
2720 |
2437 |
2721 FadeAlpha = FadeAlpha + 1 |
2438 FadeAlpha = FadeAlpha + 1 |
2722 if FadeAlpha >= 255 then |
2439 if FadeAlpha >= 255 then |
2723 FadeAlpha = 255 |
2440 FadeAlpha = 255 |
2724 end |
2441 end |
2725 |
|
2726 --new |
|
2727 --if FadeAlpha == 1 then |
|
2728 -- AddCaption("GOT IT") |
|
2729 -- for i = 0,(vCCount-1) do |
|
2730 -- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
|
2731 -- vCircCol[i] = g10 |
|
2732 -- end |
|
2733 --end |
|
2734 |
2442 |
2735 end |
2443 end |
2736 |
2444 |
2737 |
2445 |
2738 -- derp |
2446 -- derp |
2739 if shockwaveHealth > 0 then |
2447 if shockwaveHealth > 0 then |
2740 shockwaveHealth = shockwaveHealth - 1 |
2448 shockwaveHealth = shockwaveHealth - 1 |
2741 shockwaveRad = shockwaveRad + 80 |
2449 shockwaveRad = shockwaveRad + 80 |
2742 |
2450 end |
2743 --mrm = ((48/100*shockwaveRad)/2) |
|
2744 --AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false) |
|
2745 end |
|
2746 |
|
2747 |
|
2748 |
2451 |
2749 end |
2452 end |
2750 |
2453 |
2751 for i = 0,(vCCount-1) do |
2454 for i = 0,(vCCount-1) do |
2752 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2455 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
2753 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2456 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2754 end |
2457 end |
2755 |
2458 |
2756 if (TimeLeft == 0) or |
2459 if (TimeLeft == 0) or |
2757 ((tumbleStarted == false)) then |
2460 ((tumbleStarted == false)) then |
2758 for i = 0,(vCCount-1) do |
2461 for i = 0,(vCCount-1) do |
2759 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2462 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) |
2760 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, (vCircCol[i]-FadeAlpha)) |
2463 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, (vCircCol[i]-FadeAlpha)) |
2761 end |
2464 end |
2762 end |
2465 end |
2763 |
2466 |
2764 |
2467 |
2765 if (CurrentHedgehog ~= nil) then |
2468 if (CurrentHedgehog ~= nil) then |
2766 if beam == true then |
2469 if beam == true then |
2767 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield) |
2470 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield) |
2768 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, g10 ) |
|
2769 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth ) |
2471 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth ) |
2770 DrawTag(2) |
2472 DrawTag(2) |
2771 else |
2473 else |
2772 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 ) |
2474 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 ) |
2773 end |
2475 end |
2788 |
2490 |
2789 if (GetGearType(gear) == gtShell) then |
2491 if (GetGearType(gear) == gtShell) then |
2790 |
2492 |
2791 --nw WriteLnToConsole("ProjectileTrack() for Shell ID: " .. getGearValue(gear,"ID")) |
2493 --nw WriteLnToConsole("ProjectileTrack() for Shell ID: " .. getGearValue(gear,"ID")) |
2792 |
2494 |
2793 -- newnew |
|
2794 if (GetGearType(gear) == gtShell) then |
2495 if (GetGearType(gear) == gtShell) then |
2795 turningSpeed = 0.1*fMod |
2496 turningSpeed = 0.1*fMod |
2796 --elseif (GetGearType(gear) == gtBall) then |
|
2797 -- turningSpeed = 0.2*fMod |
|
2798 end |
2497 end |
2799 |
2498 |
2800 dx, dy = GetGearVelocity(gear) |
2499 dx, dy = GetGearVelocity(gear) |
2801 |
2500 |
2802 --WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID")) |
2501 --WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID")) |
2803 --WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy) |
2502 --WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy) |
2804 --WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) ) |
2503 --WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) ) |
2805 |
2504 |
2806 if GetX(gear) > GetX(CurrentHedgehog) then |
2505 if GetX(gear) > GetX(CurrentHedgehog) then |
2807 dx = dx - turningSpeed--0.1 |
2506 dx = dx - turningSpeed |
2808 else |
2507 else |
2809 dx = dx + turningSpeed--0.1 |
2508 dx = dx + turningSpeed |
2810 end |
2509 end |
2811 |
2510 |
2812 if GetY(gear) > GetY(CurrentHedgehog) then |
2511 if GetY(gear) > GetY(CurrentHedgehog) then |
2813 dy = dy - turningSpeed--0.1 |
2512 dy = dy - turningSpeed |
2814 else |
2513 else |
2815 dy = dy + turningSpeed--0.1 |
2514 dy = dy + turningSpeed |
2816 end |
2515 end |
2817 |
2516 |
2818 |
2517 |
2819 if (GetGearType(gear) == gtShell) then |
2518 if (GetGearType(gear) == gtShell) then |
2820 dxlimit = 0.4*fMod |
2519 dxlimit = 0.4*fMod |
2821 dylimit = 0.4*fMod |
2520 dylimit = 0.4*fMod |
2822 --elseif (GetGearType(gear) == gtBall) then |
|
2823 -- dxlimit = 0.5 -- 0.5 is about the same |
|
2824 -- dylimit = 0.5 -- 0.6 is faster than player |
|
2825 end |
2521 end |
2826 |
2522 |
2827 if dx > dxlimit then |
2523 if dx > dxlimit then |
2828 dx = dxlimit |
2524 dx = dxlimit |
2829 end |
2525 end |