2 -- |
2 -- |
3 -- In this adventure hero visits the fruit planet |
3 -- In this adventure hero visits the fruit planet |
4 -- to search for the missing part. However, a war |
4 -- to search for the missing part. However, a war |
5 -- has broke out and hero has to take part or leave. |
5 -- has broke out and hero has to take part or leave. |
6 |
6 |
7 -- TODO: remove unwanted delay after first dialog |
7 -- TODO: |
|
8 -- * remove unwanted delay after first dialog |
|
9 -- * check strings |
|
10 -- * rethink the difficulty level |
|
11 -- NOTES: |
|
12 -- There is an ugly hack out there! I use 2 Captain Limes |
|
13 -- One in human level and one in bot level |
|
14 -- I want to have a Captain Lime in human level when the game |
|
15 -- begins because in animation if the hog is in bot level skip |
|
16 -- doesn't work - onPrecise() isn't triggered |
|
17 -- Later I want the hog to take place in the battle in bot level |
|
18 -- However if I use SetHogLevel I get an error: Engine bug: AI may break demos playing |
|
19 -- So I have 2 hogs, one in bot level and one in hog level that I hide them |
|
20 -- or restore them regarding the case |
8 |
21 |
9 HedgewarsScriptLoad("/Scripts/Locale.lua") |
22 HedgewarsScriptLoad("/Scripts/Locale.lua") |
10 HedgewarsScriptLoad("/Scripts/Animate.lua") |
23 HedgewarsScriptLoad("/Scripts/Animate.lua") |
11 |
24 |
12 ----------------- VARIABLES -------------------- |
25 ----------------- VARIABLES -------------------- |
19 local dialog01 = {} |
32 local dialog01 = {} |
20 local dialog02 = {} |
33 local dialog02 = {} |
21 local dialog03 = {} |
34 local dialog03 = {} |
22 -- mission objectives |
35 -- mission objectives |
23 local goals = { |
36 local goals = { |
24 [dialog01] = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 7000}, |
37 [dialog01] = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 4000}, |
25 [dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 7000}, |
38 [dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 4000}, |
26 [dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 7000}, |
39 [dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 4000}, |
27 } |
40 } |
28 -- crates |
41 -- crates |
29 local crateWMX = 2170 |
42 local crateWMX = 2170 |
30 local crateWMY = 1950 |
43 local crateWMY = 1950 |
31 local health1X = 2680 |
44 local health1X = 2680 |
35 local yellow1 = {} |
48 local yellow1 = {} |
36 local green1 = {} |
49 local green1 = {} |
37 local green2 = {} |
50 local green2 = {} |
38 local green3 = {} |
51 local green3 = {} |
39 local green4 = {} |
52 local green4 = {} |
|
53 local green5 = {} |
40 -- teams |
54 -- teams |
41 local teamA = {} |
55 local teamA = {} |
42 local teamB = {} |
56 local teamB = {} |
43 local teamC = {} |
57 local teamC = {} |
|
58 local teamD = {} |
44 -- hedgehogs values |
59 -- hedgehogs values |
45 hero.name = "Hog Solo" |
60 hero.name = "Hog Solo" |
46 hero.x = 3650 |
61 hero.x = 3350 |
47 hero.y = 295 |
62 hero.y = 365 |
48 hero.dead = false |
63 hero.dead = false |
49 green1.name = "Captain Lime" |
64 green1.name = "Captain Lime" |
50 green1.x = 3600 |
65 green1.x = 3300 |
51 green1.y = 295 |
66 green1.y = 395 |
52 green1.dead = false |
67 green1.dead = false |
53 green2.name = "Mister Pear" |
68 green2.name = "Mister Pear" |
54 green2.x = 3600 |
69 green2.x = 3600 |
55 green2.y = 1570 |
70 green2.y = 1570 |
56 green3.name = "Lady Mango" |
71 green3.name = "Lady Mango" |
57 green3.x = 2170 |
72 green3.x = 2170 |
58 green3.y = 980 |
73 green3.y = 980 |
59 green4.name = "Green Hog Grape" |
74 green4.name = "Green Hog Grape" |
60 green4.x = 2900 |
75 green4.x = 2900 |
61 green4.y = 1650 |
76 green4.y = 1650 |
|
77 green5.name = "Mr Mango" |
|
78 green5.x = 1350 |
|
79 green5.y = 850 |
62 yellow1.name = "General Lemon" |
80 yellow1.name = "General Lemon" |
63 yellow1.x = 140 |
81 yellow1.x = 140 |
64 yellow1.y = 1980 |
82 yellow1.y = 1980 |
65 local yellowArmy = { |
83 local yellowArmy = { |
66 {name = "Robert Yellow Apple", x = 710, y = 1780}, |
84 {name = "Robert Yellow Apple", x = 710, y = 1780, health = 100}, |
67 {name = "Summer Squash", x = 315 , y = 1960}, |
85 {name = "Summer Squash", x = 315 , y = 1960, health = 100}, |
68 {name = "Tall Potato", x = 830 , y = 1748}, |
86 {name = "Tall Potato", x = 830 , y = 1748, health = 80}, |
69 {name = "Yellow Pepper", x = 2160 , y = 820}, |
87 {name = "Yellow Pepper", x = 2160 , y = 820, health = 60}, |
70 {name = "Corn", x = 1320 , y = 740}, |
88 {name = "Corn", x = 1320 , y = 740, health = 60}, |
71 {name = "Max Citrus", x = 1900 , y = 1700}, |
89 {name = "Max Citrus", x = 1900 , y = 1700, health = 40}, |
72 {name = "Naranja Jed", x = 960 , y = 516}, |
90 {name = "Naranja Jed", x = 960 , y = 516, health = 40}, |
73 } |
91 } |
74 teamA.name = loc("Hog Solo") |
92 teamA.name = loc("Hog Solo") |
75 teamA.color = tonumber("38D61C",16) -- green |
93 teamA.color = tonumber("38D61C",16) -- green |
76 teamB.name = loc("Green Bananas") |
94 teamB.name = loc("Green Bananas") |
77 teamB.color = tonumber("38D61C",16) -- green |
95 teamB.color = tonumber("38D61C",16) -- green |
78 teamC.name = loc("Yellow Watermelons") |
96 teamC.name = loc("Yellow Watermelons") |
79 teamC.color = tonumber("DDFF00",16) -- yellow |
97 teamC.color = tonumber("DDFF00",16) -- yellow |
|
98 teamD.name = loc("Captain Lime") |
|
99 teamD.color = tonumber("38D61C",16) -- green |
80 |
100 |
81 function onGameInit() |
101 function onGameInit() |
82 Seed = 1 |
102 Seed = 1 |
83 TurnTime = 20000 |
103 TurnTime = 20000 |
84 CaseFreq = 0 |
104 CaseFreq = 0 |
94 -- Hog Solo |
114 -- Hog Solo |
95 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
115 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
96 hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
116 hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
97 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
117 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
98 HogTurnLeft(hero.gear, true) |
118 HogTurnLeft(hero.gear, true) |
|
119 -- Captain Lime |
|
120 AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
121 green1.bot = AddHog(green1.name, 1, 200, "war_desertgrenadier1") |
|
122 AnimSetGearPosition(green1.bot, green1.x, green1.y) |
|
123 green1.human = AddHog(green1.name, 0, 200, "war_desertgrenadier1") |
|
124 AnimSetGearPosition(green1.human, green1.x, green1.y) |
|
125 green1.gear = green1.human |
99 -- Green Bananas |
126 -- Green Bananas |
100 AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy") |
127 AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy") |
101 green1.gear = AddHog(green1.name, 1, 100, "war_desertgrenadier1") |
|
102 AnimSetGearPosition(green1.gear, green1.x, green1.y) |
|
103 green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1") |
128 green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1") |
104 AnimSetGearPosition(green2.gear, green2.x, green2.y) |
129 AnimSetGearPosition(green2.gear, green2.x, green2.y) |
105 HogTurnLeft(green2.gear, true) |
130 HogTurnLeft(green2.gear, true) |
106 green3.gear = AddHog(green3.name, 0, 100, "war_desertgrenadier1") |
131 green3.gear = AddHog(green3.name, 0, 100, "war_desertgrenadier1") |
107 AnimSetGearPosition(green3.gear, green3.x, green3.y) |
132 AnimSetGearPosition(green3.gear, green3.x, green3.y) |
108 HogTurnLeft(green3.gear, true) |
133 HogTurnLeft(green3.gear, true) |
109 green4.gear = AddHog(green4.name, 0, 100, "war_desertgrenadier1") |
134 green4.gear = AddHog(green4.name, 0, 100, "war_desertgrenadier1") |
110 AnimSetGearPosition(green4.gear, green4.x, green4.y) |
135 AnimSetGearPosition(green4.gear, green4.x, green4.y) |
111 HogTurnLeft(green4.gear, true) |
136 HogTurnLeft(green4.gear, true) |
|
137 green5.gear = AddHog(green5.name, 0, 100, "war_desertgrenadier1") |
|
138 AnimSetGearPosition(green5.gear, green5.x, green5.y) |
|
139 HogTurnLeft(green5.gear, true) |
112 -- Yellow Watermelons |
140 -- Yellow Watermelons |
113 AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy") |
141 AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy") |
114 yellow1.gear = AddHog(yellow1.name, 1, 100, "war_desertgrenadier1") |
142 yellow1.gear = AddHog(yellow1.name, 1, 100, "war_desertgrenadier1") |
115 AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y) |
143 AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y) |
116 -- the rest of the Yellow Watermelons |
144 -- the rest of the Yellow Watermelons |
117 for i=1,7 do |
145 for i=1,7 do |
118 yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, 100, "war_desertgrenadier1") |
146 yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, yellowArmy[i].health, "war_desertgrenadier1") |
119 AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y) |
147 AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y) |
120 end |
148 end |
121 |
149 |
122 AnimInit() |
150 AnimInit() |
123 AnimationSetup() |
151 AnimationSetup() |
135 AddAmmo(hero.gear, amBazooka, 3) |
163 AddAmmo(hero.gear, amBazooka, 3) |
136 AddAmmo(hero.gear, amParachute, 1) |
164 AddAmmo(hero.gear, amParachute, 1) |
137 AddAmmo(hero.gear, amGrenade, 6) |
165 AddAmmo(hero.gear, amGrenade, 6) |
138 AddAmmo(hero.gear, amDEagle, 4) |
166 AddAmmo(hero.gear, amDEagle, 4) |
139 -- Green team weapons |
167 -- Green team weapons |
140 AddAmmo(green1.gear, amBlowTorch, 5) |
168 local greenArmy = { green1, green2 } |
141 AddAmmo(green1.gear, amRope, 5) |
169 for i=1,2 do |
142 AddAmmo(green1.gear, amBazooka, 10) |
170 AddAmmo(greenArmy[i].gear, amBlowTorch, 5) |
143 AddAmmo(green1.gear, amGrenade, 7) |
171 AddAmmo(greenArmy[i].gear, amRope, 5) |
144 AddAmmo(green1.gear, amFirePunch, 2) |
172 AddAmmo(greenArmy[i].gear, amBazooka, 10) |
145 AddAmmo(green1.gear, amDrill, 3) |
173 AddAmmo(greenArmy[i].gear, amGrenade, 7) |
146 AddAmmo(green1.gear, amSkip, 100) |
174 AddAmmo(greenArmy[i].gear, amFirePunch, 2) |
|
175 AddAmmo(greenArmy[i].gear, amDrill, 3) |
|
176 AddAmmo(greenArmy[i].gear, amSwitch, 2) |
|
177 AddAmmo(greenArmy[i].gear, amSkip, 100) |
|
178 end |
147 -- Yellow team weapons |
179 -- Yellow team weapons |
148 AddAmmo(yellow1.gear, amBlowTorch, 1) |
180 AddAmmo(yellow1.gear, amBlowTorch, 1) |
149 AddAmmo(yellow1.gear, amRope, 1) |
181 AddAmmo(yellow1.gear, amRope, 1) |
150 AddAmmo(yellow1.gear, amBazooka, 10) |
182 AddAmmo(yellow1.gear, amBazooka, 10) |
151 AddAmmo(yellow1.gear, amGrenade, 10) |
183 AddAmmo(yellow1.gear, amGrenade, 10) |
152 AddAmmo(yellow1.gear, amFirePunch, 5) |
184 AddAmmo(yellow1.gear, amFirePunch, 5) |
153 AddAmmo(yellow1.gear, amDrill, 3) |
185 AddAmmo(yellow1.gear, amDrill, 3) |
154 AddAmmo(yellow1.gear, amBee, 1) |
186 AddAmmo(yellow1.gear, amBee, 1) |
155 AddAmmo(yellow1.gear, amMortar, 3) |
187 AddAmmo(yellow1.gear, amMortar, 3) |
156 AddAmmo(yellow1.gear, amSniperRifle, 5) |
|
157 AddAmmo(yellow1.gear, amDEagle, 4) |
188 AddAmmo(yellow1.gear, amDEagle, 4) |
158 AddAmmo(yellow1.gear, amDynamite, 1) |
189 AddAmmo(yellow1.gear, amDynamite, 1) |
159 AddAmmo(yellow1.gear, amSwitch, 100) |
190 AddAmmo(yellow1.gear, amSwitch, 100) |
160 for i=3,7 do |
191 for i=3,7 do |
161 HideHog(yellowArmy[i].gear) |
192 HideHog(yellowArmy[i].gear) |
162 end |
193 end |
|
194 HideHog(green1.bot) |
163 |
195 |
164 -- crates |
196 -- crates |
165 SpawnHealthCrate(health1X, health1Y) |
197 SpawnHealthCrate(health1X, health1Y) |
166 SpawnAmmoCrate(crateWMX, crateWMY, amWatermelon) |
198 SpawnAmmoCrate(crateWMX, crateWMY, amWatermelon) |
167 |
199 |
168 SetHogLevel(green1.gear,0) |
|
169 AddAnim(dialog01) |
200 AddAnim(dialog01) |
170 SendHealthStatsOff() |
201 SendHealthStatsOff() |
171 end |
202 end |
172 |
203 |
173 function onNewTurn() |
204 function onNewTurn() |
174 WriteLnToConsole("NEW TURN "..TotalRounds.." hog "..CurrentHedgehog) |
|
175 if chooseToBattle then |
205 if chooseToBattle then |
176 if CurrentHedgehog == green1.gear then |
206 if CurrentHedgehog == green1.gear then |
177 WriteLnToConsole("IT'S GREEN HOG ") |
|
178 TotalRounds = TotalRounds - 2 |
207 TotalRounds = TotalRounds - 2 |
179 SwitchHog(previousHog) |
208 AnimSwitchHog(previousHog) |
180 TurnTimeLeft = 0 |
209 TurnTimeLeft = 0 |
181 end |
210 end |
182 previousHog = CurrentHedghog |
211 previousHog = CurrentHedgehog |
183 end |
212 end |
184 getNextWave() |
213 getNextWave() |
185 end |
214 end |
186 |
215 |
187 function onGameTick() |
216 function onGameTick() |