LoW: fix missing persistent data at the end of Chapter 3

This commit is contained in:
nemaara 2019-03-09 12:29:25 -05:00
parent 9cdb0f24e1
commit 583b351381
3 changed files with 61 additions and 0 deletions

View file

@ -8,6 +8,8 @@ local wml_actions = wesnoth.wml_actions
local T = wml.tag
local vars = wml.variables
helper = wesnoth.require "lua/helper.lua"
function wesnoth.wml_actions.shift_labels(cfg)
for k, v in ipairs(labels) do
wml_label { x = v.x, y = v.y }
@ -57,6 +59,32 @@ function wesnoth.wml_actions.replace_map(cfg)
replace_map { map = new_map, expand = true, shrink = true }
end
function wesnoth.wml_actions.unstore_left_behind_units(cfg)
if wesnoth.get_variable("l3_store_kalenz") ~= nil then
l3_store_kalenz = helper.get_variable_array("l3_store_kalenz")
for i,_ in ipairs(l3_store_kalenz) do
var_name = "l3_store_kalenz[" .. tostring(i-1) .. "]"
wml_actions.unstore_unit {
variable = var_name,
x = "recall",
y = "recall"
}
end
wesnoth.set_variable("l3_store_kalenz",nil)
end
if wesnoth.get_variable("l3_store_landar") ~= nil then
l3_store_landar = helper.get_variable_array("l3_store_landar")
for i,_ in ipairs(l3_store_landar) do
var_name = "l3_store_landar[" .. tostring(i-1) .. "]"
wml_actions.unstore_unit {
variable = var_name,
x = "recall",
y = "recall"
}
end
wesnoth.set_variable("l3_store_landar",nil)
end
end
function wesnoth.wml_actions.persistent_carryover_store(cfg)
for num, side in ipairs(wesnoth.sides) do

View file

@ -291,6 +291,7 @@
[event]
name=victory
[unstore_left_behind_units][/unstore_left_behind_units]
[persistent_carryover_store]
scenario_id = LoW_Chapter_Three
[/persistent_carryover_store]

View file

@ -102,6 +102,36 @@
[/side]
#endif
#define LEAVE_BEHIND_L3 NAME SIDE
# these have been left behind to guard the Ka'lian
[store_unit]
variable=l3_store_{NAME}
kill=yes
[filter]
side={SIDE}
type=Elvish Marshal,Elvish Champion,Elvish Avenger,Elvish Sharpshooter
[not]
id=Kalenz
[/not]
[not]
id=Anduilas
[/not]
[not]
id=Arkildur
[/not]
[not]
id=Landar
[/not]
[not]
id=Cleodil
[/not]
[not]
{FILTER_LOYALS}
[/not]
[/filter]
[/store_unit]
#enddef
[event]
name=start
@ -109,6 +139,8 @@
[persistent_carryover_unstore]
scenario_id = LoW_Chapter_Three
[/persistent_carryover_unstore]
{LEAVE_BEHIND_L3 kalenz 1}
{LEAVE_BEHIND_L3 landar 2}
#endif
#TODO recall or create if not recallable