Refactored CREATE_ADVISOR to reduce indent and avoid stderr errors from failed recalls
This commit is contained in:
parent
1d7e45db23
commit
d466ac86c4
1 changed files with 46 additions and 40 deletions
|
@ -24,52 +24,58 @@
|
|||
|
||||
# Create a new ghost-type "advisor" if Malin doesn't already have one
|
||||
#define CREATE_ADVISOR
|
||||
[recall]
|
||||
# recall an advisor if one already exists
|
||||
role=advisor
|
||||
[/recall]
|
||||
[if]
|
||||
# If that didn't work, make another unit the advisor
|
||||
[not]
|
||||
[have_unit]
|
||||
role=advisor
|
||||
[/have_unit]
|
||||
[/not]
|
||||
[have_unit]
|
||||
side=1
|
||||
role=advisor
|
||||
search_recall_list=yes
|
||||
[/have_unit]
|
||||
[then]
|
||||
[role]
|
||||
role=advisor
|
||||
type=Spectre,Nightgaunt,Wraith,Shadow,Ghost
|
||||
[/role]
|
||||
# Recall an advisor if we have one to do so
|
||||
[recall]
|
||||
role=advisor
|
||||
[/recall]
|
||||
[if]
|
||||
# If player has no such units on the recall list, make a new ghost
|
||||
[not]
|
||||
[have_unit]
|
||||
role=advisor
|
||||
[/have_unit]
|
||||
[/not]
|
||||
[then]
|
||||
[store_unit]
|
||||
# store to get location
|
||||
[filter]
|
||||
id=Malin Keshar
|
||||
[/filter]
|
||||
kill=no
|
||||
variable=tempStore
|
||||
[/store_unit]
|
||||
[unit]
|
||||
type=Ghost
|
||||
side=1
|
||||
x=$tempStore.x
|
||||
y=$tempStore.y
|
||||
role=advisor
|
||||
[/unit]
|
||||
{CLEAR_VARIABLE tempStore}
|
||||
[/then]
|
||||
[/if]
|
||||
[/then]
|
||||
[elseif]
|
||||
# Else, make a new advisor from a ghost unit
|
||||
[have_unit]
|
||||
side=1
|
||||
type=Spectre,Nightgaunt,Wraith,Shadow,Ghost
|
||||
search_recall_list=yes
|
||||
[/have_unit]
|
||||
[then]
|
||||
[role]
|
||||
role=advisor
|
||||
side=1
|
||||
type=Spectre,Nightgaunt,Wraith,Shadow,Ghost
|
||||
[/role]
|
||||
|
||||
[recall]
|
||||
role=advisor
|
||||
[/recall]
|
||||
[/then]
|
||||
[/elseif]
|
||||
[else]
|
||||
# If that fails too, make a brand new ghost advisor
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=Malin Keshar
|
||||
[/filter]
|
||||
kill=no
|
||||
variable=tempStore
|
||||
[/store_unit]
|
||||
|
||||
[unit]
|
||||
type=Ghost
|
||||
side=1
|
||||
x=$tempStore.x
|
||||
y=$tempStore.y
|
||||
role=advisor
|
||||
animate=yes
|
||||
[/unit]
|
||||
|
||||
{CLEAR_VARIABLE tempStore}
|
||||
[/else]
|
||||
[/if]
|
||||
#enddef
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue