WC2: Downgrade scenario from 4p to 3p

~ Part 2 ~

The player who lost his leader probably does not want to play anymore.
When the level is won, transition to the 3p version.
This could actually be done for all scenarios,
until reaching the 1p.
This commit is contained in:
Severin Glöckner 2021-10-23 00:48:52 +02:00
parent d15bdced41
commit ecdeb7f656
2 changed files with 10 additions and 0 deletions

View file

@ -30,6 +30,7 @@ on_event("die", function(cx)
-- For 4p, one player is allowed to be defeated, without all players losing the scenario.
wml.variables.wc2_defeated_side = u.side
wml.variables.wc2_player_count = wml.variables.wc2_player_count - 1
wesnoth.scenario.next = "WC_II_3p"
wesnoth.wml_actions.item {
x = u.x,
y = u.y,
@ -47,3 +48,8 @@ on_event("die", function(cx)
end
end
end)
-- clear variable from previous scenario
on_event("start", function()
wml.variables.wc2_defeated_side = nil
end

View file

@ -69,6 +69,10 @@ local function add_player_side(scenario, scenario_num, gold)
side.faction_lock = false
side.leader_lock = false
end
if side_num == wml.variables.wc2_defeated_side then
side.save_id = "wc2_leader4"
side.id = "wc2_leader4"
end
table.insert(scenario.side, side)
end