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 (1.0) |
8 --- Space Invasion Code Follows (1.1) |
9 --------------------------------------------------- |
9 --------------------------------------------------- |
10 --------------------------------------------------- |
10 --------------------------------------------------- |
11 -- VERSION HISTORY |
11 -- VERSION HISTORY |
12 ---------------- |
12 ---------------- |
13 -- version 0.1 |
13 -- version 0.1 |
123 -- bugfix and balance for multishot |
123 -- bugfix and balance for multishot |
124 |
124 |
125 ------------------------ |
125 ------------------------ |
126 -- version 1.0 |
126 -- version 1.0 |
127 ------------------------ |
127 ------------------------ |
128 |
|
129 -- if only version numbers actually worked like this, wouldn't that be awful :D |
128 -- if only version numbers actually worked like this, wouldn't that be awful :D |
130 |
|
131 -- added surfer achievement |
129 -- added surfer achievement |
132 -- increased value of shield miser by 1 point per kill (OP?) |
130 -- increased value of shield miser by 1 point per kill (OP?) |
133 |
131 |
|
132 ------------------------ |
|
133 -- version 1.1 |
|
134 ------------------------ |
|
135 -- fixed radar so that blips dont go past circs when you get very close |
|
136 -- added a missing loc for shield depletion |
|
137 -- increased delay to 1000 to try stop noobies missing their turn |
|
138 -- added sniper achievement for hits from over a 1000000 away |
|
139 -- added achievement for 3 "sniper" shots in a round |
|
140 -- added achievement for 3 "point blank" shots in a round |
|
141 -- added "fierce Competition" achievement for shooting an enemy hog (once per round) |
|
142 -- some support for more weapons later |
134 |
143 |
135 -------------------------- |
144 -------------------------- |
136 --notes for later |
145 --notes for later |
137 -------------------------- |
146 -------------------------- |
138 -- maybe add a check for a tie, NAH |
147 -- maybe add a check for a tie, IMPOSSIBRU THERE ARE NO TIES |
139 -- more achievements? (3 kamikazes in a row, long distance shooter, supreme shield expert/miser etc?) |
148 -- more achievements? (3 kamikazes in a row, supreme shield expert/miser etc?) |
|
149 |
|
150 -- if more weps are added, replace primshotsfired all over the place |
|
151 |
|
152 -- look for derp and let invaders shoot again |
|
153 |
|
154 -- more weps? flamer/machineballgun, |
|
155 -- some kind of bomb that just drops straight down |
|
156 -- "fire and forget" missile |
|
157 -- shockwave |
|
158 |
|
159 -- some kind of ability-meter that lets you do something awesome when you are |
|
160 -- doing really well in a given round. |
|
161 -- probably new kind of shield that pops any invaders who come near |
|
162 |
|
163 -- fix game never ending bug |
|
164 -- fix radar |
|
165 -- new invader: golden snitch, doesn't show up on your radar |
|
166 |
|
167 -- maybe replace (48/100*vCircRadius[i])/2 with something better |
|
168 |
140 |
169 |
141 --[[CAPTION CATEGORIES |
170 --[[CAPTION CATEGORIES |
142 ----------------- |
171 ----------------- |
143 capgrpGameState |
172 capgrpGameState |
144 ----------------- |
173 ----------------- |
145 |
174 AddCaption(LOC_NOT("Sniper!") .. " +10 " .. LOC_NOT("points") .. "!",0xffba00ff,capgrpAmmostate) |
|
175 --they call me bullsye |
|
176 --point blank combo |
|
177 --fierce Competition |
146 ----------------- |
178 ----------------- |
147 capgrpAmmostate |
179 capgrpAmmostate |
148 ----------------- |
180 ----------------- |
149 AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate) |
181 AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate) |
150 AddCaption(LOC_NOT("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate) |
182 AddCaption(LOC_NOT("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate) |
160 ----------------- |
192 ----------------- |
161 AddCaption(LOC_NOT("Boom! +25 points!"),0xffba00ff,capgrpVolume) |
193 AddCaption(LOC_NOT("Boom! +25 points!"),0xffba00ff,capgrpVolume) |
162 AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume) |
194 AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume) |
163 AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume) |
195 AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume) |
164 AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume) |
196 AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume) |
165 AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume) |
197 AddCaption(LOC_NOT("Surfer! +15 points!"),0xffba00ff,capgrpVolume) |
166 |
198 |
167 ----------------- |
199 ----------------- |
168 capgrpMessage |
200 capgrpMessage |
169 ----------------- |
201 ----------------- |
170 AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
202 AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
171 AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft) |
203 AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft) |
172 AddCaption("Shield Depleted",0xff0000ff,capgrpMessage) |
204 AddCaption(LOC_NOT("Shield Depleted"),0xff0000ff,capgrpMessage) |
173 AddCaption( LOC_NOT("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") ) |
205 AddCaption( LOC_NOT("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") ) |
174 AddCaption(LOC_NOT("Shield OFF:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") ) |
206 AddCaption(LOC_NOT("Shield OFF:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") ) |
175 |
207 |
176 AddCaption(LOC_NOT("Time Extended!") .. "+" .. 4 .. LOC_NOT("s"), 0xff0000ff,capgrpMessage ) |
208 AddCaption(LOC_NOT("Time Extended!") .. "+" .. 4 .. LOC_NOT("s"), 0xff0000ff,capgrpMessage ) |
177 AddCaption("+" .. 3 .. " " .. LOC_NOT("Ammo"), 0x00ff00ff,capgrpMessage) |
209 AddCaption("+" .. 3 .. " " .. LOC_NOT("Ammo"), 0x00ff00ff,capgrpMessage) |
250 local GK = 0 |
283 local GK = 0 |
251 local BK = 0 |
284 local BK = 0 |
252 local OK = 0 |
285 local OK = 0 |
253 local SK = 0 |
286 local SK = 0 |
254 local shieldMiser = true |
287 local shieldMiser = true |
|
288 local fierceComp = false |
255 local chainCounter = 0 |
289 local chainCounter = 0 |
256 local chainLength = 0 |
290 local chainLength = 0 |
257 local shotsFired = 0 |
291 local shotsFired = 0 |
258 local shotsHit = 0 |
292 local shotsHit = 0 |
259 local SurfTime = 0 |
293 local SurfTime = 0 |
260 |
294 local sniperHits = 0 |
|
295 local pointBlankHits = 0 |
261 --------------------- |
296 --------------------- |
262 -- tumbler goods |
297 -- tumbler goods |
263 --------------------- |
298 --------------------- |
264 |
299 |
265 local moveTimer = 0 |
300 local moveTimer = 0 |
266 local leftOn = false |
301 local leftOn = false |
267 local rightOn = false |
302 local rightOn = false |
268 local upOn = false |
303 local upOn = false |
269 local downOn = false |
304 local downOn = false |
270 |
305 |
|
306 ---------------- |
|
307 -- TUMBLER |
|
308 local wep = {} |
|
309 local wepAmmo = {} |
|
310 local wepCol = {} |
|
311 local wepIndex = 0 |
|
312 local wepCount = 0 |
|
313 local fireTimer = 0 |
|
314 ---------------- |
|
315 |
|
316 |
|
317 |
271 local primShotsMax = 5 |
318 local primShotsMax = 5 |
272 local primShotsLeft = 0 |
319 local primShotsLeft = 0 |
273 |
320 |
274 local TimeLeftCounter = 0 |
321 local TimeLeftCounter = 0 |
275 local TimeLeft = 0 |
322 local TimeLeft = 0 |
638 lfs = 50 -- roughly 5 seconds |
689 lfs = 50 -- roughly 5 seconds |
639 shellID = shellID + 1 |
690 shellID = shellID + 1 |
640 setGearValue(gear,"ID",shellID) |
691 setGearValue(gear,"ID",shellID) |
641 --nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this shell") |
692 --nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this shell") |
642 elseif GetGearType(gear) == gtBall then |
693 elseif GetGearType(gear) == gtBall then |
643 lfs = 70 -- 7s |
694 lfs = 5 --70 -- 7s |
644 elseif GetGearType(gear) == gtExplosives then |
695 elseif GetGearType(gear) == gtExplosives then |
645 lfs = 15 -- 1.5s |
696 lfs = 15 -- 1.5s |
646 explosivesID = explosivesID + 1 |
697 explosivesID = explosivesID + 1 |
647 setGearValue(gear,"ID",explosivesID) |
698 setGearValue(gear,"ID",explosivesID) |
|
699 setGearValue(gear,"XP", GetX(gear)) |
|
700 setGearValue(gear,"YP", GetY(gear)) |
648 --nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this explosives") |
701 --nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this explosives") |
649 elseif GetGearType(gear) == gtFlame then |
702 elseif GetGearType(gear) == gtFlame then |
650 lfs = 5 -- 0.5s |
703 lfs = 5 -- 0.5s |
651 else |
704 else |
652 lfs = 100 |
705 lfs = 100 |
708 ----------------------- |
761 ----------------------- |
709 --EVENT HANDLERS |
762 --EVENT HANDLERS |
710 -- action keys |
763 -- action keys |
711 ----------------------- |
764 ----------------------- |
712 |
765 |
|
766 function HandleFlameThrower() |
|
767 |
|
768 -- |
|
769 --flamer |
|
770 |
|
771 fireTimer = fireTimer + 1 |
|
772 if fireTimer == 6 then -- 6 |
|
773 fireTimer = 0 |
|
774 |
|
775 if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then |
|
776 |
|
777 wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 |
|
778 AddCaption( |
|
779 loc("Flamer") .. ": " .. |
|
780 (wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%", |
|
781 wepCol[2], |
|
782 capgrpMessage2 |
|
783 ) |
|
784 DrawTag(3) |
|
785 |
|
786 dx, dy = GetGearVelocity(CurrentHedgehog) --gtFlame -- gtSnowball -- gtAirBomb |
|
787 shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0) |
|
788 |
|
789 xdev = 1 + GetRandom(35) --25 |
|
790 xdev = xdev / 100 |
|
791 |
|
792 r = GetRandom(2) |
|
793 if r == 1 then |
|
794 xdev = xdev*-1 |
|
795 end |
|
796 |
|
797 ydev = 1 + GetRandom(35) --25 |
|
798 ydev = ydev / 100 |
|
799 |
|
800 r = GetRandom(2) |
|
801 if r == 1 then |
|
802 ydev = ydev*-1 |
|
803 end |
|
804 |
|
805 --4.5 or 2.5 nonflames --4.5 |
|
806 SetGearVelocity(shell, (dx*4.5)+(xdev*fMod), (dy*4.5)+(ydev*fMod)) --10 |
|
807 |
|
808 end |
|
809 |
|
810 end |
|
811 |
|
812 |
|
813 end |
|
814 |
|
815 function ChangeWeapon() |
|
816 |
|
817 wepIndex = wepIndex + 1 |
|
818 if wepIndex == wepCount then |
|
819 wepIndex = 0 |
|
820 end |
|
821 |
|
822 AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo ) |
|
823 AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
|
824 |
|
825 end |
|
826 |
|
827 --function onTimer() |
|
828 |
|
829 -- experimental wep |
|
830 --[[SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xff33ffff) |
|
831 AddCaption("boom") |
|
832 PlaySound(sndWarp) |
|
833 shockwaveHealth = 100 |
|
834 shockwaveRad = 100]] |
|
835 |
|
836 |
|
837 --change wep |
|
838 --ChangeWeapon() |
|
839 |
|
840 -- booster |
|
841 --[[if boosterOn == false then |
|
842 boosterOn = true |
|
843 else |
|
844 boosterOn = false |
|
845 end]] |
|
846 |
|
847 --end |
|
848 |
713 -- o rite dis wan iz liek synched n stuff hope full lee |
849 -- o rite dis wan iz liek synched n stuff hope full lee |
714 function onPrecise() |
850 -- old method |
715 |
851 --[[function onPrecise() |
716 --WriteLnToConsole("onPrecise event handler at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
852 |
717 |
853 |
718 -- Fire Barrel |
854 -- Fire Barrel |
719 if (primShotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
855 if (primShotsLeft > 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
720 |
856 |
721 shotsFired = shotsFired +1 |
857 shotsFired = shotsFired +1 |
732 end |
868 end |
733 DrawTag(1) |
869 DrawTag(1) |
734 |
870 |
735 CopyPV(CurrentHedgehog, morte) -- new addition |
871 CopyPV(CurrentHedgehog, morte) -- new addition |
736 x,y = GetGearVelocity(morte) |
872 x,y = GetGearVelocity(morte) |
737 --WriteLnToConsole("I'm going to shoot a barrel so I just got the velocity of currenthedgehog. It is dx: " .. x .. "; dy: " .. y) |
|
738 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
|
739 |
|
740 |
|
741 |
873 |
742 x = x*2 |
874 x = x*2 |
743 y = y*2 |
875 y = y*2 |
744 SetGearVelocity(morte, x, y) |
876 SetGearVelocity(morte, x, y) |
745 |
877 |
746 --WriteLnToConsole("I just SET the velocity of a barrel I created. It is now dx: " .. x .. "; dy: " .. y) |
|
747 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
|
748 |
|
749 |
|
750 |
878 |
751 elseif (primShotsLeft == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
879 elseif (primShotsLeft == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
752 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
880 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
753 end |
881 end |
754 |
882 |
755 |
883 |
|
884 end]] |
|
885 |
|
886 -- derp tumbler |
|
887 function onPrecise() |
|
888 |
|
889 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then |
|
890 |
|
891 wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 |
|
892 --AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
|
893 |
|
894 if wep[wepIndex] == loc("Barrel Launcher") then |
|
895 shotsFired = shotsFired +1 |
|
896 |
|
897 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1) |
|
898 CopyPV(CurrentHedgehog, morte) -- new addition |
|
899 x,y = GetGearVelocity(morte) |
|
900 x = x*2 |
|
901 y = y*2 |
|
902 SetGearVelocity(morte, x, y) |
|
903 |
|
904 if wepAmmo[wepIndex] == 0 then |
|
905 PlaySound(sndSuddenDeath) |
|
906 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
|
907 else |
|
908 --AddCaption(loc("Ammo") .. ": " .. wepAmmo[wepIndex]) |
|
909 end |
|
910 DrawTag(1) |
|
911 |
|
912 elseif wep[wepIndex] == loc("Mine Deployer") then |
|
913 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0) |
|
914 SetTimer(morte, 1000) |
|
915 DrawTag(1) |
|
916 end |
|
917 |
|
918 elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
|
919 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
|
920 end |
|
921 |
|
922 preciseOn = true |
|
923 |
|
924 end |
|
925 |
|
926 function onPreciseUp() |
|
927 preciseOn = false |
756 end |
928 end |
757 |
929 |
758 function onLJump() |
930 function onLJump() |
759 |
931 |
760 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
932 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
761 shieldMiser = false |
933 shieldMiser = false |
762 if shieldHealth == 80 then |
934 if shieldHealth == 80 then |
763 AddCaption("Shield Depleted",0xff0000ff,capgrpMessage) |
935 AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage) |
764 PlaySound(sndMineTick) |
936 PlaySound(sndMineTick) |
765 PlaySound(sndSwitchHog) |
937 PlaySound(sndSwitchHog) |
766 elseif (beam == false) and (shieldHealth > 80) then |
938 elseif (beam == false) and (shieldHealth > 80) then |
767 beam = true |
939 beam = true |
768 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff) |
940 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff) |
1146 dx, dy = GetGearVelocity(CurrentHedgehog) |
1354 dx, dy = GetGearVelocity(CurrentHedgehog) |
1147 |
1355 |
1148 --WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy) |
1356 --WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy) |
1149 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1357 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1150 |
1358 |
1151 |
1359 if boosterOn == true then |
1152 dxlimit = 0.4*fMod |
1360 tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false) |
1153 dylimit = 0.4*fMod |
1361 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
1362 SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, 1, g9, GetClanColor(GetHogClan(CurrentHedgehog)) ) |
|
1363 dxlimit = 0.8*fMod |
|
1364 dylimit = 0.8*fMod |
|
1365 else |
|
1366 dxlimit = 0.4*fMod |
|
1367 dylimit = 0.4*fMod |
|
1368 end |
1154 |
1369 |
1155 if dx > dxlimit then |
1370 if dx > dxlimit then |
1156 dx = dxlimit |
1371 dx = dxlimit |
1157 end |
1372 end |
1158 if dy > dylimit then |
1373 if dy > dylimit then |
1186 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1401 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1187 --nw WriteLnToConsole("End of Player MoveTimer") |
1402 --nw WriteLnToConsole("End of Player MoveTimer") |
1188 |
1403 |
1189 end |
1404 end |
1190 |
1405 |
|
1406 |
|
1407 HandleFlameThrower() |
|
1408 |
|
1409 |
1191 end -- new end I put here to check if he's still alive or not |
1410 end -- new end I put here to check if he's still alive or not |
1192 |
1411 |
1193 end |
1412 end |
1194 |
1413 |
1195 --WriteLnToConsole("End of GameTick") |
1414 --WriteLnToConsole("End of GameTick") |
1196 |
1415 |
|
1416 end |
|
1417 |
|
1418 function onGearDamage(gear, damage) |
|
1419 if GetGearType(gear) == gtHedgehog then |
|
1420 if (fierceComp == false) and (damage >= 60) and (GetHogClan(gear) ~= GetHogClan(CurrentHedgehog)) then |
|
1421 fierceComp = true |
|
1422 AddCaption(loc("Fierce Competition!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
1423 AwardPoints(8) |
|
1424 end |
|
1425 end |
1197 end |
1426 end |
1198 |
1427 |
1199 function onGearResurrect(gear) |
1428 function onGearResurrect(gear) |
1200 |
1429 |
1201 -- did I fall into the water? well, that was a stupid thing to do |
1430 -- did I fall into the water? well, that was a stupid thing to do |
1202 if gear == CurrentHedgehog then |
1431 if gear == CurrentHedgehog then |
1203 TimeLeft = 0 |
1432 TimeLeft = 0 |
1204 --WriteLnToConsole("Current hedgehog just drowned himself") |
1433 --WriteLnToConsole("Current hedgehog just drowned himself") |
1205 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1434 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1206 |
|
1207 end |
1435 end |
1208 |
1436 |
1209 end |
1437 end |
1210 |
1438 |
1211 function onGearAdd(gear) |
1439 function onGearAdd(gear) |
1279 ------------------------------------------------------------ |
1504 ------------------------------------------------------------ |
1280 ------------------------------------------------------------ |
1505 ------------------------------------------------------------ |
1281 |
1506 |
1282 function DoHorribleThings(cUID) |
1507 function DoHorribleThings(cUID) |
1283 |
1508 |
1284 -- maybe |
|
1285 -- add a check to draw it inside the circ and not past it if |
|
1286 -- it is closer than 150 or w/e |
|
1287 |
|
1288 -- work out the distance to the target |
1509 -- work out the distance to the target |
1289 g1X, g1Y = GetGearPosition(CurrentHedgehog) |
1510 g1X, g1Y = GetGearPosition(CurrentHedgehog) |
1290 g2X, g2Y = vCircX[cUID], vCircY[cUID] |
1511 g2X, g2Y = vCircX[cUID], vCircY[cUID] |
1291 q = g1X - g2X |
1512 q = g1X - g2X |
1292 w = g1Y - g2Y |
1513 w = g1Y - g2Y |
1293 r = math.sqrt( (q*q) + (w*w) ) --alternate |
1514 r = math.sqrt( (q*q) + (w*w) ) --alternate |
1294 |
1515 |
1295 |
|
1296 opp = w |
1516 opp = w |
1297 if opp < 0 then |
1517 if opp < 0 then |
1298 opp = opp*-1 |
1518 opp = opp*-1 |
1299 end |
1519 end |
1300 |
1520 |
1305 NR = 150 -- radius at which to draw circs |
1525 NR = 150 -- radius at which to draw circs |
1306 NX = math.cos( math.rad(t) ) * NR |
1526 NX = math.cos( math.rad(t) ) * NR |
1307 NY = math.sin( math.rad(t) ) * NR |
1527 NY = math.sin( math.rad(t) ) * NR |
1308 |
1528 |
1309 -- displace xy based on where this thing actually is |
1529 -- displace xy based on where this thing actually is |
1310 if q > 0 then |
1530 |
|
1531 if r < NR then |
|
1532 rCircX[cUID] = g2X |
|
1533 elseif q > 0 then |
1311 rCircX[cUID] = g1X - NX |
1534 rCircX[cUID] = g1X - NX |
1312 else |
1535 else |
1313 rCircX[cUID] = g1X + NX |
1536 rCircX[cUID] = g1X + NX |
1314 end |
1537 end |
1315 |
1538 |
1316 if w > 0 then |
1539 if r < NR then |
|
1540 rCircY[cUID] = g2Y |
|
1541 elseif w > 0 then |
1317 rCircY[cUID] = g1Y - NY |
1542 rCircY[cUID] = g1Y - NY |
1318 else |
1543 else |
1319 rCircY[cUID] = g1Y + NY |
1544 rCircY[cUID] = g1Y + NY |
1320 end |
1545 end |
1321 |
1546 |
1322 end |
1547 end |
1323 |
1548 |
1324 function PlayerIsFine() |
1549 function PlayerIsFine() |
1325 return (playerIsFine) |
1550 return (playerIsFine) |
|
1551 end |
|
1552 |
|
1553 function GetDistFromXYtoXY(a, b, c, d) |
|
1554 q = a - c |
|
1555 w = b - d |
|
1556 return ( (q*q) + (w*w) ) |
1326 end |
1557 end |
1327 |
1558 |
1328 function GetDistFromGearToGear(gear, gear2) |
1559 function GetDistFromGearToGear(gear, gear2) |
1329 |
1560 |
1330 g1X, g1Y = GetGearPosition(gear) |
1561 g1X, g1Y = GetGearPosition(gear) |
1420 |
1651 |
1421 pShield = AddVisualGear(0,0,vgtCircle,0,true) |
1652 pShield = AddVisualGear(0,0,vgtCircle,0,true) |
1422 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, 200, 1, 10, 0, 200, 5, 0xff00ffff) |
1653 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, 200, 1, 10, 0, 200, 5, 0xff00ffff) |
1423 |
1654 |
1424 |
1655 |
|
1656 shockwave = AddVisualGear(0,0,vgtCircle,0,true) |
|
1657 |
1425 end |
1658 end |
1426 |
1659 |
1427 function IGotMeASafeXYValue(i) |
1660 function IGotMeASafeXYValue(i) |
1428 |
1661 |
1429 acceptibleDistance = 800 |
1662 acceptibleDistance = 800 |
1471 |
1704 |
1472 elseif (vType[i] == "ammo") then |
1705 elseif (vType[i] == "ammo") then |
1473 AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false) |
1706 AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false) |
1474 PlaySound(sndExplosion) |
1707 PlaySound(sndExplosion) |
1475 PlaySound(sndShotgunReload) |
1708 PlaySound(sndShotgunReload) |
1476 primShotsLeft = primShotsLeft + 3 |
1709 wepAmmo[0] = wepAmmo[0] +3 |
|
1710 --primShotsLeft = primShotsLeft + 3 |
1477 AddCaption("+" .. 3 .. " " .. loc("Ammo"), 0x00ff00ff,capgrpMessage) |
1711 AddCaption("+" .. 3 .. " " .. loc("Ammo"), 0x00ff00ff,capgrpMessage) |
1478 DrawTag(1) |
1712 DrawTag(1) |
1479 |
1713 |
1480 GK = GK + 1 |
1714 GK = GK + 1 |
1481 if GK == 3 then |
1715 if GK == 3 then |
1728 NR = (48/100*vCircRadius[i])/2 |
1959 NR = (48/100*vCircRadius[i])/2 |
1729 end |
1960 end |
1730 |
1961 |
1731 if dist <= NR*NR then |
1962 if dist <= NR*NR then |
1732 |
1963 |
1733 --nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!") |
1964 |
1734 |
1965 --nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!") |
1735 --SetGearPosition(gear, vCircX[i], vCircY[i]) |
1966 |
1736 --WriteLnToConsole("set the gtExplosives to be in the center of circ") |
1967 dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR)) |
|
1968 --AddCaption(loc("Dist: ") .. dist .. "!",0xffba00ff,capgrpGameState) |
|
1969 if dist >= 1000000 then |
|
1970 sniperHits = sniperHits +1 |
|
1971 AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
1972 AwardPoints(8) |
|
1973 if sniperHits == 3 then |
|
1974 sniperHits = 0 |
|
1975 AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
1976 AwardPoints(15) |
|
1977 end |
|
1978 elseif dist <= 6000 then |
|
1979 pointBlankHits = pointBlankHits +1 |
|
1980 if pointBlankHits == 3 then |
|
1981 pointBlankHits = 0 |
|
1982 AddCaption(loc("Point Blank Combo!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
|
1983 AwardPoints(5) |
|
1984 end |
|
1985 end |
|
1986 |
1737 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
1987 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
1738 |
1988 |
1739 targetHit = true |
1989 targetHit = true |
1740 --DeleteGear(gear) |
1990 --DeleteGear(gear) |
1741 --SetHealth(gear,0) |
1991 --SetHealth(gear,0) |
1846 |
2098 |
1847 ss = CircleDamaged(i) |
2099 ss = CircleDamaged(i) |
1848 WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog)) |
2100 WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog)) |
1849 |
2101 |
1850 if ss == "fatal" then |
2102 if ss == "fatal" then |
1851 if (primShotsLeft == 0) and (TimeLeft <= 9) then |
2103 |
|
2104 if (wepAmmo[0] == 0) and (TimeLeft <= 9) then |
|
2105 --if (primShotsLeft == 0) and (TimeLeft <= 9) then |
1852 AddCaption(loc("Kamikaze Expert!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2106 AddCaption(loc("Kamikaze Expert!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
1853 AwardPoints(15) |
2107 AwardPoints(15) |
1854 elseif (primShotsLeft == 0) then |
2108 elseif (wepAmmo[0] == 0) then |
1855 AddCaption(loc("Depleted Kamikaze!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2109 AddCaption(loc("Depleted Kamikaze!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
1856 AwardPoints(5) |
2110 AwardPoints(5) |
1857 elseif TimeLeft <= 9 then |
2111 elseif TimeLeft <= 9 then |
1858 AddCaption(loc("Timed Kamikaze!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2112 AddCaption(loc("Timed Kamikaze!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
1859 AwardPoints(10) |
2113 AwardPoints(10) |
1904 for i = 0,(vCCount-1) do |
2158 for i = 0,(vCCount-1) do |
1905 |
2159 |
1906 --if (vCircActive[i] == true) then |
2160 --if (vCircActive[i] == true) then |
1907 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
2161 SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha) |
1908 --end |
2162 --end |
|
2163 |
|
2164 |
1909 |
2165 |
1910 vCounter[i] = vCounter[i] + 1 |
2166 vCounter[i] = vCounter[i] + 1 |
1911 if vCounter[i] >= vCounterLim[i] then |
2167 if vCounter[i] >= vCounterLim[i] then |
1912 |
2168 |
1913 vCounter[i] = 0 |
2169 vCounter[i] = 0 |
2079 -- end |
2335 -- end |
2080 --end |
2336 --end |
2081 |
2337 |
2082 end |
2338 end |
2083 |
2339 |
|
2340 |
|
2341 -- derp |
|
2342 if shockwaveHealth > 0 then |
|
2343 shockwaveHealth = shockwaveHealth - 1 |
|
2344 shockwaveRad = shockwaveRad + 80 |
|
2345 |
|
2346 --mrm = ((48/100*shockwaveRad)/2) |
|
2347 --AddVisualGear(GetX(CurrentHedgehog)-mrm+GetRandom(mrm*2),GetY(CurrentHedgehog)-mrm+GetRandom(mrm*2), vgtSmoke, 0, false) |
|
2348 end |
|
2349 |
|
2350 |
|
2351 |
2084 end |
2352 end |
2085 |
2353 |
2086 for i = 0,(vCCount-1) do |
2354 for i = 0,(vCCount-1) do |
2087 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2355 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10 |
2088 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2356 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10) |
2095 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, (vCircCol[i]-FadeAlpha)) |
2363 SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, (vCircCol[i]-FadeAlpha)) |
2096 end |
2364 end |
2097 end |
2365 end |
2098 |
2366 |
2099 |
2367 |
2100 if (CurrentHedgehog ~= nil) and (beam == true) then |
2368 if (CurrentHedgehog ~= nil) then |
2101 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield) |
2369 if beam == true then |
2102 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, g10 ) |
2370 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield) |
2103 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth ) |
2371 --SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, g10 ) |
2104 DrawTag(2) |
2372 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth ) |
2105 else |
2373 DrawTag(2) |
2106 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 ) |
2374 else |
2107 end |
2375 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 ) |
|
2376 end |
|
2377 |
|
2378 if shockwaveHealth > 0 then |
|
2379 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(shockwave) |
|
2380 SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, shockwaveRad, g9, 0xff3300ff-0x000000ff - -shockwaveHealth ) |
|
2381 else |
|
2382 SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 ) |
|
2383 end |
|
2384 |
|
2385 end |
|
2386 |
2108 |
2387 |
2109 end |
2388 end |
2110 |
2389 |
2111 function ProjectileTrack(gear) |
2390 function ProjectileTrack(gear) |
2112 |
2391 |