From d37c6d693e6f686e17e7973b68fce610e09bd4d2 Mon Sep 17 00:00:00 2001 From: sigurdfdragon Date: Thu, 2 Aug 2018 14:10:44 -0400 Subject: [PATCH] NR: Ensure Krash doesn't overwrite other units and is properly placed. This could happen if a player has Krash and skipped S10a. (cherry-picked from commit c6d2a0febc1f8ab7b9648d4319f6091c8675925a) --- .../scenarios/11a_The_Eastern_Flank.cfg | 2 +- .../scenarios/12a_Get_the_Gold.cfg | 2 +- .../scenarios/13a_Showdown.cfg | 2 +- .../Northern_Rebirth/utils/utils.cfg | 34 +++++++++++++++++-- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/data/campaigns/Northern_Rebirth/scenarios/11a_The_Eastern_Flank.cfg b/data/campaigns/Northern_Rebirth/scenarios/11a_The_Eastern_Flank.cfg index 3e39c7b7beea..131ec7fe32b7 100644 --- a/data/campaigns/Northern_Rebirth/scenarios/11a_The_Eastern_Flank.cfg +++ b/data/campaigns/Northern_Rebirth/scenarios/11a_The_Eastern_Flank.cfg @@ -151,7 +151,7 @@ [event] name=prestart - {RECALL_KRASH} + {RECALL_KRASH 7} [if] [not] [have_unit] diff --git a/data/campaigns/Northern_Rebirth/scenarios/12a_Get_the_Gold.cfg b/data/campaigns/Northern_Rebirth/scenarios/12a_Get_the_Gold.cfg index a9749c60a19d..443c17912d4c 100644 --- a/data/campaigns/Northern_Rebirth/scenarios/12a_Get_the_Gold.cfg +++ b/data/campaigns/Northern_Rebirth/scenarios/12a_Get_the_Gold.cfg @@ -276,7 +276,7 @@ {VARIABLE path_get_the_gold yes} # Here’s where we edit out Krash's side if he's dead. - {RECALL_KRASH} + {RECALL_KRASH 4} [if] [not] [have_unit] diff --git a/data/campaigns/Northern_Rebirth/scenarios/13a_Showdown.cfg b/data/campaigns/Northern_Rebirth/scenarios/13a_Showdown.cfg index 4fe92c7b5c75..e022960f18b7 100644 --- a/data/campaigns/Northern_Rebirth/scenarios/13a_Showdown.cfg +++ b/data/campaigns/Northern_Rebirth/scenarios/13a_Showdown.cfg @@ -354,7 +354,7 @@ # Check if Krash is alive, if yes place him at helm of side 7, # otherwise it's taken over by older lich. - {RECALL_KRASH} + {RECALL_KRASH 7} [store_starting_location] side=7 variable=side_seven_starts_at diff --git a/data/campaigns/Northern_Rebirth/utils/utils.cfg b/data/campaigns/Northern_Rebirth/utils/utils.cfg index 2fd5f3ccb624..6341b64cce35 100644 --- a/data/campaigns/Northern_Rebirth/utils/utils.cfg +++ b/data/campaigns/Northern_Rebirth/utils/utils.cfg @@ -55,11 +55,14 @@ [/if] #enddef -#define RECALL_KRASH +#define RECALL_KRASH SIDE # In S11a-13a Krash starts as the leader of a side if he is alive. He is not # defined in the corresponding side tags for these scenarios, since if he is, # that would cause Krash to be reborn if he was dead. Since [recall] requires # a leader on the map, do this to get him off of his recall list without one. + # Side is specified and leader status given here again, in case Krash is alive + # but on the wrong side at scenario start, which can happen if scenarios are skipped + # when using debug commands. [store_unit] [filter] id=Krash @@ -70,16 +73,43 @@ [if] {VARIABLE_CONDITIONAL krash.id equals Krash} [then] + {VARIABLE krash.side {SIDE}} [store_starting_location] - side=$krash.side + side={SIDE} variable=start_loc [/store_starting_location] [unstore_unit] variable=krash + find_vacant=yes x,y=$start_loc.x,$start_loc.y [/unstore_unit] [/then] [/if] + [if] + [have_unit] + id=Krash + canrecruit=no + [/have_unit] + [then] + # Ensure he is a leader + [modify_unit] + [filter] + id=Krash + [/filter] + canrecruit=yes + [/modify_unit] + # Remove loyalty overlay + [remove_unit_overlay] + id=Krash + image=misc/loyal-icon.png + [/remove_unit_overlay] + # Give expendable overlay + [unit_overlay] + id=Krash + image=misc/leader-expendable.png + [/unit_overlay] + [/then] + [/if] {CLEAR_VARIABLE krash,start_loc} #enddef