changeset 12054 | 0e6f044daeac |
parent 10670 | 638af9cb922b |
child 12055 | ddf0fee75449 |
12053:281a4f33b08f | 12054:0e6f044daeac |
---|---|
1 |
1 |
2 HedgewarsScriptLoad("/Scripts/Locale.lua") |
2 HedgewarsScriptLoad("/Scripts/Locale.lua") |
3 HedgewarsScriptLoad("/Scripts/Tracker.lua") |
3 HedgewarsScriptLoad("/Scripts/Tracker.lua") |
4 |
4 HedgewarsScriptLoad("/Scripts/Params.lua") |
5 --------------------------------------------------- |
5 |
6 --------------------------------------------------- |
6 --[[ |
7 --------------------------------------------------- |
7 Space Invasion 1.2 |
8 --- Space Invasion Code Follows (1.1) |
8 |
9 --------------------------------------------------- |
9 === DOCUMENTATION === |
10 --------------------------------------------------- |
10 |
11 == SCRIPT CONFIGURATION == |
|
12 You can configure this script a little bit, you only have to edit the game scheme. |
|
13 The script makes heavy use of the script parameters, but you can also use some, |
|
14 but not all, of the other settings in a game scheme. |
|
15 |
|
16 You CAN use the following options: |
|
17 - disable girders (highly recommended!) |
|
18 - disable land objects |
|
19 - random order |
|
20 - solid land |
|
21 - low gravity (makes this game much easier, but this script is probably not optimized for it yet) |
|
22 - bottom border |
|
23 - fort mode (just changes the landscape) |
|
24 - teams start at opposite parts of land |
|
25 - wind affects almost everything |
|
26 |
|
27 Those options are also possible, but have no real gameplay effect: |
|
28 - disable wind |
|
29 - tag team |
|
30 - king mode (here it only changes hats, so this is just for fun) |
|
31 - vampiric (has no real gameplay effect; just for the grapical effect) |
|
32 - full border (it’s techincally possible, but the script is currently not very well optimized for this mode) |
|
33 |
|
34 You CANNOT use any other of the on/off options in the game scheme. Those settings are simply discarded by the script. |
|
35 |
|
36 You also can change the following settings in the game scheme |
|
37 - time per round (very important) |
|
38 - script parameters, see below |
|
39 - terrain edge other than none (they kinda work, but they aren’t well supported by the script either) |
|
40 |
|
41 The other settings are technically possible, but their effect is limited: |
|
42 - damage percentage |
|
43 - mines (they don’t harm the active hedgehog, however) |
|
44 - number of barrels |
|
45 |
|
46 All other variables are discarded, the script forces its own settings. |
|
47 There will be never Sudden Death, any crate drops, any mines and any |
|
48 barrels. |
|
49 |
|
50 |
|
51 == SCRIPT PARAMETERS == |
|
52 This script can be configured mostly with the script parameters. |
|
53 The script parameters are specified in a key=value format each, |
|
54 and each pair is delimeted by a comma. |
|
55 All values must be integer of 0 or higher. All values are optional |
|
56 and have a default if unspecified |
|
57 |
|
58 List of parameters: |
|
59 - rounds: Number of rounds (default: 3) |
|
60 - shield: Amount of shield you start with (default: 30) |
|
61 - barrels: Amount of ammo (barrels) you start with (default: 5) |
|
62 - pings: How many time you can use the radar per round (default: 2) |
|
63 - barrelbonus: How many barrels you get for collecting/destroning a green invader (default: 3) |
|
64 - shieldbonus: How much shield you get for collecting/destroying a purple invader (default: 30) |
|
65 - timebonus: How many seconds you get for killing a drone (red) (default: 4) |
|
66 - forcetheme: If set to false, the game will use your chosen theme instead of forcing EarthRise |
|
67 - Please note that the game may not be able to be played in some themes if the sky |
|
68 color is very bright (i.e. Bath) |
|
69 |
|
70 Example input for the field “Script parameters”: |
|
71 |
|
72 rounds=5 |
|
73 >>> 5 rounds, everything else is default |
|
74 |
|
75 forcetheme=false |
|
76 >>> Makes the game use whatever thme |
|
77 |
|
78 shield=0, barrels=3, pings=0 |
|
79 >>> no shield, no radar pings and only 3 barrels (could be some hard mode) |
|
80 |
|
81 (empty string) |
|
82 >>> Use defaults for everything |
|
83 |
|
84 |
|
11 -- VERSION HISTORY |
85 -- VERSION HISTORY |
12 ---------------- |
86 ---------------- |
13 -- version 0.1 |
87 -- version 0.1 |
14 ---------------- |
88 ---------------- |
15 -- conversion of tumbler into space invasion |
89 -- conversion of tumbler into space invasion |
139 -- added achievement for 3 "sniper" shots in a round |
213 -- added achievement for 3 "sniper" shots in a round |
140 -- added achievement for 3 "point blank" shots in a round |
214 -- added achievement for 3 "point blank" shots in a round |
141 -- added "fierce Competition" achievement for shooting an enemy hog (once per round) |
215 -- added "fierce Competition" achievement for shooting an enemy hog (once per round) |
142 -- some support for more weapons later |
216 -- some support for more weapons later |
143 |
217 |
218 ------------------------ |
|
219 -- version 1.2 |
|
220 ------------------------ |
|
221 -- show actual scores in stats screen |
|
222 -- show a couple of “awards” and more or less snarky comments in stats screen |
|
223 -- for various accomplisments and events those are just for fun, they don’t |
|
224 -- affect score or game outcome |
|
225 -- use script parameters for configuration, see top of file for more information |
|
226 -- stop overwriting game most scheme’s parameters |
|
227 -- disable weapon scheme |
|
228 -- play “denied” sound when trying to use empty radar, ammo or shield |
|
229 -- play “Hurry!” taunt when 5 seconds are left |
|
230 -- play throw sound when throwing a barrel |
|
231 -- play sonar sound for using radar |
|
232 -- play “Kamikaze!” taunt for receiving one of the kamikaze bonuses |
|
233 -- show total team score in HUD (white number) |
|
234 -- show message when trying to use empty radar |
|
235 -- show message when time’s up |
|
236 -- show message with round score at end of a round |
|
237 -- disabled health graph, replaced with score per round |
|
238 -- removed “selected weapon” message, we only have one weapon |
|
239 -- removed unused bubbleSort function |
|
240 -- play “Ooff” sound when hit by bazooka |
|
241 -- fix explosion being drawn twice when colliding with circle |
|
242 -- play explosion sound when barrel’s lifespan is over |
|
243 ]] |
|
244 |
|
144 -------------------------- |
245 -------------------------- |
145 --notes for later |
246 -- TODO list: notes for later |
146 -------------------------- |
247 -------------------------- |
248 -- imitate winning animation at end instead of just ending the game |
|
249 |
|
147 -- maybe add a check for a tie, IMPOSSIBRU THERE ARE NO TIES |
250 -- maybe add a check for a tie, IMPOSSIBRU THERE ARE NO TIES |
148 -- more achievements? (3 kamikazes in a row, supreme shield expert/miser etc?) |
251 -- more achievements? |
252 -- more just-for-fun awards (for stats screen) |
|
149 |
253 |
150 -- if more weps are added, replace primshotsfired all over the place |
254 -- if more weps are added, replace primshotsfired all over the place |
151 |
255 |
152 -- look for derp and let invaders shoot again |
256 -- look for derp and let invaders shoot again |
153 |
257 |
163 -- fix game never ending bug |
267 -- fix game never ending bug |
164 -- fix radar |
268 -- fix radar |
165 -- new invader: golden snitch, doesn't show up on your radar |
269 -- new invader: golden snitch, doesn't show up on your radar |
166 |
270 |
167 -- maybe replace (48/100*vCircRadius[i])/2 with something better |
271 -- maybe replace (48/100*vCircRadius[i])/2 with something better |
272 |
|
273 |
|
274 ------- CODE FOLLOWS ------- |
|
168 |
275 |
169 |
276 |
170 --[[CAPTION CATEGORIES |
277 --[[CAPTION CATEGORIES |
171 ----------------- |
278 ----------------- |
172 capgrpGameState |
279 capgrpGameState |
237 local explosivesID = 0 |
344 local explosivesID = 0 |
238 local luaGameTicks = 0 |
345 local luaGameTicks = 0 |
239 |
346 |
240 -- gaudyRacer |
347 -- gaudyRacer |
241 local boosterOn = false |
348 local boosterOn = false |
242 local roundLimit = 3 -- no longer set here (see version history) |
349 local roundLimit = 3 -- can be overridden by script parameter "rounds" |
243 local roundNumber = 0 |
350 local roundNumber = 0 |
244 local firstClan = 10 |
351 local firstClan = 10 |
245 local gameOver = false |
352 local gameOver = false |
246 local gameBegun = false |
353 local gameBegun = false |
247 |
354 |
253 |
360 |
254 local roundN = 0 |
361 local roundN = 0 |
255 local lastRound |
362 local lastRound |
256 local RoundHasChanged = true |
363 local RoundHasChanged = true |
257 |
364 |
365 -- for script parameters |
|
366 local startBarrels = 5 -- "barrels" |
|
367 local startShield = 30 -- "shield" |
|
368 local startRadShots = 2 -- "pings" |
|
369 local shieldBonus = 30 -- "shieldbonus" |
|
370 local barrelBonus = 3 -- "barrelbonus" |
|
371 local timeBonus = 4 -- "timebonus" |
|
372 local forceTheme = true -- "forcetheme" |
|
373 |
|
258 -------------------------- |
374 -------------------------- |
259 -- hog and team tracking variales |
375 -- hog and team tracking variales |
260 -------------------------- |
376 -------------------------- |
261 |
377 |
262 local numhhs = 0 |
378 local numhhs = 0 |
266 local teamNameArr = {} |
382 local teamNameArr = {} |
267 local teamClan = {} |
383 local teamClan = {} |
268 local teamSize = {} |
384 local teamSize = {} |
269 local teamIndex = {} |
385 local teamIndex = {} |
270 |
386 |
271 local teamComment = {} |
|
272 local teamScore = {} |
387 local teamScore = {} |
273 local teamCircsKilled = {} |
388 local teamCircsKilled = {} |
274 local teamSurfer = {} |
389 local teamSurfer = {} |
275 |
390 |
276 -- stats variables |
391 -- stats variables |
277 --local teamRed = {} |
392 --local teamRed = {} |
278 --local teamBlue = {} |
393 --local teamBlue = {} |
279 --local teamOrange = {} |
394 --local teamOrange = {} |
280 --local teamGreen = {} |
395 --local teamGreen = {} |
281 local roundKills = 0 |
396 local roundKills = 0 |
397 local roundScore = 0 |
|
282 local RK = 0 |
398 local RK = 0 |
283 local GK = 0 |
399 local GK = 0 |
284 local BK = 0 |
400 local BK = 0 |
285 local OK = 0 |
401 local OK = 0 |
286 local SK = 0 |
402 local SK = 0 |
290 local chainLength = 0 |
406 local chainLength = 0 |
291 local shotsFired = 0 |
407 local shotsFired = 0 |
292 local shotsHit = 0 |
408 local shotsHit = 0 |
293 local sniperHits = 0 |
409 local sniperHits = 0 |
294 local pointBlankHits = 0 |
410 local pointBlankHits = 0 |
411 |
|
412 --------------------- |
|
413 -- awards (for stats section, just for fun) |
|
414 --------------------- |
|
415 -- global awards |
|
416 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 |
|
427 -- hog awards |
|
428 local awardRoundScore -- hog with most score in 1 round (min. 50) |
|
429 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) |
|
431 local awardCombo -- hog with longest combo (min. 5) |
|
432 |
|
295 --------------------- |
433 --------------------- |
296 -- tumbler goods |
434 -- tumbler goods |
297 --------------------- |
435 --------------------- |
298 |
436 |
299 local moveTimer = 0 |
437 local moveTimer = 0 |
390 |
528 |
391 |
529 |
392 |
530 |
393 function HideTags() |
531 function HideTags() |
394 |
532 |
395 for i = 0, 2 do |
533 for i = 0, 4 do |
396 SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
534 SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
397 end |
535 end |
398 |
536 |
399 end |
537 end |
400 |
538 |
401 function DrawTag(i) |
539 function DrawTag(i) |
402 |
540 |
403 zoomL = 1.3 |
541 local zoomL = 1.3 |
404 |
542 local xOffset = 40 |
405 xOffset = 40 |
543 local yOffset, tValue, tCol |
406 |
544 |
407 if i == 0 then |
545 if i == 0 then |
408 yOffset = 40 |
546 yOffset = 40 |
409 tCol = 0xffba00ff |
547 tCol = 0xffba00ff |
410 tValue = TimeLeft |
548 tValue = TimeLeft |
417 zoomL = 1.1 |
555 zoomL = 1.1 |
418 xOffset = 40 + 35 |
556 xOffset = 40 + 35 |
419 yOffset = 70 |
557 yOffset = 70 |
420 tCol = 0xa800ffff |
558 tCol = 0xa800ffff |
421 tValue = shieldHealth - 80 |
559 tValue = shieldHealth - 80 |
560 elseif i == 4 then |
|
561 zoomL = 1.1 |
|
562 xOffset = 40 + 80 |
|
563 yOffset = 70 |
|
564 tCol = 0xffffffff |
|
565 tValue = roundScore |
|
422 end |
566 end |
423 |
567 |
424 DeleteVisualGear(vTag[i]) |
568 DeleteVisualGear(vTag[i]) |
425 vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
569 vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
426 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i]) |
570 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i]) |
499 |
643 |
500 end |
644 end |
501 |
645 |
502 -- control |
646 -- control |
503 function AwardPoints(p) |
647 function AwardPoints(p) |
648 roundScore = roundScore + p |
|
649 DrawTag(4) |
|
504 |
650 |
505 for i = 0,(TeamsCount-1) do |
651 for i = 0,(TeamsCount-1) do |
506 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
652 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
507 teamScore[i] = teamScore[i] + p |
653 teamScore[i] = teamScore[i] + p |
508 end |
654 end |
515 roundKills = roundKills + 1 |
661 roundKills = roundKills + 1 |
516 |
662 |
517 for i = 0,(TeamsCount-1) do |
663 for i = 0,(TeamsCount-1) do |
518 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
664 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
519 teamCircsKilled[i] = teamCircsKilled[i] + 1 |
665 teamCircsKilled[i] = teamCircsKilled[i] + 1 |
520 |
666 awardTotalKills = awardTotalKills + 1 |
667 |
|
668 --[[ |
|
669 TODO: Check if I actually want to remove this |
|
521 if teamCircsKilled[i] == 10 then |
670 if teamCircsKilled[i] == 10 then |
522 AddCaption(loc("Boom!") .. " +25 " .. loc("points").."!",0xffba00ff,capgrpVolume) |
671 AddCaption(loc("Boom!") .. " +25 " .. loc("points").."!",0xffba00ff,capgrpVolume) |
523 AwardPoints(25) |
672 AwardPoints(25) |
524 elseif teamCircsKilled[i] == 25 then |
673 elseif teamCircsKilled[i] == 25 then |
525 AddCaption(loc("BOOM!") .. " +50 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
674 AddCaption(loc("BOOM!") .. " +50 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
526 AwardPoints(50) |
675 AwardPoints(50) |
527 elseif teamCircsKilled[i] == 50 then |
676 elseif teamCircsKilled[i] == 50 then |
528 AddCaption(loc("BOOM!") .. loc("BOOM!") .. loc("BOOM!") .. " +100 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
677 AddCaption(loc("BOOM!") .. loc("BOOM!") .. loc("BOOM!") .. " +100 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
529 AwardPoints(100) |
678 AwardPoints(100) |
530 end |
679 end |
680 ]] |
|
531 |
681 |
532 --[[ |
682 --[[ |
533 if t == "R" then |
683 if t == "R" then |
534 redCircsKilled[i] = redCircsKilled[i] + 1 |
684 redCircsKilled[i] = redCircsKilled[i] + 1 |
535 end |
685 end |
541 |
691 |
542 end |
692 end |
543 |
693 |
544 ----------------- |
694 ----------------- |
545 |
695 |
546 function bubbleSort(table) |
696 function UpdateSimpleAward(oldAward, value, threshold) |
547 |
697 local awarded = false |
548 for i = 1, #table do |
698 local newAward |
549 for j = 2, #table do |
699 if oldAward == nil then |
550 if table[j] < table[j-1] then |
700 if threshold == nil then |
551 |
701 awarded = true |
552 temp = table[j-1] |
702 elseif value > threshold then |
553 t2 = sdName[j-1] |
703 awarded = true |
554 t3 = sdKills[j-1] |
704 end |
555 |
705 elseif value > oldAward.value then |
556 table[j-1] = table[j] |
706 if threshold == nil then |
557 sdName[j-1] = sdName[j] |
707 awarded = true |
558 sdKills[j-1] = sdKills[j] |
708 elseif value > threshold then |
559 |
709 awarded = true |
560 table[j] = temp |
710 end |
561 sdName[j] = t2 |
711 end |
562 sdKills[j] = t3 |
712 if awarded then |
563 |
713 newAward = { |
564 end |
714 hogName = GetHogName(CurrentHedgehog), |
565 end |
715 teamName = GetHogTeamName(CurrentHedgehog), |
566 end |
716 value = value |
567 |
717 } |
568 return |
718 else |
569 |
719 newAward = oldAward |
570 end |
720 end |
571 |
721 return newAward |
572 ----------------- |
722 end |
573 |
723 |
574 function CommentOnScore() |
724 function CommentOnScore() |
575 |
725 local teamStats = {} |
576 for i = 0,(TeamsCount-1) do |
726 for i = 0,(TeamsCount-1) do |
577 sdScore[i] = teamScore[i] |
727 sdScore[i] = teamScore[i] |
578 sdKills[i] = teamCircsKilled[i] |
728 sdKills[i] = teamCircsKilled[i] |
579 sdName[i] = teamNameArr[i] |
729 sdName[i] = teamNameArr[i] |
580 end |
730 table.insert(teamStats, {score = teamScore[i], kills = teamCircsKilled[i], name = teamNameArr[i]}) |
581 |
731 end |
582 --bubbleSort(sdScore) |
732 |
583 |
733 local scorecomp = function (v1, v2) |
584 for i = 0,(TeamsCount-1) do |
734 if v1.score > v2.score then |
585 if sdName[i] ~= " " then |
735 return true |
586 teamComment[i] = sdName[i] .. " |" .. |
736 else |
587 loc("SCORE") .. ": " .. sdScore[i] .. " " .. loc("points") .. "|" .. |
737 return false |
588 loc("KILLS") .. ": " .. sdKills[i] .. " " .. loc("invaders destroyed") .. "|" .. |
738 end |
739 end |
|
740 table.sort(teamStats, scorecomp) |
|
741 local teamComment = {} |
|
742 for i = TeamsCount,1,-1 do |
|
743 local comment |
|
744 if teamStats[i].name ~= " " then |
|
745 local comment = teamStats[i].name .. " |" .. |
|
746 string.format(loc("Score: %d points"), teamStats[i].score) .. "|" .. |
|
747 string.format(loc("Kills: %d invaders destroyed"), teamStats[i].kills) .. "|" .. |
|
589 " " .. "|" |
748 " " .. "|" |
590 elseif sdName[i] == " " then |
749 table.insert(teamComment, comment) |
591 teamComment[i] = "|" |
750 |
592 end |
751 SendStat(siClanHealth, tostring(teamStats[i].score), teamStats[i].name) |
593 end |
752 else |
594 |
753 comment = "|" |
595 entireC = "" |
754 end |
596 for i = (TeamsCount-1),0,-1 do |
755 table.insert(teamComment, comment) |
756 end |
|
757 |
|
758 local entireC = "" |
|
759 for i = TeamsCount,1,-1 do |
|
597 entireC = entireC .. teamComment[i] |
760 entireC = entireC .. teamComment[i] |
598 end |
761 end |
599 |
762 local statusText, scoreText |
600 ShowMission("SPACE INVASION", loc("STATUS UPDATE"), loc("Rounds Complete") .. ": " .. roundNumber .. "/" .. roundLimit .. "| " .. "|" .. loc("Team Scores") .. ": |" ..entireC, 4, 1) |
763 if roundNumber >= roundLimit then |
601 |
764 if teamStats[1].score == teamStats[2].score then |
765 statusText = loc("Status Update") |
|
766 scoreText = loc("Team scores:") |
|
767 else |
|
768 statusText = loc("Game over!") |
|
769 scoreText = loc("Final team scores:") |
|
770 end |
|
771 else |
|
772 statusText = loc("Status Update") |
|
773 scoreText = loc("Team scores:") |
|
774 end |
|
775 ShowMission( loc("Space Invasion"), |
|
776 statusText, |
|
777 string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "| " .. "|" .. |
|
778 scoreText .. " |" ..entireC, 4, 1) |
|
779 |
|
780 if roundNumber >= roundLimit then |
|
781 local winnerTeam = teamStats[1].name |
|
782 local victorySoundPlayed = false |
|
783 for i = 0, (numhhs-1) do |
|
784 if GetHogTeamName(hhs[i]) == winnerTeam then |
|
785 if not victorySoundPlayer then |
|
786 PlaySound(sndVictory, hhs[i]) |
|
787 victorySoundPlayed = true |
|
788 end |
|
789 SetState(hhs[i], bor(GetState(hhs[i]), gstWinner)) |
|
790 end |
|
791 end |
|
792 AddCaption(string.format("%s wins!", winnerTeam)) |
|
793 SendStat(siGameResult, string.format("%s wins!", winnerTeam)) |
|
794 |
|
795 for i = 1, TeamsCount do |
|
796 SendStat(siPointType, loc("points")) |
|
797 SendStat(siPlayerKills, tostring(teamStats[i].score), teamStats[i].name) |
|
798 end |
|
799 |
|
800 local killscomp = function (v1, v2) |
|
801 if v1.kills > v2.kills then |
|
802 return true |
|
803 else |
|
804 return false |
|
805 end |
|
806 end |
|
807 |
|
808 |
|
809 --[[ Award some awards (just for fun, its for the stats screen only |
|
810 and has no effect on the score or game outcome. ]] |
|
811 local awardsGiven = 0 |
|
812 |
|
813 if awardTotalKills >= 30 then |
|
814 awardsGiven = awardsGiven + 1 |
|
815 SendStat(siCustomAchievement, |
|
816 string.format(loc("%d invaders have been destroyed in this game."), awardTotalKills)) |
|
817 end |
|
818 |
|
819 table.sort(teamStats, killscomp) |
|
820 local bestKills = teamStats[1].kills |
|
821 if bestKills > 10 then |
|
822 awardsGiven = awardsGiven + 1 |
|
823 local text |
|
824 if bestKills >= 50 then |
|
825 text = loc("BOOM! BOOM! BOOM! %s are the masters of destruction with %d destroyed invaders.") |
|
826 elseif bestKills >= 25 then |
|
827 text = loc("BOOM! %s really didn't like the invaders, so they decided to destroy as much as %d of them.") |
|
828 else |
|
829 text = loc("Boom! %s has destroyed %d invaders.") |
|
830 end |
|
831 SendStat(siCustomAchievement, |
|
832 string.format(text, |
|
833 teamStats[1].name, teamStats[1].kills)) |
|
834 end |
|
835 |
|
836 if awardRoundKills ~= nil then |
|
837 awardsGiven = awardsGiven + 1 |
|
838 local text |
|
839 if awardRoundKills.value >= 33 then |
|
840 text = loc("%s (%s) has been invited to join the Planetary Association of the Hedgehogs, it destroyed a staggering %d invaders in just one round!") |
|
841 elseif awardRoundKills.value >= 22 then |
|
842 if awardRoundKills.hogName == "Rambo" then |
|
843 text = loc("The hardships of the war turned %s (%s) into a killing machine: %d invaders destroyed in one round!") |
|
844 else |
|
845 text = loc("%s (%s) is Rambo in a hedgehog costume! He destroyed %d invaders in one round.") |
|
846 end |
|
847 elseif awardRoundKills.value >= 11 then |
|
848 text = loc("%s (%s) is addicted to killing: %d invaders destoyed in one round.") |
|
849 else |
|
850 text = loc("%s (%s) destroyed %d invaders in one round.") |
|
851 end |
|
852 SendStat(siCustomAchievement, |
|
853 string.format(text, |
|
854 awardRoundKills.hogName, awardRoundKills.teamName, awardRoundKills.value)) |
|
855 end |
|
856 if awardRoundScore ~= nil then |
|
857 awardsGiven = awardsGiven + 1 |
|
858 local text |
|
859 if awardRoundScore.value >= 300 then |
|
860 text = loc("%s (%s) was undoubtedly the very best professional tumbler in this game: %d points in one round!") |
|
861 elseif awardRoundScore.value >= 250 then |
|
862 text = loc("%s (%s) struck like a meteor: %d points in only one round!") |
|
863 elseif awardRoundScore.value >= 200 then |
|
864 text = loc("%s (%s) is good at this: %d points in only one round!") |
|
865 elseif awardRoundScore.value >= 150 then |
|
866 text = loc("%s (%s) tumbles like no other: %d points in one round.") |
|
867 elseif awardRoundScore.value >= 100 then |
|
868 text = loc("%s (%s) is a tumbleweed: %d points in one round.") |
|
869 else |
|
870 text = loc("%s (%s) was the best baby tumbler: %d points in one round.") |
|
871 end |
|
872 SendStat(siCustomAchievement, |
|
873 string.format(text, |
|
874 awardRoundScore.hogName, awardRoundScore.teamName, awardRoundScore.value)) |
|
875 end |
|
876 if awardAccuracy ~= nil then |
|
877 awardsGiven = awardsGiven + 1 |
|
878 local text |
|
879 if awardAccuracy.value >= 20 then |
|
880 text = loc("The Society of Perfectionists greets %s (%s): No misses and %d hits in its best round.") |
|
881 elseif awardAccuracy.value >= 10 then |
|
882 text = loc("%s (%s) is a hardened hunter: No misses and %d hits in its best round!") |
|
883 else |
|
884 text = loc("%s (%s) shot %d invaders and never missed in the best round!") |
|
885 end |
|
886 SendStat(siCustomAchievement, |
|
887 string.format(text, |
|
888 awardAccuracy.hogName, awardAccuracy.teamName, awardAccuracy.value)) |
|
889 end |
|
890 if awardCombo ~= nil then |
|
891 awardsGiven = awardsGiven + 1 |
|
892 local text |
|
893 if awardCombo.value >= 11 then |
|
894 text = loc("%s (%s) was lightning-fast! Longest combo of %d, absolutely insane!") |
|
895 elseif awardCombo.value >= 8 then |
|
896 text = loc("%s (%s) gave short shrift to the invaders: Longest combo of %d!") |
|
897 else |
|
898 text = loc("%s (%s) was on fire: Longest combo of %d.") |
|
899 end |
|
900 SendStat(siCustomAchievement, |
|
901 string.format(text, |
|
902 awardCombo.hogName, awardCombo.teamName, awardCombo.value)) |
|
903 end |
|
904 if awardsGiven == 0 then |
|
905 local text |
|
906 local r = math.random(1,4) |
|
907 if r == 1 then text = loc("This game wasn’t really exciting.") |
|
908 elseif r == 2 then text = loc("Did I miss something?") |
|
909 elseif r == 3 then text = loc("Nothing of interest has happened.") |
|
910 elseif r == 4 then text = loc("There are no snarky comments this time.") |
|
911 end |
|
912 |
|
913 SendStat(siCustomAchievement, text) |
|
914 end |
|
915 end |
|
602 end |
916 end |
603 |
917 |
604 function onNewRound() |
918 function onNewRound() |
605 roundNumber = roundNumber + 1 |
919 roundNumber = roundNumber + 1 |
606 |
920 |
607 CommentOnScore() |
921 CommentOnScore() |
608 |
922 |
609 -- end game if its at round limit |
923 -- end game if its at round limit |
610 if roundNumber == roundLimit then |
924 if roundNumber >= roundLimit then |
611 |
925 |
612 for i = 0, (TeamsCount-1) do |
926 for i = 0, (TeamsCount-1) do |
613 if teamScore[i] > bestScore then |
927 if teamScore[i] > bestScore then |
614 bestScore = teamScore[i] |
928 bestScore = teamScore[i] |
615 bestClan = teamClan[i] |
929 bestClan = teamClan[i] |
616 end |
930 end |
617 end |
931 end |
618 |
932 |
619 for i = 0, (numhhs-1) do |
|
620 if GetHogClan(hhs[i]) ~= bestClan then |
|
621 SetEffect(hhs[i], heResurrectable, 0) |
|
622 SetHealth(hhs[i],0) |
|
623 end |
|
624 end |
|
625 gameOver = true |
933 gameOver = true |
626 TurnTimeLeft = 0 --1 |
934 TurnTimeLeft = 0 --1 |
627 TimeLeft = 0 |
935 TimeLeft = 0 |
936 SendStat(siGraphTitle, "Score graph") |
|
937 EndGame() |
|
628 end |
938 end |
629 end |
939 end |
630 |
940 |
631 -- gaudy racer |
941 -- gaudy racer |
632 function CheckForNewRound() |
942 function CheckForNewRound() |
720 |
1030 |
721 if getGearValue(gear,"lifespan") == 0 then |
1031 if getGearValue(gear,"lifespan") == 0 then |
722 |
1032 |
723 if GetGearType(gear) == gtShell then |
1033 if GetGearType(gear) == gtShell then |
724 AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
1034 AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
1035 |
|
1036 --AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
725 WriteLnToConsole("about to delete a shell due to lifespan == 0") |
1037 WriteLnToConsole("about to delete a shell due to lifespan == 0") |
726 --elseif GetGearType(gear) == gtBall then |
1038 --elseif GetGearType(gear) == gtBall then |
727 -- AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true) |
1039 -- AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true) |
728 elseif GetGearType(gear) == gtExplosives then |
1040 elseif GetGearType(gear) == gtExplosives then |
729 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
1041 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
1042 PlaySound(sndExplosion) |
|
730 --nw WriteLnToConsole("about to delete a explosive due to lifespan == 0") |
1043 --nw WriteLnToConsole("about to delete a explosive due to lifespan == 0") |
731 elseif GetGearType(gear) == gtFlame then |
1044 elseif GetGearType(gear) == gtFlame then |
732 AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
1045 AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
733 --WriteLnToConsole("about to delete flame due to lifespan == 0") |
1046 --WriteLnToConsole("about to delete flame due to lifespan == 0") |
734 end |
1047 end |
816 wepIndex = wepIndex + 1 |
1129 wepIndex = wepIndex + 1 |
817 if wepIndex == wepCount then |
1130 if wepIndex == wepCount then |
818 wepIndex = 0 |
1131 wepIndex = 0 |
819 end |
1132 end |
820 |
1133 |
1134 --[[ |
|
1135 NOTE: Don’t show selected weapon as long we only have one. Remove this comment and activate this code |
|
1136 again as soon as at least one other weapon appears. |
|
821 AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo ) |
1137 AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo ) |
822 AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
1138 AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) |
1139 ]] |
|
823 |
1140 |
824 end |
1141 end |
825 |
1142 |
826 --function onTimer() |
1143 --function onTimer() |
827 |
1144 |
899 x = x*2 |
1216 x = x*2 |
900 y = y*2 |
1217 y = y*2 |
901 SetGearVelocity(morte, x, y) |
1218 SetGearVelocity(morte, x, y) |
902 |
1219 |
903 if wepAmmo[wepIndex] == 0 then |
1220 if wepAmmo[wepIndex] == 0 then |
904 PlaySound(sndSuddenDeath) |
1221 PlaySound(sndSuddenDeath) |
905 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
1222 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
906 else |
1223 else |
907 --AddCaption(loc("Ammo") .. ": " .. wepAmmo[wepIndex]) |
1224 --AddCaption(loc("Ammo") .. ": " .. wepAmmo[wepIndex]) |
1225 PlaySound(sndThrowRelease) |
|
908 end |
1226 end |
909 DrawTag(1) |
1227 DrawTag(1) |
910 |
1228 |
911 elseif wep[wepIndex] == loc("Mine Deployer") then |
1229 elseif wep[wepIndex] == loc("Mine Deployer") then |
912 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0) |
1230 morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0) |
913 SetTimer(morte, 1000) |
1231 SetTimer(morte, 1000) |
914 DrawTag(1) |
1232 DrawTag(1) |
915 end |
1233 end |
916 |
1234 |
917 elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
1235 elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
1236 PlaySound(sndDenied) |
|
918 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
1237 AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage) |
919 end |
1238 end |
920 |
1239 |
921 preciseOn = true |
1240 preciseOn = true |
922 |
1241 |
930 |
1249 |
931 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
1250 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
932 shieldMiser = false |
1251 shieldMiser = false |
933 if shieldHealth == 80 then |
1252 if shieldHealth == 80 then |
934 AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage) |
1253 AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage) |
935 PlaySound(sndMineTick) |
1254 PlaySound(sndDenied) |
936 PlaySound(sndSwitchHog) |
|
937 elseif (beam == false) and (shieldHealth > 80) then |
1255 elseif (beam == false) and (shieldHealth > 80) then |
938 beam = true |
1256 beam = true |
939 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff) |
1257 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff) |
940 AddCaption( loc("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. loc("Power Remaining") ) |
1258 AddCaption( loc("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. loc("Power Remaining") ) |
941 PlaySound(sndWarp) |
1259 PlaySound(sndWarp) |
948 end |
1266 end |
949 |
1267 |
950 function onHJump() |
1268 function onHJump() |
951 |
1269 |
952 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and |
1270 if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and |
953 (rAlpha == 255) and (radShotsLeft > 0) then |
1271 (rAlpha == 255) then |
954 rPingTimer = 0 |
1272 if radShotsLeft > 0 then |
955 rAlpha = 0 |
1273 rPingTimer = 0 |
956 radShotsLeft = radShotsLeft -1 |
1274 rAlpha = 0 |
957 AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage) |
1275 radShotsLeft = radShotsLeft -1 |
1276 AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage) |
|
1277 -- Play sonar sound |
|
1278 PlaySound(sndJetpackLaunch) |
|
1279 |
|
1280 else |
|
1281 AddCaption(loc("No radar pings left!"),0xFF0000FF,capgrpMessage) |
|
1282 PlaySound(sndDenied) |
|
1283 end |
|
958 end |
1284 end |
959 |
1285 |
960 end |
1286 end |
961 |
1287 |
962 ----------------- |
1288 ----------------- |
997 |
1323 |
998 -------------------------- |
1324 -------------------------- |
999 -- other event handlers |
1325 -- other event handlers |
1000 -------------------------- |
1326 -------------------------- |
1001 |
1327 |
1328 function onParameters() |
|
1329 parseParams() |
|
1330 if params["rounds"] ~= nil then |
|
1331 roundLimit = math.floor(tonumber(params["rounds"])) |
|
1332 end |
|
1333 if params["barrels"] ~= nil then |
|
1334 startBarrels = math.floor(tonumber(params["barrels"])) |
|
1335 end |
|
1336 if params["pings"] ~= nil then |
|
1337 startRadShots = math.floor(tonumber(params["pings"])) |
|
1338 end |
|
1339 if params["shield"] ~= nil then |
|
1340 startShield = math.floor(tonumber(params["shield"])) |
|
1341 end |
|
1342 |
|
1343 if params["barrelbonus"] ~= nil then |
|
1344 barrelBonus = math.floor(tonumber(params["barrelbonus"])) |
|
1345 end |
|
1346 if params["shieldbonus"] ~= nil then |
|
1347 shieldBonus = math.floor(tonumber(params["shieldbonus"])) |
|
1348 end |
|
1349 if params["timebonus"] ~= nil then |
|
1350 timeBonus = math.floor(tonumber(params["timebonus"])) |
|
1351 end |
|
1352 if params["forcetheme"] == "false" then |
|
1353 forceTheme = false |
|
1354 else |
|
1355 forceTheme = true |
|
1356 end |
|
1357 end |
|
1358 |
|
1002 function onGameInit() |
1359 function onGameInit() |
1003 ClearGameFlags() |
1360 --[[ Only GameFlags which are listed here are allowed. All other game flags will be discarded. |
1004 EnableGameFlags(gfRandomOrder) |
1361 Nonetheless this allows for some configuration in the game scheme ]] |
1005 Theme = "EarthRise" |
1362 local allowedFlags = |
1363 -- those flags are probably the most realistic one to use |
|
1364 gfDisableGirders + gfRandomOrder + -- highly recommended! |
|
1365 gfDisableLandObjects + gfSolidLand + gfLowGravity + |
|
1366 -- a bit unusual but may still be useful |
|
1367 gfBottomBorder + gfForts + gfDivideTeams + |
|
1368 gfDisableWind + gfMoreWind + gfTagTeam + |
|
1369 -- very unusual flags, they don’t affect gameplay really, they are mostly for funny graphical effects |
|
1370 gfKing + -- King Mode doesn’t work like expected, since hedgehogs never really die here in this mode |
|
1371 gfVampiric + -- just for the grapical effects |
|
1372 gfBorder -- technically possible, but not very fun to play |
|
1373 -- any other flag is FORBIDDEN and will be disabled when it is on anyways! |
|
1374 |
|
1375 GameFlags = band(GameFlags, allowedFlags) |
|
1376 |
|
1377 if forceTheme then |
|
1378 Theme = "EarthRise" |
|
1379 end |
|
1006 CaseFreq = 0 |
1380 CaseFreq = 0 |
1007 HealthCaseProb = 0 |
1381 HealthCaseProb = 0 |
1008 MinesNum = 0 |
|
1009 Explosives = 0 |
|
1010 Delay = 1000 |
1382 Delay = 1000 |
1011 |
1383 SuddenDeathTurns = 50 |
1012 for i = 0, 3 do |
1384 WaterRise = 0 |
1385 HealthDecrease = 0 |
|
1386 |
|
1387 for i = 0, 4 do |
|
1013 vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
1388 vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
1014 end |
1389 end |
1015 |
1390 |
1016 HideTags() |
1391 HideTags() |
1017 |
1392 |
1026 wepCount = 3 |
1401 wepCount = 3 |
1027 |
1402 |
1028 end |
1403 end |
1029 |
1404 |
1030 function onGameStart() |
1405 function onGameStart() |
1031 |
1406 SendHealthStatsOff() |
1032 if (MinesTime == -1000) or (MinesTime == 0) then |
|
1033 roundLimit = 3 |
|
1034 else |
|
1035 roundLimit = (MinesTime / 1000) |
|
1036 end |
|
1037 |
1407 |
1038 ShowMission ( |
1408 ShowMission ( |
1039 "SPACE INVASION", |
1409 "SPACE INVASION", |
1040 loc("a Hedgewars mini-game"), |
1410 loc("a Hedgewars mini-game"), |
1041 |
1411 |
1073 -- redraw Tags so that their screen locations are updated |
1443 -- redraw Tags so that their screen locations are updated |
1074 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1444 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1075 DrawTag(0) |
1445 DrawTag(0) |
1076 DrawTag(1) |
1446 DrawTag(1) |
1077 DrawTag(2) |
1447 DrawTag(2) |
1448 DrawTag(4) |
|
1078 end |
1449 end |
1079 |
1450 |
1080 end |
1451 end |
1081 |
1452 |
1082 function onNewTurn() |
1453 function onNewTurn() |
1083 |
1454 |
1084 --primShotsLeft = primShotsMax |
1455 --primShotsLeft = primShotsMax |
1085 radShotsLeft = 2 |
1456 radShotsLeft = startRadShots |
1086 stopMovement = false |
1457 stopMovement = false |
1087 tumbleStarted = false |
1458 tumbleStarted = false |
1088 boosterOn = false |
1459 boosterOn = false |
1089 beam = false |
1460 beam = false |
1090 shieldHealth = 30 + 80 -- 50 = 5 secs, roughly |
1461 shieldHealth = startShield + 80 -- 50 = 5 secs, roughly |
1091 shockwaveHealth = 0 |
1462 shockwaveHealth = 0 |
1092 |
1463 |
1093 RK = 0 |
1464 RK = 0 |
1094 GK = 0 |
1465 GK = 0 |
1095 BK = 0 |
1466 BK = 0 |
1096 OK = 0 |
1467 OK = 0 |
1097 SK = 0 |
1468 SK = 0 |
1098 roundKills = 0 |
1469 roundKills = 0 |
1470 roundScore = 0 |
|
1099 shieldMiser = true |
1471 shieldMiser = true |
1100 fierceComp = false |
1472 fierceComp = false |
1101 shotsFired = 0 |
1473 shotsFired = 0 |
1102 shotsHit = 0 |
1474 shotsHit = 0 |
1103 sniperHits = 0 |
1475 sniperHits = 0 |
1127 |
1499 |
1128 ------- |
1500 ------- |
1129 -- tumbler |
1501 -- tumbler |
1130 ---- |
1502 ---- |
1131 |
1503 |
1132 wepAmmo[0] = 5 |
1504 wepAmmo[0] = startBarrels |
1133 wepAmmo[1] = 2 |
1505 wepAmmo[1] = startRadShots |
1134 wepAmmo[2] = 5000 |
1506 wepAmmo[2] = 5000 |
1135 wepIndex = 2 |
1507 wepIndex = 2 |
1136 ChangeWeapon() |
1508 ChangeWeapon() |
1137 |
1509 |
1138 |
1510 |
1242 rAlpha = 255 |
1614 rAlpha = 255 |
1243 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1615 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1244 DrawTag(0) |
1616 DrawTag(0) |
1245 DrawTag(1) |
1617 DrawTag(1) |
1246 DrawTag(2) |
1618 DrawTag(2) |
1619 DrawTag(4) |
|
1247 SetMyCircles(true) |
1620 SetMyCircles(true) |
1248 end |
1621 end |
1249 end |
1622 end |
1250 |
1623 |
1251 --WriteLnToConsole("Finished initial check") |
1624 --WriteLnToConsole("Finished initial check") |
1263 if TimeLeft >= 0 then |
1636 if TimeLeft >= 0 then |
1264 --AddCaption(LOC_NOT("Time Left: ") .. TimeLeft) |
1637 --AddCaption(LOC_NOT("Time Left: ") .. TimeLeft) |
1265 DrawTag(0) |
1638 DrawTag(0) |
1266 end |
1639 end |
1267 |
1640 |
1641 end |
|
1642 |
|
1643 if (TimeLeftCounter % 1000) == 0 and TimeLeft == 5 then |
|
1644 PlaySound(sndHurry, CurrentHedgehog) |
|
1268 end |
1645 end |
1269 |
1646 |
1270 --WriteLnToConsole("Finished timeleft calculations") |
1647 --WriteLnToConsole("Finished timeleft calculations") |
1271 |
1648 |
1272 ------------------------------- |
1649 ------------------------------- |
1278 end |
1655 end |
1279 |
1656 |
1280 --WriteLnToConsole("successfully checked playerIsFine") |
1657 --WriteLnToConsole("successfully checked playerIsFine") |
1281 |
1658 |
1282 if (TimeLeft == 0) then |
1659 if (TimeLeft == 0) then |
1660 if PlayerIsFine() then AddCaption(loc("Time's up!")) end |
|
1283 if (stopMovement == false) then --time to stop the player |
1661 if (stopMovement == false) then --time to stop the player |
1284 stopMovement = true |
1662 stopMovement = true |
1285 boosterOn = false |
1663 boosterOn = false |
1286 beam = false |
1664 beam = false |
1287 upOn = false |
1665 upOn = false |
1288 down = false |
1666 down = false |
1289 leftOn = false |
1667 leftOn = false |
1290 rightOn = false |
1668 rightOn = false |
1291 SetMyCircles(false) |
1669 SetMyCircles(false) |
1292 HideTags() |
|
1293 rAlpha = 255 |
1670 rAlpha = 255 |
1294 --nw WriteLnToConsole("Player is out of luck") |
1671 --nw WriteLnToConsole("Player is out of luck") |
1295 |
1672 |
1296 if shieldMiser == true then |
1673 if shieldMiser == true then |
1297 |
1674 |
1299 |
1676 |
1300 AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo) |
1677 AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo) |
1301 AwardPoints(p) |
1678 AwardPoints(p) |
1302 end |
1679 end |
1303 |
1680 |
1304 if ((shotsHit / shotsFired * 100) >= 80) and (shotsFired > 4) then |
1681 local accuracy = (shotsHit / shotsFired) * 100 |
1682 if (accuracy >= 80) and (shotsFired > 4) then |
|
1305 AddCaption(loc("Accuracy Bonus!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
1683 AddCaption(loc("Accuracy Bonus!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpVolume) |
1306 AwardPoints(15) |
1684 AwardPoints(15) |
1685 |
|
1686 |
|
1687 -- special award for no misses |
|
1688 local award = false |
|
1689 if awardAccuracy == nil then |
|
1690 if (shotsHit >= shotsFired) then |
|
1691 award = true |
|
1692 end |
|
1693 elseif (shotsHit == shotsFired) and shotsHit > awardAccuracy.value then |
|
1694 award = true |
|
1695 end |
|
1696 if award then |
|
1697 awardAccuracy = { |
|
1698 hogName = GetHogName(CurrentHedgehog), |
|
1699 teamName = GetHogTeamName(CurrentHedgehog), |
|
1700 value = shotsHit, |
|
1701 } |
|
1702 end |
|
1703 |
|
1307 end |
1704 end |
1705 |
|
1706 AddCaption(loc(string.format("Round score: %d", roundScore)), 0xFFFFFFFF, capgrpMessage2) |
|
1707 |
|
1708 -- other awards |
|
1709 awardRoundScore = UpdateSimpleAward(awardRoundScore, roundScore, 50) |
|
1710 awardRoundKills = UpdateSimpleAward(awardRoundKills, roundKills, 5) |
|
1711 |
|
1712 HideTags() |
|
1308 |
1713 |
1309 end |
1714 end |
1310 else -- remove this if you want tumbler to fall slowly on death |
1715 else -- remove this if you want tumbler to fall slowly on death |
1311 ------------------------------- |
1716 ------------------------------- |
1312 -- Player is still in luck |
1717 -- Player is still in luck |
1416 function onGearResurrect(gear) |
1821 function onGearResurrect(gear) |
1417 |
1822 |
1418 -- did I fall into the water? well, that was a stupid thing to do |
1823 -- did I fall into the water? well, that was a stupid thing to do |
1419 if gear == CurrentHedgehog then |
1824 if gear == CurrentHedgehog then |
1420 TimeLeft = 0 |
1825 TimeLeft = 0 |
1826 playerIsFine = false |
|
1421 --WriteLnToConsole("Current hedgehog just drowned himself") |
1827 --WriteLnToConsole("Current hedgehog just drowned himself") |
1422 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1828 --WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks) |
1423 end |
1829 end |
1424 |
1830 |
1425 end |
1831 end |
1674 |
2080 |
1675 vCircActive[i] = false |
2081 vCircActive[i] = false |
1676 |
2082 |
1677 if (vType[i] == "drone") then |
2083 if (vType[i] == "drone") then |
1678 PlaySound(sndHellishImpact4) |
2084 PlaySound(sndHellishImpact4) |
1679 TimeLeft = TimeLeft + 4 |
2085 TimeLeft = TimeLeft + timeBonus |
1680 AddCaption(loc("Time Extended!") .. "+" .. 4 .. loc("sec"), 0xff0000ff,capgrpMessage ) |
2086 AddCaption(loc("Time Extended!") .. "+" .. timeBonus .. loc("sec"), 0xff0000ff,capgrpMessage ) |
1681 DrawTag(0) |
2087 DrawTag(0) |
1682 |
2088 |
1683 morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1) |
2089 morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1) |
1684 SetHealth(morte, 0) |
2090 SetHealth(morte, 0) |
1685 |
2091 |
1692 |
2098 |
1693 elseif (vType[i] == "ammo") then |
2099 elseif (vType[i] == "ammo") then |
1694 AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false) |
2100 AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false) |
1695 PlaySound(sndExplosion) |
2101 PlaySound(sndExplosion) |
1696 PlaySound(sndShotgunReload) |
2102 PlaySound(sndShotgunReload) |
1697 wepAmmo[0] = wepAmmo[0] +3 |
2103 wepAmmo[0] = wepAmmo[0] + barrelBonus |
1698 --primShotsLeft = primShotsLeft + 3 |
2104 --primShotsLeft = primShotsLeft + 3 |
1699 AddCaption("+" .. 3 .. " " .. loc("Ammo"), 0x00ff00ff,capgrpMessage) |
2105 AddCaption(string.format("+%d Ammo", barrelBonus), 0x00ff00ff,capgrpMessage) |
1700 DrawTag(1) |
2106 DrawTag(1) |
1701 |
2107 |
1702 GK = GK + 1 |
2108 GK = GK + 1 |
1703 if GK == 3 then |
2109 if GK == 3 then |
1704 GK = 0 |
2110 GK = 0 |
1719 AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false) |
2125 AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false) |
1720 |
2126 |
1721 PlaySound(sndVaporize) |
2127 PlaySound(sndVaporize) |
1722 --sndWarp sndMineTick --sndSwitchHog --sndSuddenDeath |
2128 --sndWarp sndMineTick --sndSwitchHog --sndSuddenDeath |
1723 |
2129 |
1724 shieldHealth = shieldHealth + 30 |
2130 shieldHealth = shieldHealth + shieldBonus |
1725 AddCaption(loc("Shield boosted! +30 power"), 0xa800ffff,capgrpMessage) |
2131 AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage) |
1726 if shieldHealth >= 250 then |
2132 if shieldHealth >= 250 then |
1727 shieldHealth = 250 |
2133 shieldHealth = 250 |
1728 AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage) |
2134 AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage) |
1729 end |
2135 end |
1730 DrawTag(2) |
2136 DrawTag(2) |
1762 if chainLength > 1 then |
2168 if chainLength > 1 then |
1763 AddCaption( chainLength .. "-" .. loc("Hit Combo!") .. " +" .. chainLength*2 .. " " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate) |
2169 AddCaption( chainLength .. "-" .. loc("Hit Combo!") .. " +" .. chainLength*2 .. " " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate) |
1764 AwardPoints(chainLength*2) |
2170 AwardPoints(chainLength*2) |
1765 end |
2171 end |
1766 |
2172 |
2173 awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5) |
|
2174 |
|
1767 else |
2175 else |
1768 -- circle is merely damaged |
2176 -- circle is merely damaged |
1769 -- do damage effects/sounds |
2177 -- do damage effects/sounds |
1770 AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false) |
2178 AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false) |
1771 r = GetRandom(4) |
2179 r = math.random(1,4) |
1772 if r == 0 then |
2180 PlaySound(_G["sndHellishImpact" .. tostring(r)]) |
1773 PlaySound(sndHellishImpact1) |
|
1774 elseif r == 1 then |
|
1775 PlaySound(sndHellishImpact2) |
|
1776 elseif r == 2 then |
|
1777 PlaySound(sndHellishImpact3) |
|
1778 elseif r == 3 then |
|
1779 PlaySound(sndHellishImpact4) |
|
1780 end |
|
1781 res = "non-fatal" |
2181 res = "non-fatal" |
1782 |
2182 |
1783 end |
2183 end |
1784 |
2184 |
1785 return(res) |
2185 return(res) |
1901 |
2301 |
1902 end |
2302 end |
1903 |
2303 |
1904 end |
2304 end |
1905 |
2305 |
1906 function WellHeAintGonnaJumpNoMore(x,y) |
2306 function WellHeAintGonnaJumpNoMore(x,y,explode) |
1907 |
2307 if explode==true then |
1908 AddVisualGear(x, y, vgtBigExplosion, 0, false) |
2308 AddVisualGear(x, y, vgtBigExplosion, 0, false) |
2309 PlaySound(sndExplosion) |
|
2310 local r = math.random(1,3) |
|
2311 PlaySound(_G["sndOoff"..r], CurrentHedgehog) |
|
2312 end |
|
2313 |
|
1909 playerIsFine = false |
2314 playerIsFine = false |
1910 AddCaption(loc("GOTCHA!")) |
2315 AddCaption(loc("GOTCHA!")) |
1911 PlaySound(sndExplosion) |
|
1912 PlaySound(sndHellish) |
2316 PlaySound(sndHellish) |
1913 |
2317 |
1914 targetHit = true |
2318 targetHit = true |
1915 |
2319 |
1916 end |
2320 end |
1959 AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
2363 AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
1960 AwardPoints(8) |
2364 AwardPoints(8) |
1961 if sniperHits == 3 then |
2365 if sniperHits == 3 then |
1962 sniperHits = 0 |
2366 sniperHits = 0 |
1963 AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
2367 AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState) |
1964 AwardPoints(15) |
2368 AwardPoints(16) |
1965 end |
2369 end |
1966 elseif dist <= 6000 then |
2370 elseif dist <= 6000 then |
1967 pointBlankHits = pointBlankHits +1 |
2371 pointBlankHits = pointBlankHits +1 |
1968 if pointBlankHits == 3 then |
2372 if pointBlankHits == 3 then |
1969 pointBlankHits = 0 |
2373 pointBlankHits = 0 |
2020 AwardPoints(10) |
2424 AwardPoints(10) |
2021 end |
2425 end |
2022 end |
2426 end |
2023 |
2427 |
2024 elseif dist < 1600 then |
2428 elseif dist < 1600 then |
2025 WellHeAintGonnaJumpNoMore(GetX(gear), GetY(gear)) |
2429 WellHeAintGonnaJumpNoMore(GetX(gear), GetY(gear), true) |
2026 end |
2430 end |
2027 |
2431 |
2028 --[[if targetHit == true then |
2432 --[[if targetHit == true then |
2029 WriteLnToConsole("about to delete shell due to targetHit being set to true earlier") |
2433 WriteLnToConsole("about to delete shell due to targetHit being set to true earlier") |
2030 DeleteGear(gear) |
2434 DeleteGear(gear) |
2083 elseif (vCircActive[i] == true) and |
2487 elseif (vCircActive[i] == true) and |
2084 ( (vType[i] == "drone") or (vType[i] == "blueboss") ) |
2488 ( (vType[i] == "drone") or (vType[i] == "blueboss") ) |
2085 then |
2489 then |
2086 |
2490 |
2087 ss = CircleDamaged(i) |
2491 ss = CircleDamaged(i) |
2088 WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog)) |
2492 local explosion |
2493 if vType[i] == "blueboss" then explosion = true else explosion = false end |
|
2494 WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion) |
|
2089 |
2495 |
2090 if ss == "fatal" then |
2496 if ss == "fatal" then |
2091 |
2497 |
2092 if (wepAmmo[0] == 0) and (TimeLeft <= 9) then |
2498 if (wepAmmo[0] == 0) and (TimeLeft <= 9) then |
2093 --if (primShotsLeft == 0) and (TimeLeft <= 9) then |
2499 --if (primShotsLeft == 0) and (TimeLeft <= 9) then |
2094 AddCaption(loc("Kamikaze Expert!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2500 AddCaption(loc("Kamikaze Expert!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2095 AwardPoints(15) |
2501 AwardPoints(15) |
2502 PlaySound(sndKamikaze, CurrentHedgehog) |
|
2096 elseif (wepAmmo[0] == 0) then |
2503 elseif (wepAmmo[0] == 0) then |
2097 AddCaption(loc("Depleted Kamikaze!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2504 AddCaption(loc("Depleted Kamikaze!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2098 AwardPoints(5) |
2505 AwardPoints(5) |
2506 PlaySound(sndKamikaze, CurrentHedgehog) |
|
2099 elseif TimeLeft <= 9 then |
2507 elseif TimeLeft <= 9 then |
2100 AddCaption(loc("Timed Kamikaze!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2508 AddCaption(loc("Timed Kamikaze!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage) |
2101 AwardPoints(10) |
2509 AwardPoints(10) |
2510 PlaySound(sndKamikaze, CurrentHedgehog) |
|
2102 end |
2511 end |
2103 end |
2512 end |
2104 |
2513 |
2105 end |
2514 end |
2106 |
2515 |