TRoW S19: Automatically collect chest at the end of the scenario (#6192)

This commit is contained in:
Descacharrado 2021-11-03 06:54:39 +01:00 committed by GitHub
parent 3a312f3703
commit 1b905240af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -162,6 +162,7 @@
{VARIABLE xx1 $possible_chest_locs[$random].x}
{VARIABLE yy1 $possible_chest_locs[$random].y}
{VARIABLE chest_obtained no}
{CLEAR_VARIABLE possible_chest_locs,random}
@ -310,16 +311,31 @@
x=$xx1
y=$yy1
[/filter]
[fire_event]
name=get chest
[/fire_event]
[/event]
[event]
name=get chest
[sound]
name=open-chest.wav
[/sound]
[store_unit]
[filter]
x,y=$xx1,$yy1
side=1
[/filter]
variable=chest_unit_temp
[/store_unit]
[message]
speaker=unit
speaker=$chest_unit_temp.id
message= _ "Ive found the orcs chest! Its filled with gold."
[/message]
{CLEAR_VARIABLE chest_unit_temp}
[remove_item]
x,y=$x1,$y1
[/remove_item]
@ -327,6 +343,10 @@
{PLACE_IMAGE (items/chest-plain-open.png) $xx1 $yy1}
{LOOT {ON_DIFFICULTY 125 100 75} 1}
[set_variable]
name=chest_obtained
value=yes
[/set_variable]
[/event]
# When an enemy side has less than half of its units left, some undead
@ -639,7 +659,6 @@
[/message]
{CLEAR_VARIABLE side_2_undead_backup_triggered,side_3_undead_backup_triggered,side_4_undead_backup_triggered,undead_spawns_so_far}
{CLEAR_VARIABLE xx1,yy1}
[endlevel]
result=victory
@ -675,4 +694,26 @@
message= _ "Ahh, its great to be home! Im not much for the politics, but its great to be home!"
[/message]
[/event]
[event]
name=victory
[if]
[variable]
name=chest_obtained
equals=no
[/variable]
[then]
[message]
speaker=Prince Haldric
message= _ "Grab the trolls gold and get moving!"
[/message]
[fire_event]
name=get chest
[/fire_event]
[/then]
[/if]
{CLEAR_VARIABLE xx1,yy1,chest_obtained}
[/event]
[/scenario]