author | Stepan777 <stepik-777@mail.ru> |
Fri, 06 Jul 2012 13:22:33 +0400 | |
changeset 7350 | 1dbf3f4340e0 |
parent 7165 | aad1aea05f1e |
child 7877 | b3fb94986255 |
permissions | -rw-r--r-- |
6501 | 1 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
2 |
||
3 |
local player = nil |
|
4 |
local scored = 0 |
|
5 |
local end_timer = 5000 |
|
6 |
local game_lost = false |
|
7 |
local time_goal = 0 |
|
8 |
||
9 |
function spawnTarget() |
|
6505 | 10 |
|
6501 | 11 |
gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
6505 | 12 |
|
13 |
if scored == 0 then x = 1652 end |
|
14 |
if scored == 1 then x = 1915 end |
|
15 |
if scored == 2 then x = 2333 end |
|
16 |
if scored == 3 then x = 2152 end |
|
17 |
if scored == 4 then x = 1434 end |
|
18 |
if scored == 5 then x = 2588 end |
|
19 |
if scored == 6 then x = 2372 end |
|
20 |
if scored == 7 then x = 1193 end |
|
21 |
if scored == 8 then x = 2744 end |
|
22 |
if scored == 9 then x = 2465 end |
|
23 |
if scored == 10 then x = 1623 end |
|
24 |
if scored == 11 then x = 2662 end |
|
25 |
||
26 |
if scored == 6 then |
|
27 |
SetGearPosition(gear, 2272, 1500) |
|
28 |
else |
|
29 |
SetGearPosition(gear, x, 1000) |
|
30 |
end |
|
31 |
||
6501 | 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 |
||
6505 | 48 |
player = AddHog(loc("Private Novak"), 0, 1, "war_desertGrenadier1") |
6501 | 49 |
SetGearPosition(player, 1780, 1300) |
50 |
||
51 |
end |
|
52 |
||
53 |
function onAmmoStoreInit() |
|
54 |
||
55 |
SetAmmo(amClusterBomb, 9, 0, 0, 0) |
|
56 |
||
57 |
end |
|
58 |
||
59 |
function onGameStart() |
|
60 |
||
6505 | 61 |
ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("You have to destroy 12 targets in 180 seconds"), -amClusterBomb, 5000) |
6501 | 62 |
spawnTarget() |
63 |
||
64 |
end |
|
65 |
||
7165
aad1aea05f1e
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents:
6505
diff
changeset
|
66 |
function onGameTick20() |
6501 | 67 |
|
7165
aad1aea05f1e
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents:
6505
diff
changeset
|
68 |
if TurnTimeLeft < 40 and TurnTimeLeft > 0 and scored < 12 and game_lost == false then |
6501 | 69 |
game_lost = true |
6505 | 70 |
ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) |
6501 | 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 |
|
7165
aad1aea05f1e
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents:
6505
diff
changeset
|
79 |
end_timer = end_timer - 20 |
6501 | 80 |
TurnTimeLeft = time_goal |
81 |
end |
|
82 |
end |
|
83 |
||
84 |
end |
|
85 |
||
86 |
function onNewTurn() |
|
6505 | 87 |
ParseCommand("setweap " .. string.char(amClusterBomb)) |
6501 | 88 |
end |
89 |
||
7165
aad1aea05f1e
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents:
6505
diff
changeset
|
90 |
--function onGearAdd(gear) |
aad1aea05f1e
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents:
6505
diff
changeset
|
91 |
--end |
6501 | 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 |
|
6505 | 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 |
|
6501 | 107 |
PlaySound(sndVictory) |
108 |
time_goal = TurnTimeLeft |
|
109 |
end |
|
110 |
end |
|
111 |
end |
|
6505 | 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 |
||
6501 | 120 |
end |
121 |
||
122 |
function onGearDelete(gear) |
|
7165
aad1aea05f1e
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
nemo
parents:
6505
diff
changeset
|
123 |
end |