Skip to content

Commit

Permalink
NR: Ensure Krash doesn't overwrite other units and is properly placed.
Browse files Browse the repository at this point in the history
This could happen if a player has Krash and skipped S10a.

(cherry-picked from commit c6d2a0f)
  • Loading branch information
sigurdfdragon committed Oct 7, 2018
1 parent b82647a commit d37c6d6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
Expand Up @@ -151,7 +151,7 @@
[event]
name=prestart

{RECALL_KRASH}
{RECALL_KRASH 7}
[if]
[not]
[have_unit]
Expand Down
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion data/campaigns/Northern_Rebirth/scenarios/13a_Showdown.cfg
Expand Up @@ -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
Expand Down
34 changes: 32 additions & 2 deletions data/campaigns/Northern_Rebirth/utils/utils.cfg
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit d37c6d6

Please sign in to comment.