This commit is contained in:
Ignacio R. Morelle 2008-05-06 00:45:50 +00:00
parent 75d64b1df9
commit 0f659ab0f0

View file

@ -121,3 +121,48 @@
name=STORE_UNIT_VAR_store
[/clear_variable]
#enddef
#define ADVANCE_UNIT FILTER ADVANCETO
# Advances all units matching the filter to ADVANCETO or if missing, their normal advancement
#
# Example to advance all spearmen to a cavalrymen:
#! {ADVANCE_UNIT type=Spearman Cavalryman}
# Example to advance your leader normally:
#! {ADVANCE_UNIT side,canrecruit=1,yes ""}
[store_unit]
[filter]
{FILTER}
[/filter]
variable=ADVANCE_UNIT_store
kill=no
[/store_unit]
[set_variable]
name=advanceto
value={ADVANCETO}
[/set_variable]
{FOREACH ADVANCE_UNIT_store i}
[if]
[variable]
name=advanceto
not_equals=""
[/variable]
[then]
[set_variable]
name=ADVANCE_UNIT_store[$i].advanceto
value=$advanceto
[/set_variable]
[/then]
[/if]
[set_variable]
name=ADVANCE_UNIT_store[$i].experience
value=$ADVANCE_UNIT_store[$i].max_experience
[/set_variable]
[unstore_unit]
variable=ADVANCE_UNIT_store[$i]
find_vacant=no
advance=true
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE ADVANCE_UNIT_store}
#enddef