Simplify an event

This commit is contained in:
ln-zookeeper 2014-12-09 16:36:16 +02:00
parent 5a2e76e79e
commit 8d4c34d62f

View file

@ -430,76 +430,61 @@
[/event]
[event]
name=side turn
name=side 2 turn
first_time_only=no
[if]
[variable]
name=side_number
equals=2
[/variable]
[have_unit]
side=1
[filter_vision]
visible=yes
side=2
[/filter_vision]
[or]
side=1
[filter_vision]
visible=yes
side=3
[/filter_vision]
[/or]
[/have_unit]
[then]
[if]
[have_unit]
side=1
# if player is visible to enemies, flip all nearby enemies to side 3,
# which is the aggressive side and thus the nearby enemies will begin
# to pursue the player
[filter_vision]
visible=yes
side=2
[/filter_vision]
[modify_unit]
[filter]
side=2
[or]
side=1
[filter_vision]
visible=yes
side=3
[/filter_vision]
[/or]
[/have_unit]
[then]
# if player is visible to enemies, flip all nearby enemies to side 3,
# which is the aggressive side and thus the nearby enemies will begin
# to pursue the player
[store_unit]
[filter_location]
[filter]
side=2
[filter_location]
[filter]
side=1
[/filter]
{QUANTITY radius 8 11 13}
[/filter_location]
side=1
[/filter]
kill=yes
variable=side_2_units_nearby
[/store_unit]
{FOREACH side_2_units_nearby i}
{VARIABLE side_2_units_nearby[$i].side 3}
[unstore_unit]
variable=side_2_units_nearby[$i]
find_vacant=no
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE side_2_units_nearby}
[/then]
[else]
# if player isn't seen by enemies anymore, make all enemies idle again
{MODIFY_UNIT side=3 side 2}
[/else]
[/if]
{QUANTITY radius 8 11 13}
[/filter_location]
[/filter]
side=3
[/modify_unit]
[/then]
[else]
# if player isn't seen by enemies anymore, make all enemies idle again
[modify_unit]
[filter]
side=3
[/filter]
side=2
[/modify_unit]
[/else]
[/if]
[/event]