WC2: Add possibility to allow scenario downgrading later on
In difference to other files, this one cannot be changed later on during 1.16. Because it is a Lua event, it is loaded on client side. By defining the variable wc2_highest_player_side behaviour could still be switched during 1.16. For the code to work, the scenarios must also be loaded. Currently, only one of the three is loaded, the other scenario ids won't exist. To load them, the code in WC_II_scenario.cfg would need to be changed on the hosting side to: #ifdef CAMPAIGN_WC_3P {WC2_SCENARIO_NEW scenario "WC_II_3p" {WC_II_CAMPAIGN_NAME_3P} 3} {WC2_SCENARIO_NEW scenario "WC_II_2p" {WC_II_CAMPAIGN_NAME_2P} 2} {WC2_SCENARIO_NEW scenario "WC_II_1p" {WC_II_CAMPAIGN_NAME_1P} 1} #endif
This commit is contained in:
parent
0f67ab905b
commit
429be66b2e
1 changed files with 12 additions and 2 deletions
|
@ -28,13 +28,23 @@ on_event("die", function(cx)
|
|||
elseif u.side <= (wml.variables.wc2_highest_player_side or wml.variables.wc2_player_count) then
|
||||
|
||||
-- For 4p, one player is allowed to be defeated, without all players losing the scenario.
|
||||
if wml.variables.wc2_player_count > or 3 and not wml.variables.wc2_defeated_side then
|
||||
-- By setting wc2_min_players (i.e. by a player), this behaviour could also be enabled for the other scenarios.
|
||||
-- For that to work, all scenarios need to be loaded in WC_II_scenario.cfg (only by the hosting player).
|
||||
if wml.variables.wc2_player_count > (wml.variables.wc2_min_players or 3) and not wml.variables.wc2_defeated_side then
|
||||
wml.variables.wc2_defeated_side = u.side
|
||||
-- Still need to know the original player count to detect when another player leader dies.
|
||||
wml.variables.wc2_highest_player_side = wml.variables.wc2_player_count
|
||||
-- Decrease player count for the next scenario.
|
||||
wml.variables.wc2_player_count = wml.variables.wc2_player_count - 1
|
||||
wesnoth.scenario.next = "WC_II_3p"
|
||||
|
||||
if wesnoth.scenario.id == "WC_II_4p" then
|
||||
wesnoth.scenario.next = "WC_II_3p"
|
||||
elseif wesnoth.scenario.id == "WC_II_3p" then
|
||||
wesnoth.scenario.next = "WC_II_2p"
|
||||
elseif wesnoth.scenario.id == "WC_II_2p" then
|
||||
wesnoth.scenario.next = "WC_II_1p"
|
||||
end
|
||||
|
||||
wesnoth.wml_actions.item {
|
||||
x = u.x,
|
||||
y = u.y,
|
||||
|
|
Loading…
Add table
Reference in a new issue