author | nemo |
Mon, 29 Oct 2012 14:22:29 -0400 | |
changeset 7877 | b3fb94986255 |
parent 7165 | aad1aea05f1e |
child 7889 | 57b117d441b9 |
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 |
|
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
13 |
if scored == 0 then x = 628 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
14 |
if scored == 1 then x = 891 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
15 |
if scored == 2 then x = 1309 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
16 |
if scored == 3 then x = 1128 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
17 |
if scored == 4 then x = 410 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
18 |
if scored == 5 then x = 1564 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
19 |
if scored == 6 then x = 1348 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
20 |
if scored == 7 then x = 169 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
21 |
if scored == 8 then x = 1720 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
22 |
if scored == 9 then x = 1441 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
23 |
if scored == 10 then x = 599 end |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
24 |
if scored == 11 then x = 1638 end |
6505 | 25 |
|
26 |
if scored == 6 then |
|
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
27 |
SetGearPosition(gear, 1248, 476) |
6505 | 28 |
else |
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
29 |
SetGearPosition(gear, x, 0) |
6505 | 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") |
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
7165
diff
changeset
|
49 |
SetGearPosition(player, 756, 370) |
6501 | 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 |