|
1 ------------------- ABOUT ---------------------- |
|
2 -- |
|
3 -- In this cold planet hero seeks for a part of the |
|
4 -- antigravity device. He has to capture Icy Pit who |
|
5 -- knows where the device is hidden. Hero will be |
|
6 -- able to use only the ice gun for this mission. |
|
7 |
|
8 HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
9 HedgewarsScriptLoad("/Scripts/Animate.lua") |
|
10 |
|
11 ----------------- VARIABLES -------------------- |
|
12 -- globals |
|
13 local heroAtAntiFlyArea = false |
|
14 -- crates |
|
15 local icegunY = 1950 |
|
16 local icegunX = 260 |
|
17 -- hogs |
|
18 local hero = {} |
|
19 local ally = {} |
|
20 local bandit1 = {} |
|
21 local bandit2 = {} |
|
22 local bandit3 = {} |
|
23 local bandit4 = {} |
|
24 local bandit5 = {} |
|
25 -- teams |
|
26 local teamA = {} |
|
27 local teamB = {} |
|
28 local teamC = {} |
|
29 local teamD = {} |
|
30 -- hedgehogs values |
|
31 hero.name = "Hog Solo" |
|
32 hero.x = 340 |
|
33 hero.y = 1840 |
|
34 hero.dead = false |
|
35 ally.name = "Paul McHoggy" |
|
36 ally.x = 300 |
|
37 ally.y = 1840 |
|
38 bandit1.name = "Thanta" |
|
39 bandit1.x = 3240 |
|
40 bandit1.y = 1280 |
|
41 bandit2.name = "Billy Frost" |
|
42 bandit2.x = 1480 |
|
43 bandit2.y = 1990 |
|
44 bandit3.name = "Ice Jake" |
|
45 bandit3.x = 1860 |
|
46 bandit3.y = 1150 |
|
47 bandit4.name = "John Snow" |
|
48 bandit4.x = 3250 |
|
49 bandit4.y = 970 |
|
50 bandit5.name = "White Tee" |
|
51 bandit5.x = 3300 |
|
52 bandit5.y = 600 |
|
53 teamA.name = loc("Allies") |
|
54 teamA.color = tonumber("FF0000",16) -- red |
|
55 teamB.name = loc("Frozen Bandits") |
|
56 teamB.color = tonumber("0033FF",16) -- blues |
|
57 teamC.name = loc("Hog Solo") |
|
58 teamC.color = tonumber("38D61C",16) -- green |
|
59 |
|
60 -------------- LuaAPI EVENT HANDLERS ------------------ |
|
61 |
|
62 function onGameInit() |
|
63 Seed = 1 |
|
64 --GameFlags = gfDisableWind |
|
65 TurnTime = 25000 |
|
66 CaseFreq = 0 |
|
67 MinesNum = 0 |
|
68 MinesTime = 3000 |
|
69 Explosives = 0 |
|
70 Delay = 5 |
|
71 Map = "ice01_map" |
|
72 Theme = "Snow" |
|
73 |
|
74 -- Hog Solo |
|
75 AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
76 hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
|
77 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
|
78 HogTurnLeft(hero.gear, true) |
|
79 -- Ally |
|
80 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
81 ally.gear = AddHog(ally.name, 0, 100, "tophats") |
|
82 AnimSetGearPosition(ally.gear, ally.x, ally.y) |
|
83 -- Frozen Bandits |
|
84 AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
85 bandit1.gear = AddHog(bandit1.name, 0, 100, "tophats") |
|
86 AnimSetGearPosition(bandit1.gear, bandit1.x, bandit1.y) |
|
87 HogTurnLeft(bandit1.gear, true) |
|
88 bandit2.gear = AddHog(bandit2.name, 0, 100, "tophats") |
|
89 AnimSetGearPosition(bandit2.gear, bandit2.x, bandit2.y) |
|
90 bandit3.gear = AddHog(bandit3.name, 0, 100, "tophats") |
|
91 AnimSetGearPosition(bandit3.gear, bandit3.x, bandit3.y) |
|
92 bandit4.gear = AddHog(bandit4.name, 0, 100, "tophats") |
|
93 AnimSetGearPosition(bandit4.gear, bandit4.x, bandit4.y) |
|
94 HogTurnLeft(bandit4.gear, true) |
|
95 bandit5.gear = AddHog(bandit5.name, 0, 100, "tophats") |
|
96 AnimSetGearPosition(bandit5.gear, bandit5.x, bandit5.y) |
|
97 HogTurnLeft(bandit5.gear, true) |
|
98 |
|
99 AnimInit() |
|
100 AnimationSetup() |
|
101 end |
|
102 |
|
103 function onGameStart() |
|
104 AnimWait(hero.gear, 3000) |
|
105 FollowGear(hero.gear) |
|
106 |
|
107 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 1) |
|
108 AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1) |
|
109 AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1) |
|
110 |
|
111 AddAmmo(hero.gear, amJetpack, 99) |
|
112 AddAmmo(hero.gear, amBazooka, 1) |
|
113 SpawnAmmoCrate(icegunX, icegunY, amIceGun) |
|
114 |
|
115 end |
|
116 |
|
117 function onNewTurn() |
|
118 -- rounds start if hero got his weapons or got near the enemies |
|
119 if not heroAtAntiFlyArea and CurrentHedgehog ~= hero.gear then |
|
120 WriteLnToConsole(" IF 1") |
|
121 TurnTimeLeft = 0 |
|
122 elseif not heroAtAntiFlyArea and CurrentHedgehog == hero.gear then |
|
123 WriteLnToConsole(" IF 2") |
|
124 TurnTimeLeft = -1 |
|
125 end |
|
126 end |
|
127 |
|
128 function onGameTick() |
|
129 AnimUnWait() |
|
130 if ShowAnimation() == false then |
|
131 return |
|
132 end |
|
133 ExecuteAfterAnimations() |
|
134 CheckEvents() |
|
135 end |
|
136 |
|
137 function onAmmoStoreInit() |
|
138 SetAmmo(amIceGun, 0, 0, 0, 1) |
|
139 end |
|
140 |
|
141 function onGearDelete(gear) |
|
142 if gear == hero.gear then |
|
143 hero.dead = true |
|
144 end |
|
145 end |
|
146 |
|
147 -------------- EVENTS ------------------ |
|
148 |
|
149 function onAntiFlyArea(gear) |
|
150 if not hero.dead and (GetX(gear) > 860 or GetY(gear) < 1400) and not heroAtAntiFlyArea then |
|
151 return true |
|
152 end |
|
153 return false |
|
154 end |
|
155 |
|
156 function onNonAntiFlyArea(gear) |
|
157 if not hero.dead and (GetX(gear) < 860 and GetY(gear) > 1400) and heroAtAntiFlyArea then |
|
158 return true |
|
159 end |
|
160 return false |
|
161 end |
|
162 |
|
163 function onHeroDeath(gear) |
|
164 if hero.dead then |
|
165 return true |
|
166 end |
|
167 return false |
|
168 end |
|
169 |
|
170 -------------- OUTCOMES ------------------ |
|
171 |
|
172 function antiFlyArea(gear) |
|
173 heroAtAntiFlyArea = true |
|
174 TurnTimeLeft = 0 |
|
175 FollowGear(hero.gear) |
|
176 AddAmmo(hero.gear, amJetpack, 0) |
|
177 AnimSwitchHog(bandit1.gear) |
|
178 FollowGear(hero.gear) |
|
179 TurnTimeLeft = 0 |
|
180 end |
|
181 |
|
182 function nonAntiFlyArea(gear) |
|
183 heroAtAntiFlyArea = false |
|
184 TurnTimeLeft = 0 |
|
185 FollowGear(hero.gear) |
|
186 AddAmmo(hero.gear, amJetpack, 99) |
|
187 AnimSwitchHog(bandit1.gear) |
|
188 FollowGear(hero.gear) |
|
189 TurnTimeLeft = 0 |
|
190 end |
|
191 |
|
192 function heroDeath(gear) |
|
193 SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1 |
|
194 -- more custom stats |
|
195 EndGame() |
|
196 end |
|
197 |
|
198 -------------- ANIMATIONS ------------------ |
|
199 |
|
200 function AnimationSetup() |
|
201 |
|
202 end |