Deprecate ON_SIGHTING

Since sighted events now work, this macro is no longer necessary
This commit is contained in:
Charles Dang 2015-08-12 06:12:13 +11:00
parent f099638b26
commit 768a418137
2 changed files with 148 additions and 148 deletions

View file

@ -80,3 +80,151 @@ _"No gold carried over to the next scenario."#enddef
overlays="misc/loyal-icon.png"
[/unit]
#enddef
#define ON_SIGHTING ID SIGHTING_SIDE SIGHTED_FILTER ACTION_WML
# NOTE: As of version 1.11, this macro is unnecessary, since sighted
# events now work as intended.
#
# This is intended to be used when a regular sighted event can't be relied
# on (that'd be most of the time). This event triggers when a unit matching
# SIGHTED_FILTER is first seen by a unit of side SIGHTING_SIDE. This works
# whether the sighting happens due to moving, recruiting, recalling,
# attacking (in case DSU was on before the attack) or advancing. If none of
# those actions manage to "catch" the moment of sighting, then it will occur
# when the current side ends their turn.
#
# The 'unit' and 'second_unit' message speaker shortcuts as well as the
# auto-stored $unit and $second_unit should work normally: the sighting unit
# is the primary unit and the sighted unit is the secondary unit.
#
# You need to provide a unique ID if you use several of these events in the
# same scenario. Otherwise it can be left empty.
#
# Only works if SIGHTING_SIDE has fog and/or shroud.
#
# Example:
#! {ON_SIGHTING () 1 side=2,3 (
#! [message]
#! speaker=unit
#! message= _ "I can see a side $second_unit.side $second_unit.language_name|!"
#! [/message]
#! [message]
#! speaker=second_unit
#! message= _ "Oh my! I was seen by a side $unit.side $unit.language_name|!"
#! [/message]
#! )}
#!
[event]
name=SIGHTED_{ID}_trigger_action_WML
{ACTION_WML}
[/event]
[event]
name=moveto,recruit,recall,attack,post advance,side turn
first_time_only=no
[filter]
side={SIGHTING_SIDE}
[or]
{SIGHTED_FILTER}
[/or]
[/filter]
[if]
[variable]
name=SIGHTED_{ID}_finished
not_equals=yes
[/variable]
[then]
[store_side]
side={SIGHTING_SIDE}
variable=stored_sighting_side
[/store_side]
[if]
[have_unit]
{SIGHTED_FILTER}
[filter_vision]
side={SIGHTING_SIDE}
[/filter_vision]
[/have_unit]
[and]
[variable]
name=stored_sighting_side.fog
boolean_equals=yes
[/variable]
[or]
[variable]
name=stored_sighting_side.shroud
boolean_equals=yes
[/variable]
[/or]
[/and]
[then]
[fire_event]
name=SIGHTED_{ID}_trigger_action_WML
[primary_unit]
side={SIGHTING_SIDE}
[filter_location]
[filter]
{SIGHTED_FILTER}
[not]
side={SIGHTING_SIDE}
[/not]
[/filter]
radius="$($this_unit.max_moves + 1)"
[/filter_location]
[/primary_unit]
[secondary_unit]
{SIGHTED_FILTER}
[filter_vision]
side={SIGHTING_SIDE}
[/filter_vision]
[/secondary_unit]
[/fire_event]
[set_variable]
name=SIGHTED_{ID}_finished
value=yes
[/set_variable]
[/then]
[else]
[allow_undo]
[/allow_undo]
[/else]
[/if]
[clear_variable]
name=stored_sighting_side
[/clear_variable]
[/then]
[else]
[allow_undo]
[/allow_undo]
[/else]
[/if]
[/event]
[event]
name=victory
[clear_variable]
name=SIGHTED_{ID}_finished
[/clear_variable]
[/event]
#enddef

View file

@ -48,151 +48,3 @@
name=moveto
[/event]
#enddef
#define ON_SIGHTING ID SIGHTING_SIDE SIGHTED_FILTER ACTION_WML
# NOTE: As of version 1.11, this macro is unnecessary, since sighted
# events now work as intended.
#
# This is intended to be used when a regular sighted event can't be relied
# on (that'd be most of the time). This event triggers when a unit matching
# SIGHTED_FILTER is first seen by a unit of side SIGHTING_SIDE. This works
# whether the sighting happens due to moving, recruiting, recalling,
# attacking (in case DSU was on before the attack) or advancing. If none of
# those actions manage to "catch" the moment of sighting, then it will occur
# when the current side ends their turn.
#
# The 'unit' and 'second_unit' message speaker shortcuts as well as the
# auto-stored $unit and $second_unit should work normally: the sighting unit
# is the primary unit and the sighted unit is the secondary unit.
#
# You need to provide a unique ID if you use several of these events in the
# same scenario. Otherwise it can be left empty.
#
# Only works if SIGHTING_SIDE has fog and/or shroud.
#
# Example:
#! {ON_SIGHTING () 1 side=2,3 (
#! [message]
#! speaker=unit
#! message= _ "I can see a side $second_unit.side $second_unit.language_name|!"
#! [/message]
#! [message]
#! speaker=second_unit
#! message= _ "Oh my! I was seen by a side $unit.side $unit.language_name|!"
#! [/message]
#! )}
#!
[event]
name=SIGHTED_{ID}_trigger_action_WML
{ACTION_WML}
[/event]
[event]
name=moveto,recruit,recall,attack,post advance,side turn
first_time_only=no
[filter]
side={SIGHTING_SIDE}
[or]
{SIGHTED_FILTER}
[/or]
[/filter]
[if]
[variable]
name=SIGHTED_{ID}_finished
not_equals=yes
[/variable]
[then]
[store_side]
side={SIGHTING_SIDE}
variable=stored_sighting_side
[/store_side]
[if]
[have_unit]
{SIGHTED_FILTER}
[filter_vision]
side={SIGHTING_SIDE}
[/filter_vision]
[/have_unit]
[and]
[variable]
name=stored_sighting_side.fog
boolean_equals=yes
[/variable]
[or]
[variable]
name=stored_sighting_side.shroud
boolean_equals=yes
[/variable]
[/or]
[/and]
[then]
[fire_event]
name=SIGHTED_{ID}_trigger_action_WML
[primary_unit]
side={SIGHTING_SIDE}
[filter_location]
[filter]
{SIGHTED_FILTER}
[not]
side={SIGHTING_SIDE}
[/not]
[/filter]
radius="$($this_unit.max_moves + 1)"
[/filter_location]
[/primary_unit]
[secondary_unit]
{SIGHTED_FILTER}
[filter_vision]
side={SIGHTING_SIDE}
[/filter_vision]
[/secondary_unit]
[/fire_event]
[set_variable]
name=SIGHTED_{ID}_finished
value=yes
[/set_variable]
[/then]
[else]
[allow_undo]
[/allow_undo]
[/else]
[/if]
[clear_variable]
name=stored_sighting_side
[/clear_variable]
[/then]
[else]
[allow_undo]
[/allow_undo]
[/else]
[/if]
[/event]
[event]
name=victory
[clear_variable]
name=SIGHTED_{ID}_finished
[/clear_variable]
[/event]
#enddef