NR: Ensure Krash doesn't overwrite other units and is properly placed.

This could happen if a player has Krash and skipped S10a.
This commit is contained in:
sigurdfdragon 2018-08-02 14:10:44 -04:00
parent 4befb3580d
commit c6d2a0febc
4 changed files with 35 additions and 5 deletions

View file

@ -151,7 +151,7 @@
[event]
name=prestart
{RECALL_KRASH}
{RECALL_KRASH 7}
[if]
[not]
[have_unit]

View file

@ -276,7 +276,7 @@
{VARIABLE path_get_the_gold yes}
# Heres where we edit out Krash's side if he's dead.
{RECALL_KRASH}
{RECALL_KRASH 4}
[if]
[not]
[have_unit]

View file

@ -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

View file

@ -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