Skip to content

Commit

Permalink
DW 12: refactor event code
Browse files Browse the repository at this point in the history
The replay safety isse already exists before
  • Loading branch information
sevu committed Jan 6, 2019
1 parent 174c6ac commit 452f5fc
Showing 1 changed file with 56 additions and 69 deletions.
125 changes: 56 additions & 69 deletions data/campaigns/Dead_Water/scenarios/12_Revenge.cfg
Expand Up @@ -802,6 +802,7 @@

[event]
name=moveto
id=bat_necklace_is_bad

[filter]
x,y=14,11
Expand Down Expand Up @@ -878,83 +879,69 @@
[option]
label= _ "That sounds great! I’ll take it."
[command]
{ANKH_NECKLACE 14 11 necklace1}
[set_variable]
name=get_necklace
value=yes
value=done
[/set_variable]
[/command]
[/option]
[option]
label= _ "It doesn’t seem to have helped its previous owner. I don’t want it."
[command]
[allow_undo][/allow_undo]

# Insert event to obtain the necklace later.
# This is not replay / MP safe, because of the combination with [allow_undo]

# In case you do not choose the necklace and undo the event afterwards,
# you will have the possibility to choose the necklace with the event below.
# However, in the replay (same happens for MP btw) [allow_undo] means that
# this all never happened, and the moment the replay shows the scene where you
# move the second time onto the necklace, it's the first time in the replay.
# And thus fires the event above, not the one below.

# Because the code does the same (and the options are in the same order, too),
# it may or may not cause replay / MP issues

[event]
name=moveto
first_time_only=no

[filter]
x=14
y=11
side=1
[/filter]
[filter_condition]
[variable]
name=get_necklace
not_equals=done
[/variable]
[/filter_condition]

[message]
speaker=unit
[option]
label= _ "I would like my life force protected."
[command]
{ANKH_NECKLACE 14 11 necklace1}
[set_variable]
name=get_necklace
value=done
[/set_variable]
[/command]
[/option]
[option]
label= _ "My life force feels fine as it is."
[command]
[allow_undo][/allow_undo]
[/command]
[/option]
[/message]
[/event]
[/command]
[/option]
[/message]

[if]
[variable]
name=get_necklace
equals=yes
[/variable]
[then]
{ANKH_NECKLACE 14 11 necklace1}
[set_variable]
name=get_necklace
value=done
[/set_variable]
[/then]
[else]
[allow_undo][/allow_undo]
[event]
name=moveto
first_time_only=no

[filter]
x=14
y=11
side=1
[/filter]

[if]
[variable]
name=get_necklace
not_equals=done
[/variable]
[then]
[message]
speaker=unit
[option]
label= _ "I would like my life force protected."
[command]
[set_variable]
name=get_necklace
value=yes
[/set_variable]
[/command]
[/option]
[option]
label= _ "My life force feels fine as it is."
[/option]
[/message]
[/then]
[/if]

[if]
[variable]
name=get_necklace
equals=yes
[/variable]
[then]
{ANKH_NECKLACE 14 11 necklace1}
[set_variable]
name=get_necklace
value=done
[/set_variable]
[/then]
[else]
[allow_undo][/allow_undo]
[/else]
[/if]
[/event]
[/else]
[/if]
[/event]
[/scenario]

0 comments on commit 452f5fc

Please sign in to comment.