1 HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
2 |
|
3 local player = nil |
|
4 local scored = 0 |
|
5 local end_timer = 1000 |
|
6 local game_lost = false |
|
7 local time_goal = 0 |
|
8 |
|
9 function spawnTarget() |
|
10 |
|
11 gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
|
12 |
|
13 if scored == 0 then x = 628 end |
|
14 if scored == 1 then x = 891 end |
|
15 if scored == 2 then x = 1309 end |
|
16 if scored == 3 then x = 1128 end |
|
17 if scored == 4 then x = 410 end |
|
18 if scored == 5 then x = 1564 end |
|
19 if scored == 6 then x = 1348 end |
|
20 if scored == 7 then x = 169 end |
|
21 if scored == 8 then x = 1720 end |
|
22 if scored == 9 then x = 1441 end |
|
23 if scored == 10 then x = 599 end |
|
24 if scored == 11 then x = 1638 end |
|
25 |
|
26 if scored == 6 then |
|
27 SetGearPosition(gear, 1248, 476) |
|
28 else |
|
29 SetGearPosition(gear, x, 0) |
|
30 end |
|
31 |
|
32 end |
|
33 |
|
34 function onGameInit() |
|
35 |
|
36 Seed = 1 |
|
37 GameFlags = gfDisableWind + gfInfAttack + gfOneClanMode |
|
38 TurnTime = 180 * 1000 |
|
39 Map = "Trash" |
|
40 Theme = "Golf" |
|
41 Goals = "Take down all the targets|Achieve it using only Cluster Bomb" |
|
42 CaseFreq = 0 |
|
43 MinesNum = 0 |
|
44 Explosives = 0 |
|
45 |
|
46 AddTeam("The Hogies", 2850005, "Statue", "Island", "Hog Islands") |
|
47 |
|
48 player = AddHog(loc("Private Novak"), 0, 1, "war_desertGrenadier1") |
|
49 SetGearPosition(player, 756, 370) |
|
50 |
|
51 end |
|
52 |
|
53 function onAmmoStoreInit() |
|
54 |
|
55 SetAmmo(amClusterBomb, 9, 0, 0, 0) |
|
56 |
|
57 end |
|
58 |
|
59 function onGameStart() |
|
60 |
|
61 ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("You have to destroy 12 targets in 180 seconds"), -amClusterBomb, 5000) |
|
62 spawnTarget() |
|
63 |
|
64 end |
|
65 |
|
66 function onGameTick20() |
|
67 |
|
68 if TurnTimeLeft < 40 and TurnTimeLeft > 0 and scored < 12 and game_lost == false then |
|
69 game_lost = true |
|
70 ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) |
|
71 SetHealth(player, 0) |
|
72 time_goal = 1 |
|
73 end |
|
74 |
|
75 if scored == 12 or game_lost then |
|
76 if end_timer == 0 then |
|
77 EndGame() |
|
78 else |
|
79 TurnTimeLeft = time_goal |
|
80 end |
|
81 end_timer = end_timer - 20 |
|
82 end |
|
83 |
|
84 end |
|
85 |
|
86 function onNewTurn() |
|
87 ParseCommand("setweap " .. string.char(amClusterBomb)) |
|
88 end |
|
89 |
|
90 --function onGearAdd(gear) |
|
91 --end |
|
92 |
|
93 function onGearDamage(gear, damage) |
|
94 |
|
95 if GetGearType(gear) == gtTarget then |
|
96 scored = scored + 1 |
|
97 if scored < 12 then |
|
98 spawnTarget() |
|
99 else |
|
100 if not game_lost then |
|
101 |
|
102 if TurnTimeLeft > 90 * 10 then |
|
103 ShowMission(loc("Cluster Bomb MASTER!"), loc("Aiming Practice"), loc("Congratulations! You needed only half of time|to eliminate all targets."), 4, 0) |
|
104 else |
|
105 ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) |
|
106 end |
|
107 PlaySound(sndVictory) |
|
108 time_goal = TurnTimeLeft |
|
109 end |
|
110 end |
|
111 end |
|
112 |
|
113 if GetGearType(gear) == gtHedgehog then |
|
114 game_lost = true |
|
115 ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0) |
|
116 SetHealth(player, 0) |
|
117 time_goal = 1 |
|
118 end |
|
119 |
|
120 end |
|
121 |
|
122 function onGearDelete(gear) |
|
123 end |
|