prevent killing everyone when there are no defenders...

...found and set a default next_scenario
This commit is contained in:
Gunter Labes 2009-03-18 12:49:11 +00:00
parent 583f730637
commit 3b895e26e4

View file

@ -7,6 +7,7 @@
id="5_A_Subterranean_Struggle"
name= _ "A Subterranean Struggle"
label= _ "A Subterranean Struggle"
next_scenario=6a_In_the_Tunnels_of_the_Trolls
map_data="{campaigns/Under_the_Burning_Suns/maps/05_A_Subterranean_Struggle.map}"
victory_when_enemies_defeated=no
@ -2208,100 +2209,108 @@
value=$number_to_kill
[/set_variable]
{STARTLOOP i}
[store_locations]
x=24-46
y=19-35
[filter]
id="Dwarf Defender"
[/filter]
variable=dwarf_victims
[/store_locations]
[set_variable]
name=number_of_victims
value=$dwarf_victims.length
[/set_variable]
#subtract 1 because arrays go from 0 to length-1
[set_variable]
name=number_of_victims
add=-1
[/set_variable]
[set_variable]
name=random_string
format=0..$number_of_victims
[/set_variable]
[set_variable]
name=death
random=$random_string
[/set_variable]
[set_variable]
name=kill_x
to_variable=dwarf_victims[$death].x
[/set_variable]
[set_variable]
name=kill_y
to_variable=dwarf_victims[$death].y
[/set_variable]
#have some dwarves scream as they die
[if]
[variable]
name=i
numerical_equals=-1
name=number_to_kill
greater_than=0
[/variable]
[then]
[message]
{STARTLOOP i}
[store_locations]
x=24-46
y=19-35
[filter]
id="Dwarf Defender"
[/filter]
variable=dwarf_victims
[/store_locations]
[set_variable]
name=number_of_victims
value=$dwarf_victims.length
[/set_variable]
#subtract 1 because arrays go from 0 to length-1
[set_variable]
name=number_of_victims
add=-1
[/set_variable]
[set_variable]
name=random_string
format=0..$number_of_victims
[/set_variable]
[set_variable]
name=death
random=$random_string
[/set_variable]
[set_variable]
name=kill_x
to_variable=dwarf_victims[$death].x
[/set_variable]
[set_variable]
name=kill_y
to_variable=dwarf_victims[$death].y
[/set_variable]
#have some dwarves scream as they die
[if]
[variable]
name=i
numerical_equals=-1
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "Aaauuuggghhhh!"
[/message]
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-2
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "No!!!"
[/message]
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-3
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "Help me!!!"
[/message]
[/then]
[/if]
[kill]
x,y=$kill_x,$kill_y
message= _ "Aaauuuggghhhh!"
[/message]
animate=yes
fire_event=no
[/kill]
{ENDLOOP i}
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-2
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "No!!!"
[/message]
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-3
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "Help me!!!"
[/message]
[/then]
[/if]
[kill]
x,y=$kill_x,$kill_y
animate=yes
fire_event=no
[/kill]
{ENDLOOP i}
[message]
speaker=Dwarf Leader
message= _ "More accursed troll magic. Fall back! "
@ -2460,100 +2469,108 @@
value=$number_to_kill
[/set_variable]
{STARTLOOP i}
[store_locations]
x=24-46
y=19-35
[filter]
id="Troll Defender"
[/filter]
variable=troll_victims
[/store_locations]
[set_variable]
name=number_of_victims
value=$troll_victims.length
[/set_variable]
#subtract 1 because arrays go from 0 to length-1
[set_variable]
name=number_of_victims
add=-1
[/set_variable]
[set_variable]
name=random_string
format=0..$number_of_victims
[/set_variable]
[set_variable]
name=death
random=$random_string
[/set_variable]
[set_variable]
name=kill_x
to_variable=troll_victims[$death].x
[/set_variable]
[set_variable]
name=kill_y
to_variable=troll_victims[$death].y
[/set_variable]
#have some trolls scream as they die
[if]
[variable]
name=i
numerical_equals=-1
name=number_to_kill
greater_than=0
[/variable]
[then]
[message]
{STARTLOOP i}
[store_locations]
x=24-46
y=19-35
[filter]
id="Troll Defender"
[/filter]
variable=troll_victims
[/store_locations]
[set_variable]
name=number_of_victims
value=$troll_victims.length
[/set_variable]
#subtract 1 because arrays go from 0 to length-1
[set_variable]
name=number_of_victims
add=-1
[/set_variable]
[set_variable]
name=random_string
format=0..$number_of_victims
[/set_variable]
[set_variable]
name=death
random=$random_string
[/set_variable]
[set_variable]
name=kill_x
to_variable=troll_victims[$death].x
[/set_variable]
[set_variable]
name=kill_y
to_variable=troll_victims[$death].y
[/set_variable]
#have some trolls scream as they die
[if]
[variable]
name=i
numerical_equals=-1
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "Aaauuuggghhhh!"
[/message]
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-2
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "No!!!"
[/message]
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-3
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "Gaggghhh!" # wmllint: no spellcheck
[/message]
[/then]
[/if]
[kill]
x,y=$kill_x,$kill_y
message= _ "Aaauuuggghhhh!"
[/message]
animate=yes
fire_event=no
[/kill]
{ENDLOOP i}
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-2
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "No!!!"
[/message]
[/then]
[/if]
[if]
[variable]
name=i
numerical_equals=-3
[/variable]
[then]
[message]
x,y=$kill_x,$kill_y
message= _ "Gaggghhh!" # wmllint: no spellcheck
[/message]
[/then]
[/if]
[kill]
x,y=$kill_x,$kill_y
animate=yes
fire_event=no
[/kill]
{ENDLOOP i}
[message]
speaker=Troll Leader
message= _ "I must go back and find more trolls to fight. You must hold them back, Kaleh. Be strong like rock. Griknagh will be with you."