Added a new event macro ON_SIGHTING,
...which simulates a sighted event but in a more reliable manner.
This commit is contained in:
parent
7e7cff2488
commit
6beb740d8c
1 changed files with 139 additions and 0 deletions
|
@ -195,3 +195,142 @@
|
|||
name=param[0]
|
||||
[/clear_variable]
|
||||
#enddef
|
||||
|
||||
#define ON_SIGHTING ID SIGHTING_SIDE SIGHTED_FILTER ACTION_WML
|
||||
# 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.
|
||||
#
|
||||
# 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.type|!"
|
||||
#! [/message]
|
||||
#! [message]
|
||||
#! speaker=second_unit
|
||||
#! message= _ "Oh my! I was seen by a side $unit.side $unit.type|!"
|
||||
#! [/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]
|
||||
viewing_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]
|
||||
viewing_side={SIGHTING_SIDE}
|
||||
[/filter_vision]
|
||||
[/secondary_unit]
|
||||
[/fire_event]
|
||||
|
||||
[set_variable]
|
||||
name=SIGHTED_{ID}_finished
|
||||
value=yes
|
||||
[/set_variable]
|
||||
[/then]
|
||||
[/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
|
||||
|
|
Loading…
Add table
Reference in a new issue