Skip to content

Commit

Permalink
NR S7-8: avoid recreating the new companions from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
joeylmaalouf authored and sevu committed Aug 2, 2018
1 parent 7c70c1d commit 4befb35
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 40 deletions.
Expand Up @@ -899,6 +899,70 @@
[/endlevel]
[/event]

[event]
name=victory

[store_unit]
# Get references to the new companions joining us next scenario.
[filter]
id="Stalrag,Ro'Arthian,Ro'Sothian"
[/filter]
variable=new_companions
kill=no # Leave them visible on the field during linger mode.
[/store_unit]

[foreach]
array=new_companions
[do]
{VARIABLE this_item.side 1}
{VARIABLE this_item.canrecruit no}
# We'll be unstoring these units onto the recall list, which won't heal them automatically, so we do it here.
{CLEAR_VARIABLE this_item.attacks_left}
{CLEAR_VARIABLE this_item.moves}
{CLEAR_VARIABLE this_item.hitpoints}
{CLEAR_VARIABLE this_item.status}
# Stalrag gains the loyal and healthy traits, while Ro'Arthian and Ro'Sothian get loyal and undead.
[if]
[variable]
name=this_item.id
equals=Stalrag
[/variable]
[then]
{VARIABLE this_item.overlays misc/loyal-icon.png}
[set_variables]
name=this_item.modifications
mode=replace
[literal]
{TRAIT_LOYAL}
{TRAIT_HEALTHY}
[/literal]
[/set_variables]
[/then]
[else]
{VARIABLE this_item.overlays misc/hero-icon.png}
{VARIABLE this_item.ellipse misc/ellipse-hero}
[set_variables]
name=this_item.modifications
mode=replace
[literal]
{TRAIT_LOYAL}
{TRAIT_UNDEAD}
[/literal]
[/set_variables]
[/else]
[/if]

[unstore_unit]
# Put our referenced units onto the recall list so we have them in the next scenario.
variable=this_item
x,y=recall,recall
[/unstore_unit]
[/do]
[/foreach]

{CLEAR_VARIABLE new_companions}
[/event]

# And if the allied AI dies player loses
[event]
name=last breath
Expand Down
52 changes: 12 additions & 40 deletions data/campaigns/Northern_Rebirth/scenarios/08a_Elvish_Princess.cfg
Expand Up @@ -100,46 +100,6 @@

# wmllint: recognize Tallin
{CHARACTER_STATS_TALLIN}

[unit]
type=Dwarvish Lord
id=Stalrag
name= _ "Stalrag"
profile=portraits/Stalrag.png
x,y=15,2
side=1
[modifications]
{TRAIT_LOYAL}
{TRAIT_HEALTHY}
[/modifications]
{IS_LOYAL}
[/unit]

[unit]
type=Ancient Lich
id="Ro'Arthian"
name= _ "Ro’Arthian"
profile=portraits/Arthian.png
side=1
x,y=15,2
[modifications]
{TRAIT_LOYAL}
[/modifications]
{IS_HERO}
[/unit]

[unit]
type=Lich
id="Ro'Sothian"
name= _ "Ro’Sothian"
profile=portraits/Ro_Sothian.png
side=1
x,y=15,2
[modifications]
{TRAIT_LOYAL}
[/modifications]
{IS_HERO}
[/unit]
[/side]
# wmllint: validate-on

Expand Down Expand Up @@ -252,6 +212,18 @@
id=Elenia
[/recall]

[recall]
id=Stalrag
[/recall]

[recall]
id="Ro'Arthian"
[/recall]

[recall]
id="Ro'Sothian"
[/recall]

[objectives]
side=1
[objective]
Expand Down

0 comments on commit 4befb35

Please sign in to comment.