replace some victory with scenario_end events.

victory is an unsynced event to its potentially unsafe to change the
gamestate in it, this mostly effects LoW (which can be played as a mp
campaign) where i replaced most victory events.

But it also effects sp becasue it can casue bugs to create units in
unsynced events which are used later (here: in later scenarios), so i
replaced also all sp victory events that do that.

Note that the 'scenario_end event'+'proceed_to_next_scenario filter' has
a slightly different meaning than 'victory event': the second gets fired
when there is a local human side who won the scneario while the first
gets fired if there is any human side who on the scenario. In sp this
is the same since there are no remote human sides, but in mp this is the
reason why the first is synced and the second is not.

We could add a seperate event for this case ("before next scenario" or
similar) for easier use, but i didn't find a good name for
that yet.
This commit is contained in:
gfgtdf 2016-07-14 22:14:59 +02:00
parent 9648d9c989
commit ceea75cf0a
31 changed files with 143 additions and 31 deletions

View file

@ -406,7 +406,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
{MODIFY_UNIT id=Dacyn variables.casting_the_spell no}

View file

@ -329,7 +329,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[unstore_unit]
variable=stored_Dacyn

View file

@ -1273,7 +1273,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
{MODIFY_UNIT (
side=1

View file

@ -445,7 +445,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[message]
speaker=Dacyn

View file

@ -650,7 +650,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[message]
speaker=narrator

View file

@ -401,7 +401,7 @@
# end dwarven ai code
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE offended_by_elves}
[/event]
### /Olurf's Code ###
@ -577,7 +577,7 @@
[/event]
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE killed_by_elves}
[/event]

View file

@ -1049,7 +1049,11 @@
[/message]
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[fire_event]
name=kalenz_arrives
@ -1116,7 +1120,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
{CLEAR_VARIABLE orc_reserve_used}
{CLEAR_VARIABLE orc_battlefield_strategy}

View file

@ -356,7 +356,11 @@ Chapter Two"
[/event]
#undef OBJECTIVES
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[if]
[not]

View file

@ -437,7 +437,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[remove_unit_overlay]
role=gold_carrier
image=items/gold-coins-small.png

View file

@ -288,7 +288,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[message]
id=Olurf
message= _ "The orcs ha been defeated. My lord, we are in your debt."

View file

@ -512,7 +512,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
{VARIABLE olurf_entry.x 40}
{VARIABLE olurf_entry.y 5}
[fire_event]
@ -522,7 +526,11 @@
### /OLURF ###
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[message]
id=Galtrid
message= _ "At last! The orcs are defeated."

View file

@ -137,7 +137,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[persistent_carryover_store]
scenario_id = LoW_Chapter_Two

View file

@ -127,7 +127,11 @@
# wmllint: recognize Uradredia
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
{MODIFY_UNIT (side=2
[not]
id=Uradredia

View file

@ -354,7 +354,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[message]
speaker=Tallin

View file

@ -776,7 +776,11 @@
# If we won and Camerin wasn't found add him to the players army
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[if]
[variable]

View file

@ -2696,7 +2696,7 @@
[/event]
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE malifor_respawn_point,malifor_died_by}
{CLEAR_VARIABLE back_door_opened,main_door_opened,spider_door_opened,got_rod_of_justice}

View file

@ -622,7 +622,7 @@
[/event]
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE incominggold,havestone}
[/event]

View file

@ -708,7 +708,7 @@
[/event]
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE glyphs,glyph_i,locations_outside,gate_closed}
[/event]

View file

@ -761,7 +761,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[unstore_unit]
variable=alanin

View file

@ -624,7 +624,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
# This [if] is used only in the case the player happened to defeat all
# the enemy leaders and didn't move Alanin to the signpost

View file

@ -677,7 +677,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
# TODO: Make Lanbec'h appear and speak

View file

@ -360,7 +360,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[store_villages]
variable=villages

View file

@ -382,7 +382,7 @@
[/event]
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE aiglondur_passed,angarthing_passed}
[/event]

View file

@ -461,7 +461,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
[kill]
id=King Eldaric IV
[/kill]

View file

@ -606,7 +606,7 @@
[/event]
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE have_book}
{CLEAR_VARIABLE lich_free}

View file

@ -1280,7 +1280,11 @@
[/event]
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
# Elvish hunting party arrives if the necromancer died before turn 16.
[fire_event]

View file

@ -2129,7 +2129,7 @@
# victory
# clear all variables potentially not cleared
[event]
name=victory
name=scenario_end
{CLEAR_VARIABLE defiant_death}
{CLEAR_VARIABLE zur_defeated}
{CLEAR_VARIABLE grak_defeated}

View file

@ -4288,7 +4288,11 @@
#victory event
[event]
name=victory
name=scenario_end
[filter_condition]
[proceed_to_next_scenario]
[/proceed_to_next_scenario]
[/filter_condition]
# reveal map in-between starting valley and location elves move to
[remove_shroud]

View file

@ -1221,3 +1221,12 @@ function wml_actions.set_variable(cfg)
wesnoth.set_variable(name, table.concat(string_to_join, separator))
end
end
function wesnoth.wml_conditionals.proceed_to_next_scenario(cfg)
local endlevel_data = wesnoth.get_end_level_data()
if not endlevel_data then
return false
else
return endlevel_data.proceed_to_next_level
end
end

View file

@ -1803,6 +1803,15 @@ int game_lua_kernel::intf_clear_messages(lua_State*)
return 0;
}
int game_lua_kernel::intf_get_end_level_data(lua_State* L)
{
if (!play_controller_.is_regular_game_end()) {
return 0;
}
luaW_pushconfig(L, play_controller_.get_end_level_data_const().to_config());
return 1;
}
int game_lua_kernel::intf_end_level(lua_State *L)
{
vconfig cfg(luaW_checkvconfig(L, 1));
@ -4566,6 +4575,7 @@ game_lua_kernel::game_lua_kernel(CVideo * video, game_state & gs, play_controlle
{ "float_label", &dispatch<&game_lua_kernel::intf_float_label > },
{ "gamestate_inspector", &dispatch<&game_lua_kernel::intf_gamestate_inspector > },
{ "get_all_vars", &dispatch<&game_lua_kernel::intf_get_all_vars > },
{ "get_end_level_data", &dispatch<&game_lua_kernel::intf_get_end_level_data > },
{ "get_locations", &dispatch<&game_lua_kernel::intf_get_locations > },
{ "get_map_size", &dispatch<&game_lua_kernel::intf_get_map_size > },
{ "get_mouseover_tile", &dispatch<&game_lua_kernel::intf_get_mouseover_tile > },

View file

@ -107,6 +107,7 @@ class game_lua_kernel : public lua_kernel_base
int intf_check_end_level_disabled(lua_State *L);
int intf_clear_messages(lua_State*);
int intf_end_level(lua_State*);
int intf_get_end_level_data(lua_State*);
int intf_end_turn(lua_State*);
int intf_find_path(lua_State *L);
int intf_find_reach(lua_State *L);