Merge lp:~widelands-dev/widelands/bug-1426465-scenario-timings into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8213
Proposed branch: lp:~widelands-dev/widelands/bug-1426465-scenario-timings
Merge into: lp:widelands
Diff against target: 1086 lines (+193/-170)
13 files modified
data/campaigns/atl01.wmf/scripting/mission_thread.lua (+43/-30)
data/campaigns/bar01.wmf/scripting/mission_thread.lua (+30/-34)
data/campaigns/bar01.wmf/scripting/starting_conditions.lua (+1/-1)
data/campaigns/bar01.wmf/scripting/texts.lua (+12/-8)
data/campaigns/bar02.wmf/scripting/mission_thread.lua (+13/-13)
data/campaigns/emp01.wmf/scripting/mission_thread.lua (+5/-5)
data/campaigns/emp02.wmf/scripting/mission_thread.lua (+8/-8)
data/campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua (+14/-26)
data/campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua (+22/-16)
data/campaigns/tutorial02_warfare.wmf/scripting/texts.lua (+4/-1)
data/campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua (+5/-5)
data/campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua (+17/-23)
data/scripting/messages.lua (+19/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1426465-scenario-timings
Reviewer Review Type Date Requested Status
TiborB Approve
Review via email: mp+311119@code.launchpad.net

Commit message

Tweaked timings in tutorials and scenarios:

- New function set_objective_done that adds a configurable sleep time
  when marking an objective as done
- Barbarian scenario 1: Shifted story messages back to reduce the barrage
  at the start of the scenario.
  Also, more felling axes to make clearing the trees easier.
- Atlantean scenario : Trigger warehouse objective earlier, so we can
  expand faster and have some horses ready when racing for the lake.
- Warfare Tutorial: Build trainingsites concurrently in order to save time.
- Economy tutorial: Sleep longer for the stock window.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1621. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/176654850.
Appveyor build 1459. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1426465_scenario_timings-1459.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Bunnybot encountered an error while working on this merge proposal:

('The read operation timed out',)

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1621. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/176654850.
Appveyor build 1459. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1426465_scenario_timings-1459.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1672. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/180199443.
Appveyor build 1512. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1426465_scenario_timings-1512.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Bunnybot encountered an error while working on this merge proposal:

('The read operation timed out',)

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1672. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/180199443.
Appveyor build 1512. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1426465_scenario_timings-1512.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Bunnybot encountered an error while working on this merge proposal:

('The read operation timed out',)

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1672. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/180199443.
Appveyor build 1512. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1426465_scenario_timings-1512.

Revision history for this message
TiborB (tiborb95) wrote :

Code looks good to me. Of course the NOCOM should be removed, it even does not relate to the changes in the branch.
Not tested.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks!

This was tested on the forum before I added the last tweaks, so since the crash is not caused by this branch, let's get this in.

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/campaigns/atl01.wmf/scripting/mission_thread.lua'
--- data/campaigns/atl01.wmf/scripting/mission_thread.lua 2015-11-03 18:52:00 +0000
+++ data/campaigns/atl01.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -18,38 +18,51 @@
18end18end
1919
20function build_warehouse_and_horsefarm()20function build_warehouse_and_horsefarm()
21 local fields = {21 -- Make sure that we can feed the horses at all.
22 while not check_for_buildings(p1, {
23 atlanteans_farm = 1,
24 atlanteans_well = 1,
25 }) do sleep(2500) end
26
27 -- Sleeps until one of the given fields is owned by p1.
28 local function wait_for_owns_a_field(fields)
29 local fowned = nil
30 while not fowned do
31 for idx, f in ipairs(fields) do
32 if f.owner == p1 then
33 fowned = f
34 break
35 end
36 end
37 sleep(5000)
38 end
39 end
40
41 wait_for_owns_a_field({
42 map:get_field(60, 139),
43 map:get_field(98, 128),
44 map:get_field(120, 126)
45 })
46
47 msg_boxes(horsefarm_and_warehouse_story)
48 local o = add_campaign_objective(obj_horsefarm_and_warehouse)
49 while not check_for_buildings(p1, {
50 atlanteans_horsefarm = 1,
51 atlanteans_warehouse = 1,
52 }) do sleep(2384) end
53 set_objective_done(o)
54
55 -- Now check if the water should rise
56 wait_for_owns_a_field({
22 map:get_field(42, 88),57 map:get_field(42, 88),
23 map:get_field(64, 105),58 map:get_field(64, 105),
24 map:get_field(93, 89),59 map:get_field(93, 89),
25 map:get_field(90, 66),60 map:get_field(90, 66),
26 }61 })
2762
28 local fowned = nil
29 while not fowned do
30 for idx, f in ipairs(fields) do
31 if f.owner == p1 then
32 fowned = f
33 break
34 end
35 end
36 sleep(3213)
37 end
38 -- Has been started from the very beginning63 -- Has been started from the very beginning
39 expand_objective.done = true64 set_objective_done(expand_objective)
40 let_the_water_rise = true65 let_the_water_rise = true
41
42 local pts = wait_for_roadbuilding_and_scroll(fowned)
43 msg_boxes(horsefarm_and_warehouse_story)
44 -- Go back to where we were
45 timed_scroll(array_reverse(pts))
46
47 local o = add_campaign_objective(obj_horsefarm_and_warehouse)
48 while not check_for_buildings(p1, {
49 atlanteans_horsefarm = 1,
50 atlanteans_warehouse = 1,
51 }) do sleep(2384) end
52 o.done = true
53end66end
5467
55function build_training()68function build_training()
@@ -60,7 +73,7 @@
60 atlanteans_dungeon = 1,73 atlanteans_dungeon = 1,
61 atlanteans_labyrinth = 174 atlanteans_labyrinth = 1
62 }) do sleep(3874) end75 }) do sleep(3874) end
63 o.done = true76 set_objective_done(o)
6477
65 msg_boxes(training_story_end)78 msg_boxes(training_story_end)
66end79end
@@ -79,7 +92,7 @@
79 atlanteans_armorsmithy = 1,92 atlanteans_armorsmithy = 1,
80 atlanteans_toolsmithy = 1,93 atlanteans_toolsmithy = 1,
81 }) do sleep(3478) end94 }) do sleep(3478) end
82 o.done = true95 set_objective_done(o)
8396
84 sleep(15 * 60 * 1000) -- sleep a while97 sleep(15 * 60 * 1000) -- sleep a while
85 run(build_training)98 run(build_training)
@@ -105,7 +118,7 @@
105 atlanteans_fishbreeders_house = 1,118 atlanteans_fishbreeders_house = 1,
106 atlanteans_smokery = 2,119 atlanteans_smokery = 2,
107 }) do sleep(2789) end120 }) do sleep(2789) end
108 o.done = true121 set_objective_done(o)
109122
110 msg_boxes(food_story_ended_messages)123 msg_boxes(food_story_ended_messages)
111end124end
@@ -122,7 +135,7 @@
122 atlanteans_gold_spinning_mill = 1,135 atlanteans_gold_spinning_mill = 1,
123 atlanteans_weaving_mill = 1136 atlanteans_weaving_mill = 1
124 }) do sleep(6273) end137 }) do sleep(6273) end
125 o.done = true138 set_objective_done(o)
126139
127 msg_boxes(spidercloth_story_ended_messages)140 msg_boxes(spidercloth_story_ended_messages)
128141
@@ -140,7 +153,7 @@
140 atlanteans_quarry = 1,153 atlanteans_quarry = 1,
141 atlanteans_sawmill = 1,154 atlanteans_sawmill = 1,
142 }) do sleep(3731) end155 }) do sleep(3731) end
143 o.done = true156 set_objective_done(o)
144157
145 run(make_spidercloth_production)158 run(make_spidercloth_production)
146159
147160
=== modified file 'data/campaigns/bar01.wmf/scripting/mission_thread.lua'
--- data/campaigns/bar01.wmf/scripting/mission_thread.lua 2016-01-28 05:24:34 +0000
+++ data/campaigns/bar01.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -24,26 +24,31 @@
24 plr:reveal_fields(al_thunran:region(8))24 plr:reveal_fields(al_thunran:region(8))
25 message_box_objective(plr, briefing_msg_02) -- Al'thunran25 message_box_objective(plr, briefing_msg_02) -- Al'thunran
26 plr:reveal_fields(grave:region(4))26 plr:reveal_fields(grave:region(4))
27 message_box_objective(plr, briefing_msg_03) -- grave27 message_box_objective(plr, briefing_msg_03) -- grave, Boldreth
28 message_box_objective(plr, briefing_msg_04)28 message_box_objective(plr, briefing_msg_04) -- wait
29
30 message_box_objective(plr, briefing_msg_05)
31 message_box_objective(plr, briefing_msg_06)
32 message_box_objective(plr, briefing_msg_07)
33
34 -- introduction of Khantrukh29 -- introduction of Khantrukh
35 message_box_objective(plr, briefing_msg_08)30 message_box_objective(plr, briefing_msg_08)
3631
37 message_box_objective(plr, order_msg_ranger)32 message_box_objective(plr, order_msg_ranger)
38 local obj = add_campaign_objective(obj_build_rangers)33 local obj = add_campaign_objective(obj_build_rangers)
3934
35 -- Try not to interrupt the player actions with a message, so we wait generously
36 sleep(50000)
37 message_box_objective(plr, briefing_msg_05) -- war goes on
38 message_box_objective(plr, briefing_msg_06) -- brothers brought men
39 sleep(50000)
40 message_box_objective(plr, briefing_msg_07) -- still living in huts and barracks
41 sleep(50000)
42 message_box_objective(plr, msg_story_2) -- winter is upon us
43 sleep(10000)
44
40 while not check_for_buildings(plr, {barbarians_rangers_hut = 2}) do sleep(500) end45 while not check_for_buildings(plr, {barbarians_rangers_hut = 2}) do sleep(500) end
41 obj.done = true46 set_objective_done(obj)
4247
43 plr:allow_buildings{"barbarians_sentry", "barbarians_barrier"}48 plr:allow_buildings{"barbarians_sentry", "barbarians_barrier"}
4449
45 message_box_objective(plr, order_msg_1)50 message_box_objective(plr, order_msg_1) -- Boldreth, swords rusty
46 message_box_objective(plr, order_msg_2)51 message_box_objective(plr, order_msg_2) -- Kantrukh, rocks
4752
48 -- Reveal the rocks53 -- Reveal the rocks
49 local rocks = wl.Game().map:get_field(27, 48)54 local rocks = wl.Game().map:get_field(27, 48)
@@ -57,12 +62,15 @@
57 -- Move back62 -- Move back
58 timed_scroll(array_reverse(way), 10)63 timed_scroll(array_reverse(way), 10)
5964
65 sleep(50000)
66 message_box_objective(plr, msg_story_1)
67
60 -- Now, wait till the quarry comes up68 -- Now, wait till the quarry comes up
61 local f = wl.Game().map:get_field(27,48):region(6)69 local f = wl.Game().map:get_field(27,48):region(6)
62 while not check_for_buildings(plr, { barbarians_quarry = 1 }, f) do70 while not check_for_buildings(plr, { barbarians_quarry = 1 }, f) do
63 sleep(5000)71 sleep(5000)
64 end72 end
65 obj.done = true73 set_objective_done(obj)
6674
67 message_box_objective(plr, order_msg_5_quarry)75 message_box_objective(plr, order_msg_5_quarry)
6876
@@ -98,7 +106,7 @@
98 while not check_for_buildings(plr, {barbarians_coalmine = 1, barbarians_ironmine = 1}) do106 while not check_for_buildings(plr, {barbarians_coalmine = 1, barbarians_ironmine = 1}) do
99 sleep(5000)107 sleep(5000)
100 end108 end
101 o.done = true109 set_objective_done(o)
102 message_box_objective(plr, order_msg_7_mines_up)110 message_box_objective(plr, order_msg_7_mines_up)
103 message_box_objective(plr, order_msg_8_mines_up)111 message_box_objective(plr, order_msg_8_mines_up)
104 message_box_objective(plr, order_msg_9_hunter)112 message_box_objective(plr, order_msg_9_hunter)
@@ -127,8 +135,7 @@
127 and #rv.barbarians_tavern >= 1 then break end135 and #rv.barbarians_tavern >= 1 then break end
128 sleep(5331)136 sleep(5331)
129 end137 end
130 obj_bf.done = true138 set_objective_done(obj_bf)
131 sleep(5000)
132 message_box_objective(plr, story_msg4)139 message_box_objective(plr, story_msg4)
133 end)140 end)
134141
@@ -146,7 +153,7 @@
146 sleep(4234)153 sleep(4234)
147 end154 end
148 message_box_objective(plr, order_msg_12_farming_began)155 message_box_objective(plr, order_msg_12_farming_began)
149 obj_farming.done = true156 set_objective_done(obj_farming)
150 end)157 end)
151158
152 -- Enable food production159 -- Enable food production
@@ -171,7 +178,7 @@
171 while #plr:get_buildings("barbarians_smelting_works") < 1 do178 while #plr:get_buildings("barbarians_smelting_works") < 1 do
172 sleep(6223)179 sleep(6223)
173 end180 end
174 o.done = true181 set_objective_done(o)
175182
176 -- Information about making mines deeper183 -- Information about making mines deeper
177 -- Wait until the player has an experienced worker.184 -- Wait until the player has an experienced worker.
@@ -218,7 +225,7 @@
218 end225 end
219 sleep(5421)226 sleep(5421)
220 end227 end
221 obj.done = true228 set_objective_done(obj)
222 enhance_buildings_done = true229 enhance_buildings_done = true
223 end)230 end)
224231
@@ -238,6 +245,7 @@
238 end245 end
239 sleep(5421)246 sleep(5421)
240 end247 end
248 sleep(5000)
241249
242 message_box_objective(plr, order_msg_16_blackwood)250 message_box_objective(plr, order_msg_16_blackwood)
243 plr:allow_buildings{"barbarians_wood_hardener"}251 plr:allow_buildings{"barbarians_wood_hardener"}
@@ -245,10 +253,10 @@
245 -- So that player has really little, but still enough to expand a bit253 -- So that player has really little, but still enough to expand a bit
246 local o = add_campaign_objective(obj_better_material_1)254 local o = add_campaign_objective(obj_better_material_1)
247255
248 sleep(30*1000)256 sleep(50000)
249 message_box_objective(plr, story_msg1)257 message_box_objective(plr, story_msg1)
250 while #plr:get_buildings("barbarians_wood_hardener") < 1 do sleep(5421) end258 while #plr:get_buildings("barbarians_wood_hardener") < 1 do sleep(5421) end
251 o.done = true259 set_objective_done(o)
252260
253 message_box_objective(plr, order_msg_17_grout)261 message_box_objective(plr, order_msg_17_grout)
254 plr:allow_buildings{"barbarians_lime_kiln", "barbarians_well", "barbarians_charcoal_kiln"}262 plr:allow_buildings{"barbarians_lime_kiln", "barbarians_well", "barbarians_charcoal_kiln"}
@@ -267,7 +275,7 @@
267 end275 end
268 sleep(5421)276 sleep(5421)
269 end277 end
270 o.done = true278 set_objective_done(o)
271279
272 message_box_objective(plr, order_msg_18_reed)280 message_box_objective(plr, order_msg_18_reed)
273 plr:allow_buildings{"barbarians_reed_yard"}281 plr:allow_buildings{"barbarians_reed_yard"}
@@ -275,7 +283,7 @@
275 while #plr:get_buildings("barbarians_reed_yard") < 1 do sleep(5421) end283 while #plr:get_buildings("barbarians_reed_yard") < 1 do sleep(5421) end
276284
277 message_box_objective(plr, order_msg_19_all_material)285 message_box_objective(plr, order_msg_19_all_material)
278 o.done = true286 set_objective_done(o)
279287
280 build_materials_done = true288 build_materials_done = true
281end289end
@@ -299,23 +307,12 @@
299 while not check_for_buildings(plr, { barbarians_cattlefarm = 1 }) do307 while not check_for_buildings(plr, { barbarians_cattlefarm = 1 }) do
300 sleep(2323)308 sleep(2323)
301 end309 end
302 o.done = true310 set_objective_done(o)
303311
304 cattle_farm_done = true312 cattle_farm_done = true
305end313end
306314
307315
308-- ======================
309-- Throns story messages
310-- ======================
311function story_messages_thread()
312 wake_me(180 * 1000)
313 message_box_objective(plr, msg_story_2)
314
315 wake_me(600 * 1000)
316 message_box_objective(plr, msg_story_1)
317end
318
319-- =================316-- =================
320-- Mission complete317-- Mission complete
321-- =================318-- =================
@@ -333,7 +330,6 @@
333run(introduction_thread)330run(introduction_thread)
334run(mines_and_food_thread)331run(mines_and_food_thread)
335run(build_materials_thread)332run(build_materials_thread)
336run(story_messages_thread)
337333
338include "map:scripting/secret_village.lua" -- starts the thread334include "map:scripting/secret_village.lua" -- starts the thread
339335
340336
=== modified file 'data/campaigns/bar01.wmf/scripting/starting_conditions.lua'
--- data/campaigns/bar01.wmf/scripting/starting_conditions.lua 2015-10-31 12:11:44 +0000
+++ data/campaigns/bar01.wmf/scripting/starting_conditions.lua 2016-12-10 09:41:21 +0000
@@ -46,7 +46,7 @@
46 barbarians_gardener = 1,46 barbarians_gardener = 1,
47 barbarians_geologist = 4,47 barbarians_geologist = 4,
48 barbarians_lime_burner = 1,48 barbarians_lime_burner = 1,
49 barbarians_lumberjack = 3,49 barbarians_lumberjack = 6,
50 barbarians_miner = 4,50 barbarians_miner = 4,
51 barbarians_ranger = 2,51 barbarians_ranger = 2,
52 barbarians_stonemason = 252 barbarians_stonemason = 2
5353
=== modified file 'data/campaigns/bar01.wmf/scripting/texts.lua'
--- data/campaigns/bar01.wmf/scripting/texts.lua 2016-10-05 05:26:40 +0000
+++ data/campaigns/bar01.wmf/scripting/texts.lua 2016-12-10 09:41:21 +0000
@@ -187,7 +187,7 @@
187 -- TRANSLATORS: Thron187 -- TRANSLATORS: Thron
188 _[[Boldreth, my loyal companion and friend is a source of peace and comfort to me in these dark times. He keeps my spirits high and those of my warriors awake, preventing greed or despair from destroying the bonds between us as well.]]),188 _[[Boldreth, my loyal companion and friend is a source of peace and comfort to me in these dark times. He keeps my spirits high and those of my warriors awake, preventing greed or despair from destroying the bonds between us as well.]]),
189 field = grave,189 field = grave,
190 position = "topleft"190 position = "topleft",
191}191}
192192
193193
@@ -195,35 +195,38 @@
195 title = _"The Story Begins",195 title = _"The Story Begins",
196 body = thron(196 body = thron(
197 -- TRANSLATORS: Thron197 -- TRANSLATORS: Thron
198 _[[As father told me, there are times to fight and times to lie and wait, trying not to fall asleep or die before the right time comes. And so I do wait.]])198 _[[As father told me, there are times to fight and times to lie and wait, trying not to fall asleep or die before the right time comes. And so I do wait.]]),
199 position = "topleft",
199}200}
200201
201202
202briefing_msg_05 = {203briefing_msg_05 = {
203 title = _"The Story Begins",204 title = _"Thron is Contemplating the War",
204 body = thron(_"Thron is shaking his head…",205 body = thron(_"Thron is shaking his head…",
205 -- TRANSLATORS: Thron206 -- TRANSLATORS: Thron
206 _([[Yet the war goes on. More and more of our brothers and sisters flee the brutal war raging in the capital beneath the trees.]])207 _([[Yet the war goes on. More and more of our brothers and sisters flee the brutal war raging in the capital beneath the trees.]])
207 .. paragraphdivider() ..208 .. paragraphdivider() ..
208 -- TRANSLATORS: Thron209 -- TRANSLATORS: Thron
209 _([[The stories they tell about the deeds of our kin are sad to hear. I’ve spent nights lying awake, restless, more tired than I ever believed one could be. Yet whenever I close my eyes, I see the fortress my father built consumed by flames. The Throne Among the Trees, the symbol of unity and peace among our kin, became the wedge that drives us apart.]])),210 _([[The stories they tell about the deeds of our kin are sad to hear. I’ve spent nights lying awake, restless, more tired than I ever believed one could be. Yet whenever I close my eyes, I see the fortress my father built consumed by flames. The Throne Among the Trees, the symbol of unity and peace among our kin, became the wedge that drives us apart.]])),
210 field = sf -- scroll back when showing this and the next few message boxes211 field = al_thunran,
212 position = "topleft",
211}213}
212214
213215
214briefing_msg_06 = {216briefing_msg_06 = {
215 title = _"The Story Begins",217 title = _"Thron is Contemplating the War",
216 body = thron(218 body = thron(
217 -- TRANSLATORS: Thron219 -- TRANSLATORS: Thron
218 _([[Today my hunters brought men, women and little children before me who had hidden out in the forests, trying to escape the war, hate and revenge that rage among the tribes fighting each other like in olden times, when we were no more but wild beasts driven and controlled by instincts. None of my brothers will ever gain and hold control over the wooden throne, none of the tribes will be strong enough to subdue the other. There will be no end to this slaughter, unless… is this it? As father told me?]])220 _([[Today my hunters brought men, women and little children before me who had hidden out in the forests, trying to escape the war, hate and revenge that rage among the tribes fighting each other like in olden times, when we were no more but wild beasts driven and controlled by instincts. None of my brothers will ever gain and hold control over the wooden throne, none of the tribes will be strong enough to subdue the other. There will be no end to this slaughter, unless… is this it? As father told me?]])
219 .. paragraphdivider() ..221 .. paragraphdivider() ..
220 -- TRANSLATORS: Thron222 -- TRANSLATORS: Thron
221 _([[To rise against whoever threatens our very existence, even though it may be one of your own blood or mind?]]))223 _([[To rise against whoever threatens our very existence, even though it may be one of your own blood or mind?]])),
224 field = sf,
222}225}
223226
224227
225briefing_msg_07 = {228briefing_msg_07 = {
226 title = _"The Story Begins",229 title = _"Thron is Considering the Future",
227 body = thron(230 body = thron(
228 -- TRANSLATORS: Thron231 -- TRANSLATORS: Thron
229 _([[Boldreth seems more and more torn as the days go by. The spirits of my fellows sink as the cold season approaches, and we are still living in no more than huts and barracks. I never intended to stay out here in the wilderness for so long – but I never thought my brothers would engage in this senseless battle for so long either.]])232 _([[Boldreth seems more and more torn as the days go by. The spirits of my fellows sink as the cold season approaches, and we are still living in no more than huts and barracks. I never intended to stay out here in the wilderness for so long – but I never thought my brothers would engage in this senseless battle for so long either.]])
@@ -240,7 +243,8 @@
240 _[[Hail, chieftain. I am Khantrukh and have seen many winters pass. Please allow me to aid you with my counsel through these darkened days.]]243 _[[Hail, chieftain. I am Khantrukh and have seen many winters pass. Please allow me to aid you with my counsel through these darkened days.]]
241 .. paragraphdivider() ..244 .. paragraphdivider() ..
242 -- TRANSLATORS: Khantrukh245 -- TRANSLATORS: Khantrukh
243 _[[Only the gods know for how long we have to remain hidden here. The warriors hope we may march back gloriously any day now, but I strongly doubt that will happen soon. And the days are short and cold…]])246 _[[Only the gods know for how long we have to remain hidden here. The warriors hope we may march back gloriously any day now, but I strongly doubt that will happen soon. And the days are short and cold…]]),
247 field = sf -- scroll back when showing this and the next few message boxes
244}248}
245249
246250
247251
=== modified file 'data/campaigns/bar02.wmf/scripting/mission_thread.lua'
--- data/campaigns/bar02.wmf/scripting/mission_thread.lua 2016-05-06 09:44:37 +0000
+++ data/campaigns/bar02.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -30,7 +30,7 @@
30 local o = add_campaign_objective(obj_build_cattlefarm)30 local o = add_campaign_objective(obj_build_cattlefarm)
31 while not check_for_buildings(p1, {barbarians_cattlefarm = 1}) do31 while not check_for_buildings(p1, {barbarians_cattlefarm = 1}) do
32 sleep(1223) end32 sleep(1223) end
33 o.done = true33 set_objective_done(o)
3434
35end35end
3636
@@ -48,7 +48,7 @@
48 while not check_for_buildings(p1, {barbarians_sentry=1}, game.map:get_field(57,36):region(6)) do48 while not check_for_buildings(p1, {barbarians_sentry=1}, game.map:get_field(57,36):region(6)) do
49 sleep(1500)49 sleep(1500)
50 end50 end
51 o.done = true51 set_objective_done(o)
52 sleep(3000)52 sleep(3000)
5353
54 campaign_message_box(briefing_msg_1)54 campaign_message_box(briefing_msg_1)
@@ -73,7 +73,7 @@
73 barbarians_farm = 1,73 barbarians_farm = 1,
74 barbarians_bakery = 1,74 barbarians_bakery = 1,
75 }) do sleep(3413) end75 }) do sleep(3413) end
76 o.done = true76 set_objective_done(o)
77 campaign_message_box(story_note_1)77 campaign_message_box(story_note_1)
7878
79 sleep(600000) -- 10 minutes79 sleep(600000) -- 10 minutes
@@ -111,7 +111,7 @@
111 p1:hide_fields(fields)111 p1:hide_fields(fields)
112112
113 while not check_for_buildings(p1, {barbarians_tower=1}) do sleep(2341) end113 while not check_for_buildings(p1, {barbarians_tower=1}) do sleep(2341) end
114 o.done = true114 set_objective_done(o)
115 campaign_message_box(order_msg_3_explore_further)115 campaign_message_box(order_msg_3_explore_further)
116 -- "explore further" is active untill "Boldreth shout out", so the player always has one open objectve.116 -- "explore further" is active untill "Boldreth shout out", so the player always has one open objectve.
117 exploration_objective = add_campaign_objective(obj_explore_further)117 exploration_objective = add_campaign_objective(obj_explore_further)
@@ -178,7 +178,7 @@
178 end178 end
179 sleep(4139)179 sleep(4139)
180 end180 end
181 o.done = true181 set_objective_done(o)
182 campaign_message_box(story_note_2)182 campaign_message_box(story_note_2)
183183
184 sleep(100000)184 sleep(100000)
@@ -211,7 +211,7 @@
211 while not check_for_buildings(p1, {barbarians_trainingcamp = 1, barbarians_battlearena = 1}) do211 while not check_for_buildings(p1, {barbarians_trainingcamp = 1, barbarians_battlearena = 1}) do
212 sleep(6523)212 sleep(6523)
213 end213 end
214 o.done = true214 set_objective_done(o)
215end215end
216function check_weapon_productions_obj(o)216function check_weapon_productions_obj(o)
217 while true do217 while true do
@@ -225,15 +225,15 @@
225 end225 end
226 sleep(6523)226 sleep(6523)
227 end227 end
228 o.done = true228 set_objective_done(o)
229end229end
230function check_warehouse_obj(o)230function check_warehouse_obj(o)
231 while not check_for_buildings(p1, {barbarians_warehouse = 1}) do sleep(3827) end231 while not check_for_buildings(p1, {barbarians_warehouse = 1}) do sleep(3827) end
232 o.done = true232 set_objective_done(o)
233end233end
234function check_helmsmithy_obj(o)234function check_helmsmithy_obj(o)
235 while not check_for_buildings(p1, {barbarians_helmsmithy = 1}) do sleep(3827) end235 while not check_for_buildings(p1, {barbarians_helmsmithy = 1}) do sleep(3827) end
236 o.done = true236 set_objective_done(o)
237end237end
238238
239function fortress()239function fortress()
@@ -247,7 +247,7 @@
247247
248 while #p1:get_buildings("barbarians_fortress") == 0 do sleep(6523) end248 while #p1:get_buildings("barbarians_fortress") == 0 do sleep(6523) end
249249
250 o.done = true250 set_objective_done(o)
251 campaign_message_box(story_note_3)251 campaign_message_box(story_note_3)
252end252end
253253
@@ -294,7 +294,7 @@
294 )294 )
295 do sleep(7829) end295 do sleep(7829) end
296 -- "explore further" is done296 -- "explore further" is done
297 exploration_objective.done = true297 set_objective_done(exploration_objective)
298298
299 campaign_message_box(order_msg_7_destroy_kalitaths_army)299 campaign_message_box(order_msg_7_destroy_kalitaths_army)
300 local o = add_campaign_objective(obj_destroy_kalitaths_army)300 local o = add_campaign_objective(obj_destroy_kalitaths_army)
@@ -302,7 +302,7 @@
302 while not check_player_completely_defeated(p2) do302 while not check_player_completely_defeated(p2) do
303 sleep(7837)303 sleep(7837)
304 end304 end
305 o.done = true305 set_objective_done(o)
306end306end
307307
308function renegade_fortresses()308function renegade_fortresses()
@@ -345,7 +345,7 @@
345 sleep(6733)345 sleep(6733)
346 end346 end
347347
348 o.done = true348 set_objective_done(o)
349end349end
350350
351function mission_complete()351function mission_complete()
352352
=== modified file 'data/campaigns/emp01.wmf/scripting/mission_thread.lua'
--- data/campaigns/emp01.wmf/scripting/mission_thread.lua 2016-01-28 05:24:34 +0000
+++ data/campaigns/emp01.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -30,7 +30,7 @@
30 p1:allow_buildings{"empire_blockhouse"}30 p1:allow_buildings{"empire_blockhouse"}
31 local o = add_campaign_objective(obj_build_blockhouse)31 local o = add_campaign_objective(obj_build_blockhouse)
32 while #p1:get_buildings("empire_blockhouse") < 1 do sleep(3249) end32 while #p1:get_buildings("empire_blockhouse") < 1 do sleep(3249) end
33 o.done = true33 set_objective_done(o)
3434
35 -- Blockhouse is completed now35 -- Blockhouse is completed now
36 campaign_message_box(saledus_2)36 campaign_message_box(saledus_2)
@@ -38,7 +38,7 @@
38 o = add_campaign_objective(obj_build_lumberjack)38 o = add_campaign_objective(obj_build_lumberjack)
39 campaign_message_box(amalea_1)39 campaign_message_box(amalea_1)
40 while #p1:get_buildings("empire_lumberjacks_house") < 1 do sleep(3249) end40 while #p1:get_buildings("empire_lumberjacks_house") < 1 do sleep(3249) end
41 o.done = true41 set_objective_done(o)
4242
43 -- Lumberjack is now build43 -- Lumberjack is now build
44 campaign_message_box(amalea_2)44 campaign_message_box(amalea_2)
@@ -46,14 +46,14 @@
46 o = add_campaign_objective(obj_build_sawmill_and_lumberjacks)46 o = add_campaign_objective(obj_build_sawmill_and_lumberjacks)
47 while not check_for_buildings(p1, { empire_lumberjacks_house = 3, empire_sawmill = 1})47 while not check_for_buildings(p1, { empire_lumberjacks_house = 3, empire_sawmill = 1})
48 do sleep(2343) end48 do sleep(2343) end
49 o.done = true49 set_objective_done(o)
5050
51 -- Now the lady demands a forester after having us cut down the whole forest.51 -- Now the lady demands a forester after having us cut down the whole forest.
52 campaign_message_box(amalea_3)52 campaign_message_box(amalea_3)
53 o = add_campaign_objective(obj_build_forester)53 o = add_campaign_objective(obj_build_forester)
54 p1:allow_buildings{"empire_foresters_house"}54 p1:allow_buildings{"empire_foresters_house"}
55 while not check_for_buildings(p1, { empire_foresters_house = 1 }) do sleep(2434) end55 while not check_for_buildings(p1, { empire_foresters_house = 1 }) do sleep(2434) end
56 o.done = true56 set_objective_done(o)
5757
5858
59 -- Now a quarry59 -- Now a quarry
@@ -61,7 +61,7 @@
61 o = add_campaign_objective(obj_build_quarry)61 o = add_campaign_objective(obj_build_quarry)
62 p1:allow_buildings{"empire_quarry"}62 p1:allow_buildings{"empire_quarry"}
63 while not check_for_buildings(p1, { empire_quarry = 1 }) do sleep(2434) end63 while not check_for_buildings(p1, { empire_quarry = 1 }) do sleep(2434) end
64 o.done = true64 set_objective_done(o)
6565
66 -- All buildings done. Got home66 -- All buildings done. Got home
67 campaign_message_box(saledus_4)67 campaign_message_box(saledus_4)
6868
=== modified file 'data/campaigns/emp02.wmf/scripting/mission_thread.lua'
--- data/campaigns/emp02.wmf/scripting/mission_thread.lua 2016-01-28 05:24:34 +0000
+++ data/campaigns/emp02.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -28,7 +28,7 @@
28 }) do sleep(2342) end28 }) do sleep(2342) end
2929
30 campaign_message_box(diary_page_6)30 campaign_message_box(diary_page_6)
31 o_woodeconomy.done = true31 set_objective_done(o_woodeconomy)
32 end)32 end)
3333
3434
@@ -39,7 +39,7 @@
39 -- Check for completeness of the quarry39 -- Check for completeness of the quarry
40 run(function()40 run(function()
41 while not check_for_buildings(p1, {empire_quarry=1}) do sleep(3423) end41 while not check_for_buildings(p1, {empire_quarry=1}) do sleep(3423) end
42 o_quarry.done = true42 set_objective_done(o_quarry)
4343
44 campaign_message_box(diary_page_7)44 campaign_message_box(diary_page_7)
45 end)45 end)
@@ -100,7 +100,7 @@
100 #rv.empire_piggery + #rv.empire_bakery) > 0 then break end100 #rv.empire_piggery + #rv.empire_bakery) > 0 then break end
101 sleep(4857)101 sleep(4857)
102 end102 end
103 o.done = true103 set_objective_done(o)
104end104end
105105
106function mining_infrastructure()106function mining_infrastructure()
@@ -159,7 +159,7 @@
159 #rv.empire_weaponsmithy > 0 then break end159 #rv.empire_weaponsmithy > 0 then break end
160 sleep(4948)160 sleep(4948)
161 end161 end
162 o.done = true162 set_objective_done(o)
163 mining_infrastructure_done = true163 mining_infrastructure_done = true
164end164end
165165
@@ -182,7 +182,7 @@
182182
183 -- sleep while not owning 26, 21183 -- sleep while not owning 26, 21
184 while wl.Game().map:get_field(26,21).owner ~= p1 do sleep(3243) end184 while wl.Game().map:get_field(26,21).owner ~= p1 do sleep(3243) end
185 o.done = true185 set_objective_done(o)
186186
187 -- Marble Mountains187 -- Marble Mountains
188 local marblemountains = wl.Game().map:get_field(35,19)188 local marblemountains = wl.Game().map:get_field(35,19)
@@ -195,7 +195,7 @@
195 p1:allow_buildings{"empire_marblemine", "empire_marblemine_deep"}195 p1:allow_buildings{"empire_marblemine", "empire_marblemine_deep"}
196 o = add_campaign_objective(obj_build_marblemine)196 o = add_campaign_objective(obj_build_marblemine)
197 run(function() while not check_for_buildings(p1, {empire_marblemine = 1})197 run(function() while not check_for_buildings(p1, {empire_marblemine = 1})
198 do sleep(2133) end o.done = true end)198 do sleep(2133) end set_objective_done(o, 0) end)
199199
200 -- Go back to where we were200 -- Go back to where we were
201 timed_scroll(array_reverse(pts))201 timed_scroll(array_reverse(pts))
@@ -239,7 +239,7 @@
239 end239 end
240 sleep(2342)240 sleep(2342)
241 end241 end
242 o.done = true242 set_objective_done(o)
243243
244 -- Wait till the mining infrastructure is also up244 -- Wait till the mining infrastructure is also up
245 while not mining_infrastructure_done do245 while not mining_infrastructure_done do
@@ -254,7 +254,7 @@
254 wl.Game().map:get_field(60,65):region(6))254 wl.Game().map:get_field(60,65):region(6))
255 do sleep(2435) end255 do sleep(2435) end
256256
257 o.done = true257 set_objective_done(o)
258258
259 -- Show victory message259 -- Show victory message
260 campaign_message_box(diary_page_10)260 campaign_message_box(diary_page_10)
261261
=== modified file 'data/campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua'
--- data/campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua 2016-05-14 16:18:25 +0000
+++ data/campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -17,11 +17,9 @@
17 while not wl.ui.MapView().buildhelp do17 while not wl.ui.MapView().buildhelp do
18 sleep(200)18 sleep(200)
19 end19 end
20 o.done = true20 set_objective_done(o, 500)
21 wl.ui.MapView():abort_road_building()21 wl.ui.MapView():abort_road_building()
2222
23 sleep(500)
24
25 build_lumberjack()23 build_lumberjack()
26end24end
2725
@@ -69,7 +67,7 @@
6967
70 blocker:lift_blocks()68 blocker:lift_blocks()
7169
72 sleep(15000)70 sleep(30000)
7371
74 if not (f.immovable and f.immovable.descr.type_name == "flag") then72 if not (f.immovable and f.immovable.descr.type_name == "flag") then
75 -- only show this if the user has not already built a flag73 -- only show this if the user has not already built a flag
@@ -86,9 +84,7 @@
8684
87 -- Wait for flag85 -- Wait for flag
88 while not (f.immovable and f.immovable.descr.type_name == "flag") do sleep(300) end86 while not (f.immovable and f.immovable.descr.type_name == "flag") do sleep(300) end
89 o.done = true87 set_objective_done(o, 300)
90
91 sleep(300)
9288
93 message_box_objective(plr, lumberjack_message_06)89 message_box_objective(plr, lumberjack_message_06)
94 else90 else
@@ -120,14 +116,12 @@
120 end116 end
121117
122 _wait_for_move()118 _wait_for_move()
123 o.done = true119 set_objective_done(o)
124 sleep(3000) -- Give the player a chance to try this some more
125120
126 o = message_box_objective(plr, tell_about_right_drag_move)121 o = message_box_objective(plr, tell_about_right_drag_move)
127122
128 _wait_for_move()123 _wait_for_move()
129 o.done = true124 set_objective_done(o)
130 sleep(3000) -- Give the player a chance to try this some more
131125
132 o = message_box_objective(plr, tell_about_minimap)126 o = message_box_objective(plr, tell_about_minimap)
133127
@@ -135,8 +129,7 @@
135 while not wl.ui.MapView().windows.minimap do sleep(100) end129 while not wl.ui.MapView().windows.minimap do sleep(100) end
136 while wl.ui.MapView().windows.minimap do sleep(100) end130 while wl.ui.MapView().windows.minimap do sleep(100) end
137131
138 o.done = true132 set_objective_done(o, 500)
139 sleep(500)
140133
141 message_box_objective(plr, congratulate_and_on_to_quarry)134 message_box_objective(plr, congratulate_and_on_to_quarry)
142135
@@ -161,7 +154,7 @@
161 -- Wait for the constructionsite to be placed154 -- Wait for the constructionsite to be placed
162 while not cs do sleep(200) end155 while not cs do sleep(200) end
163156
164 o.done = true157 set_objective_done(o, 0)
165 register_immovable_as_allowed(cs)158 register_immovable_as_allowed(cs)
166159
167 local function _rip_road()160 local function _rip_road()
@@ -238,7 +231,7 @@
238 census_and_statistics()231 census_and_statistics()
239232
240 while #plr:get_buildings("barbarians_quarry") < 2 do sleep(1400) end233 while #plr:get_buildings("barbarians_quarry") < 2 do sleep(1400) end
241 o.done = true234 set_objective_done(o, 0)
242235
243 messages()236 messages()
244end237end
@@ -271,7 +264,7 @@
271 if not second_quarry_field.immovable then message_box_objective(plr,quarry_illegally_destroyed) return end264 if not second_quarry_field.immovable then message_box_objective(plr,quarry_illegally_destroyed) return end
272 end265 end
273266
274 o.done = true267 set_objective_done(o, 0)
275 register_immovable_as_allowed(cs)268 register_immovable_as_allowed(cs)
276end269end
277270
@@ -310,15 +303,13 @@
310 local o = add_campaign_objective(teaching_about_messages)303 local o = add_campaign_objective(teaching_about_messages)
311304
312 while #plr.inbox > 0 do sleep(200) end305 while #plr.inbox > 0 do sleep(200) end
313 o.done = true306 set_objective_done(o, 500)
314
315 sleep(500)
316307
317 local o = message_box_objective(plr, closing_msg_window_00)308 local o = message_box_objective(plr, closing_msg_window_00)
318309
319 -- Wait for messages window to close310 -- Wait for messages window to close
320 while wl.ui.MapView().windows.messages do sleep(300) end311 while wl.ui.MapView().windows.messages do sleep(300) end
321 o.done = true312 set_objective_done(o, 0)
322313
323 message_box_objective(plr, closing_msg_window_01)314 message_box_objective(plr, closing_msg_window_01)
324315
@@ -351,9 +342,7 @@
351 terminate_bad_boy_sentinel = true342 terminate_bad_boy_sentinel = true
352343
353 while #plr:get_buildings("barbarians_quarry") > 0 do sleep(200) end344 while #plr:get_buildings("barbarians_quarry") > 0 do sleep(200) end
354 o.done = true345 set_objective_done(o)
355
356 sleep(3000)
357346
358 expansion()347 expansion()
359end348end
@@ -382,15 +371,14 @@
382 sleep(500)371 sleep(500)
383 end372 end
384373
385 o.done = true374 set_objective_done(o)
386 sleep(4000)
387 message_box_objective(plr, military_building_finished)375 message_box_objective(plr, military_building_finished)
388376
389 conclusion()377 conclusion()
390end378end
391379
392function conclusion()380function conclusion()
393 sleep(10000) -- to give the player time to see his expanded area381 sleep(5000) -- to give the player time to see his expanded area
394382
395 -- Conclude the tutorial with final words and information383 -- Conclude the tutorial with final words and information
396 -- on how to quit384 -- on how to quit
397385
=== modified file 'data/campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua'
--- data/campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua 2015-10-31 12:11:44 +0000
+++ data/campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -9,35 +9,41 @@
9 training()9 training()
10end10end
1111
12local trainingcamp_done = false
13local battlearena_done = false
14
15function training2()
16 -- Teach about trainingsites and soldiers' abilities - concurrent part 2
17 sleep(2*60*1000)
18 o = message_box_objective(plr, trainingcamp1)
19 while #plr:get_buildings("barbarians_trainingcamp") == 0 do sleep(500) end
20 set_objective_done(o)
21 message_box_objective(plr, trainingcamp2)
22 trainingcamp_done = true
23end
24
12function training()25function training()
13 -- Teach about trainingsites and soldiers' abilities26 -- Teach about trainingsites and soldiers' abilities
14 sleep(5000) -- to let soldiers walk27 sleep(5000) -- to let soldiers walk
1528
16 message_box_objective(plr, abilities)29 message_box_objective(plr, abilities)
17 local o = message_box_objective(plr, battlearena1)30 local o = message_box_objective(plr, battlearena1)
31 run(training2)
32
18 while #plr:get_buildings("barbarians_battlearena") == 0 do sleep(500) end33 while #plr:get_buildings("barbarians_battlearena") == 0 do sleep(500) end
19 o.done = true34 set_objective_done(o, 0)
20 message_box_objective(plr, battlearena2)35 message_box_objective(plr, battlearena2)
2136 battlearena_done = true
22 o = message_box_objective(plr, trainingcamp1)
23 while #plr:get_buildings("barbarians_trainingcamp") == 0 do sleep(500) end
24 o.done = true
25 message_box_objective(plr, trainingcamp2)
26
27 sleep(300)
28
29 military_buildings()
30end37end
3138
32function military_buildings()39function military_buildings()
40 while not trainingcamp_done or not battlearena_done do sleep(3000) end
33 message_box_objective(plr, heroes_rookies)41 message_box_objective(plr, heroes_rookies)
34 message_box_objective(plr, soldier_capacity)42 message_box_objective(plr, soldier_capacity)
35 local o = message_box_objective(plr, dismantle)43 local o = message_box_objective(plr, dismantle)
3644
37 while #plr:get_buildings("barbarians_sentry") > 1 do sleep(200) end45 while #plr:get_buildings("barbarians_sentry") > 1 do sleep(200) end
38 o.done = true46 set_objective_done(o)
39
40 sleep(2000)
4147
42 enhance_fortress()48 enhance_fortress()
43end49end
@@ -49,7 +55,7 @@
49 local o = message_box_objective(plr, fortress_enhancement)55 local o = message_box_objective(plr, fortress_enhancement)
50 while not (citadel_field.immovable and56 while not (citadel_field.immovable and
51 citadel_field.immovable.descr.name == "barbarians_citadel") do sleep(800) end57 citadel_field.immovable.descr.name == "barbarians_citadel") do sleep(800) end
52 o.done = true58 set_objective_done(o, 0)
5359
54 create_enemy()60 create_enemy()
5561
@@ -91,14 +97,14 @@
91 while #plr2:get_buildings("empire_headquarters") > 0 do97 while #plr2:get_buildings("empire_headquarters") > 0 do
92 sleep(3000)98 sleep(3000)
93 end99 end
94 o.done = true100 set_objective_done(o)
95101
96 conclusion()102 conclusion()
97end103end
98104
99function conclusion()105function conclusion()
100 sleep(4000)
101 message_box_objective(plr, conclude_tutorial)106 message_box_objective(plr, conclude_tutorial)
102end107end
103108
104run(intro)109run(intro)
110run (military_buildings)
105111
=== modified file 'data/campaigns/tutorial02_warfare.wmf/scripting/texts.lua'
--- data/campaigns/tutorial02_warfare.wmf/scripting/texts.lua 2016-09-14 10:54:05 +0000
+++ data/campaigns/tutorial02_warfare.wmf/scripting/texts.lua 2016-12-10 09:41:21 +0000
@@ -13,6 +13,9 @@
13local tribe = wl.Game():get_tribe_description("barbarians")13local tribe = wl.Game():get_tribe_description("barbarians")
14local soldier = wl.Game():get_worker_description(tribe.soldier)14local soldier = wl.Game():get_worker_description(tribe.soldier)
1515
16local empire_tribe = wl.Game():get_tribe_description("empire")
17local empire_soldier = wl.Game():get_worker_description(empire_tribe.soldier)
18
16-- =============19-- =============
17-- Texts below20-- Texts below
18-- =============21-- =============
@@ -118,7 +121,7 @@
118 p(_[[Great, our training camp has now been finished, too. Now nothing will hinder us from getting the strongest warriors the world has ever seen.]]) ..121 p(_[[Great, our training camp has now been finished, too. Now nothing will hinder us from getting the strongest warriors the world has ever seen.]]) ..
119 p(_[[To train in the training camp, our soldiers need food like in the battle arena, but no strong beer. Instead, they need different axes for attack training and helmets for health training.]]) ..122 p(_[[To train in the training camp, our soldiers need food like in the battle arena, but no strong beer. Instead, they need different axes for attack training and helmets for health training.]]) ..
120 p(_[[This equipment is produced in smithies out of coal, iron, and sometimes gold. You will learn more about this in the second scenario of the Barbarian campaign.]]) ..123 p(_[[This equipment is produced in smithies out of coal, iron, and sometimes gold. You will learn more about this in the second scenario of the Barbarian campaign.]]) ..
121 p(_[[You should also keep in mind that each of the three tribes in Widelands has its own way of training, so the buildings and wares are different. Also, the ability levels cannot be compared: an Imperial soldier with evade level 0 has a 30% chance of evading, while a Barbarian soldier at the same level only has a 25% chance.]])124 p(_[[You should also keep in mind that each of the three tribes in Widelands has its own way of training, so the buildings and wares are different. Also, the ability levels cannot be compared: an Imperial soldier has a base attack of %1% at level 0, while a Barbarian soldier at the same level only has a base attack of %2%.]]:bformat(empire_soldier.base_min_attack, soldier.base_min_attack))
122 )125 )
123}126}
124127
125128
=== modified file 'data/campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua'
--- data/campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua 2016-08-03 10:20:20 +0000
+++ data/campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -21,7 +21,7 @@
21 local o = message_box_objective(plr, tell_about_port_building)21 local o = message_box_objective(plr, tell_about_port_building)
2222
23 while #plr:get_buildings("atlanteans_port") < 2 do sleep(200) end23 while #plr:get_buildings("atlanteans_port") < 2 do sleep(200) end
24 o.done = true24 set_objective_done(o)
2525
26 build_ships()26 build_ships()
27end27end
@@ -32,7 +32,7 @@
32 plr:allow_buildings{"atlanteans_shipyard"}32 plr:allow_buildings{"atlanteans_shipyard"}
3333
34 while #plr:get_buildings("atlanteans_shipyard") < 1 do sleep(200) end34 while #plr:get_buildings("atlanteans_shipyard") < 1 do sleep(200) end
35 o.done = true35 set_objective_done(o)
3636
37 local o = message_box_objective(plr, tell_about_ships)37 local o = message_box_objective(plr, tell_about_ships)
3838
@@ -40,7 +40,7 @@
40 while #plr:get_ships() < 1 do sleep(30*1000) end40 while #plr:get_ships() < 1 do sleep(30*1000) end
41 sleep(5*60*1000)41 sleep(5*60*1000)
4242
43 o.done = true43 set_objective_done(o)
4444
45 expedition()45 expedition()
46end46end
@@ -58,12 +58,12 @@
58 end58 end
5959
60 while not _ship_ready_for_expedition() do sleep(1000) end60 while not _ship_ready_for_expedition() do sleep(1000) end
61 o.done = true61 set_objective_done(o)
6262
63 o = message_box_objective(plr, expedition3)63 o = message_box_objective(plr, expedition3)
6464
65 while #plr:get_buildings("atlanteans_port") < 3 do sleep(200) end65 while #plr:get_buildings("atlanteans_port") < 3 do sleep(200) end
66 o.done = true66 set_objective_done(o)
6767
68 -- places 5 signs with iron to show the player he really found some iron ore68 -- places 5 signs with iron to show the player he really found some iron ore
69 local fields = map:get_field(97,35):region(3)69 local fields = map:get_field(97,35):region(3)
7070
=== modified file 'data/campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua'
--- data/campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua 2015-10-31 12:11:44 +0000
+++ data/campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua 2016-12-10 09:41:21 +0000
@@ -13,16 +13,15 @@
13function burn_tavern_down()13function burn_tavern_down()
14 sleep(500)14 sleep(500)
15 scroll_smoothly_to(tavern_field)15 scroll_smoothly_to(tavern_field)
16 sleep(250)16 sleep(1000)
17 tavern_field.immovable:destroy()17 tavern_field.immovable:destroy()
18 sleep(50)18 sleep(1000)
19 message_box_objective(plr, tavern_burnt_down)19 message_box_objective(plr, tavern_burnt_down)
20 sleep(2000)20 sleep(500)
21 local o = message_box_objective(plr, building_stat)21 local o = message_box_objective(plr, building_stat)
22 while not mv.windows.building_statistics do sleep(100) end22 while not mv.windows.building_statistics do sleep(100) end
23 o.done = true23 set_objective_done(o, wl.Game().real_speed)
2424
25 sleep(wl.Game().real_speed) -- The building statistics window needs some time to build up
26 o = message_box_objective(plr,explain_building_stat)25 o = message_box_objective(plr,explain_building_stat)
27 -- We cannot create several objectives with the same name. Therefore, we create o2 here once and change its visibility26 -- We cannot create several objectives with the same name. Therefore, we create o2 here once and change its visibility
28 local o2 = add_campaign_objective(reopen_building_stat_obj)27 local o2 = add_campaign_objective(reopen_building_stat_obj)
@@ -39,28 +38,26 @@
39 sleep(200)38 sleep(200)
40 end39 end
41 while mv.windows.building_statistics do sleep(100) end40 while mv.windows.building_statistics do sleep(100) end
42 o.done = true41 set_objective_done(o, 0)
4342
44 sleep(2000)
45 o = message_box_objective(plr, inventory1)43 o = message_box_objective(plr, inventory1)
46 while not mv.windows.stock_menu do sleep(200) end44 while not mv.windows.stock_menu do sleep(200) end
47 o.done = true45 set_objective_done(o, wl.Game().real_speed)
4846
49 o = message_box_objective(plr, inventory2)47 o = message_box_objective(plr, inventory2)
50 -- We cannot create several objectives with the same name. Therefore, we create o2 here once and change its visibility48 -- We cannot create several objectives with the same name. Therefore, we create o2 here once and change its visibility
51 o2 = add_campaign_objective(reopen_stock_menu_obj)49 o2 = add_campaign_objective(reopen_stock_menu_obj)
52 o2.visible = false50 o2.visible = false
53 while not o.done do51 while not mv.windows.stock_menu.tabs["wares_in_warehouses"].active do
54 if not mv.windows.stock_menu then52 if not mv.windows.stock_menu then
55 o2.visible = true53 o2.visible = true
56 message_box_objective(plr, reopen_stock_menu)54 message_box_objective(plr, reopen_stock_menu)
57 while not mv.windows.stock_menu do sleep(200) end55 while not mv.windows.stock_menu do sleep(200) end
58 o2.visible = false56 o2.visible = false
59 end57 end
60 if mv.windows.stock_menu.tabs["wares_in_warehouses"].active then o.done = true end
61 sleep(200)58 sleep(200)
62 end59 end
6360 set_objective_done(o, 0)
64 message_box_objective(plr, inventory3)61 message_box_objective(plr, inventory3)
6562
66 sleep(2000)63 sleep(2000)
@@ -70,57 +67,54 @@
70 message_box_objective(plr, ware_encyclopedia) -- a small insert67 message_box_objective(plr, ware_encyclopedia) -- a small insert
7168
72 while #plr:get_buildings("empire_tavern") < 2 do sleep(500) end69 while #plr:get_buildings("empire_tavern") < 2 do sleep(500) end
73 o.done = true70 set_objective_done(o, 0)
7471
75 plan_the_future()72 plan_the_future()
76end73end
7774
78function plan_the_future()75function plan_the_future()
79 sleep(2000)
80 message_box_objective(plr, building_priority_settings)76 message_box_objective(plr, building_priority_settings)
81 sleep(30*1000) -- give the user time to try it out77 sleep(30*1000) -- give the user time to try it out
8278
83 local o = message_box_objective(plr, ware_stats1)79 local o = message_box_objective(plr, ware_stats1)
84 while not mv.windows.ware_statistics do sleep(200) end80 while not mv.windows.ware_statistics do sleep(200) end
85 o.done = true81 set_objective_done(o, 0)
8682
87 o = message_box_objective(plr, ware_stats2)83 o = message_box_objective(plr, ware_stats2)
88 local o2 = add_campaign_objective(reopen_ware_stats1_obj)84 local o2 = add_campaign_objective(reopen_ware_stats1_obj)
89 o2.visible = false85 o2.visible = false
90 while not o.done do86 while not mv.windows.ware_statistics.tabs["economy_health"].active do
91 if not mv.windows.ware_statistics then87 if not mv.windows.ware_statistics then
92 o2.visible = true88 o2.visible = true
93 message_box_objective(plr, reopen_ware_stats1)89 message_box_objective(plr, reopen_ware_stats1)
94 while not mv.windows.ware_statistics do sleep(200) end90 while not mv.windows.ware_statistics do sleep(200) end
95 o2.visible = false91 o2.visible = false
96 end92 end
97 if mv.windows.ware_statistics.tabs["economy_health"].active then o.done = true end
98 sleep(200)93 sleep(200)
99 end94 end
95 set_objective_done(o, 0)
10096
101 o = message_box_objective(plr, ware_stats3)97 o = message_box_objective(plr, ware_stats3)
102 o2 = add_campaign_objective(reopen_ware_stats2_obj)98 o2 = add_campaign_objective(reopen_ware_stats2_obj)
103 o2.visible = false99 o2.visible = false
104 while not o.done do100 while not mv.windows.ware_statistics.tabs["stock"].active do
105 if not mv.windows.ware_statistics then101 if not mv.windows.ware_statistics then
106 o2.visible = true102 o2.visible = true
107 message_box_objective(plr, reopen_ware_stats2)103 message_box_objective(plr, reopen_ware_stats2)
108 while not mv.windows.ware_statistics do sleep(200) end104 while not mv.windows.ware_statistics do sleep(200) end
109 o2.visible = false105 o2.visible = false
110 end106 end
111 if mv.windows.ware_statistics.tabs["stock"].active then o.done = true end
112 sleep(200)107 sleep(200)
113 end108 end
109 set_objective_done(o, 0)
114110
115 o = message_box_objective(plr, ware_stats4)111 o = message_box_objective(plr, ware_stats4)
116 while mv.windows.ware_statistics do sleep(500) end112 while mv.windows.ware_statistics do sleep(500) end
117 o.done = true113 set_objective_done(o)
118
119 sleep(2000)
120114
121 o = message_box_objective(plr, economy_settings1)115 o = message_box_objective(plr, economy_settings1)
122 while not mv.windows.economy_options do sleep(200) end116 while not mv.windows.economy_options do sleep(200) end
123 o.done = true117 set_objective_done(o, 0)
124 message_box_objective(plr, economy_settings2)118 message_box_objective(plr, economy_settings2)
125 o = message_box_objective(plr, economy_settings3)119 o = message_box_objective(plr, economy_settings3)
126120
@@ -141,7 +135,7 @@
141 end135 end
142 sleep(500)136 sleep(500)
143 end137 end
144 o.done = true138 set_objective_done(o)
145139
146 -- if the minimum_storage_per_warehouse feature is introduced, use the gold mountain to the northeast for explanation140 -- if the minimum_storage_per_warehouse feature is introduced, use the gold mountain to the northeast for explanation
147 conclude()141 conclude()
148142
=== modified file 'data/scripting/messages.lua'
--- data/scripting/messages.lua 2016-01-28 05:24:34 +0000
+++ data/scripting/messages.lua 2016-12-10 09:41:21 +0000
@@ -69,6 +69,7 @@
69 message_box(wl.Game().players[1], message.title, message.body, message)69 message_box(wl.Game().players[1], message.title, message.body, message)
70end70end
7171
72
72-- RST73-- RST
73-- .. function:: add_campaign_objective(objective)74-- .. function:: add_campaign_objective(objective)
74--75--
@@ -87,6 +88,24 @@
87end88end
8889
89-- RST90-- RST
91-- .. function:: set_objective_done(objective[, sleeptime])
92--
93-- Sets an objectve as done and sleeps for a bit.
94--
95-- :arg objective: The objective to be marked as done.
96-- :arg sleeptime: The milliseconds to sleep. Defaults to 3000.
97--
98function set_objective_done(objective, sleeptime)
99 if not sleeptime then
100 sleep(3000)
101 else
102 sleep(sleeptime)
103 end
104 objective.done = true
105end
106
107
108-- RST
90-- .. function:: message_box_objective(player, message)109-- .. function:: message_box_objective(player, message)
91--110--
92-- Calls message_box(player, message.title, message.body, message). Also adds an objective defined in obj_name, obj_title and obj_body.111-- Calls message_box(player, message.title, message.body, message). Also adds an objective defined in obj_name, obj_title and obj_body.

Subscribers

People subscribed via source and target branches

to status/vote changes: