UtBS S5: Implement victory and defeat as custom events

Moves victory from macros to custom events, and separates
leaders' last breaths from endlevels
This commit is contained in:
DisherProject 2019-03-04 14:22:06 +01:00
parent e7cc255d80
commit a656bfae71

View file

@ -730,7 +730,6 @@
[/message]
[/event]
# victory events for trolls and dwarves here to make the ally event easier to follow
#define CLOAK_KILL_OBJECTIVES
[objectives]
summary= _ "New Objectives:"
@ -759,220 +758,6 @@
[/objectives]
#enddef
#define TROLL_ALLY_VICTORY
[event]
name=troll_victory_test
[filter_condition]
[have_unit]
race=dwarf
canrecruit=yes
count=0
[/have_unit]
[/filter_condition]
[terrain]
x=22,21,20,19,19,18,17
y=14,14,14,15,16,16,17
terrain=Uu
[/terrain]
{NAMED_NOTRAIT_UNIT 2 (Troll Shaman) 20 14 (Zurg) ( _ "Zurg")}
[remove_shroud]
x=19-23
y=12-16
side=1
[/remove_shroud]
[redraw]
side=1
[/redraw]
[delay]
time=200
[/delay]
# wmllint: recognize Cloaked Figure
[message]
speaker=Zurg
message= _ "Congratulations! Some of trolls didnt think you strong enough to beat Dwarves."
[/message]
[message]
speaker=Kaleh
message= _ "Where did you come from?"
[/message]
[message]
speaker=Zurg
message= _ "There many secret tunnels that you sun dwellers not know of. Only troll know. We smarter than you think. Zurg would have killed dwarves himself, but he was just sent back from where real fighting is."
[/message]
[message]
speaker=Zhul
message= _ "The real fighting? I thought that was what we were waist-deep in?"
[/message]
[message]
speaker=Zurg
# wmllint: local spelling tricksy
message= _ "While you fighting, another clan of dwarves sneak around and flank us. They tricksy like that. We must leave you and run back to defend women and little trolls. Dwarves never give up, many trolls die today, very hard fighting. But dwarves make mistake, you stronger than dwarf or troll thought. You trolls secret weapon."
[/message]
[message]
speaker=Nym
message= _ "How do you mean?"
[/message]
[message]
speaker=Zurg
message= _ "Right before battle, we find secret passage just to the north leading straight to big dwarf stronghold. Hiding in stronghold is big important dwarf, directing the battle. Dwarves always think they best fighters around so they leave only a few dwarves guarding their stronghold. If you elves can break through dwarf defenses and kill dwarf chieftain, then it will do much damage to dwarves, make them afraid and confused, easy prey for trolls. You do this and we can drive them back. Then troll leader can help show you how to return to surface. You come with Zurg, he show you way to secret passage."
[/message]
[message]
speaker=Elyssa
message= _ "Their knowledge of these tunnels is uncanny. I could have sworn a minute ago that that wall was solid rock."
[/message]
[if]
[have_unit]
id=Cloaked Figure
[/have_unit]
[then]
[message]
speaker=Kaleh
message= _ "Wait a moment, Zurg, we must deal with this mysterious cloaked figure before we can follow you."
[/message]
#set new scenario objectives
{CLOAK_KILL_OBJECTIVES}
[/then]
[else]
[message]
speaker=Kaleh
message= _ "It sounds like our work is not yet done. Very well, gather yourselves together, we must follow Zurg."
[/message]
[endlevel]
result=victory
next_scenario=06b_In_the_Domain_of_the_Dwarves
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]
[/else]
[/if]
[/event]
#enddef
#define DWARF_ALLY_VICTORY
[event]
name=dwarf_victory_test
[filter_condition]
[have_unit]
race=troll
canrecruit=yes
count=0
[/have_unit]
[/filter_condition]
[terrain]
x=24,23,22,21,20,19,18
y=44,45,45,46,46,46,45
terrain=Uu
[/terrain]
[delay]
time=200
[/delay]
{NAMED_NOTRAIT_UNIT 5 (Dwarvish Pathfinder) 21 46 (Grimnir) ( _ "Grimnir")}
[remove_shroud]
x=20-26
y=43-46
side=1
[/remove_shroud]
[redraw]
side=1
[/redraw]
[message]
speaker=Grimnir
message= _ "Congratulations, some of me boys didnt think you could beat the trolls."
[/message]
[message]
speaker=Kaleh
message= _ "Where did you come from?"
[/message]
[message]
speaker=Grimnir
message= _ "Dont think you know all the tunnels and passages that twist through these caves, elf. I would have killed him myself, but I was just sent back from the main front of the battle."
[/message]
[message]
speaker=Zhul
message= _ "The front? I thought this was the front."
[/message]
[message]
speaker=Grimnir
message= _ "While you were fighting, a separate clan of trolls sneaked around our sentries and flanked us, attacking our supply depots. There are more of those stinking buggers than we had originally thought. To tell you the truth, we are hard pressed. Were going to have to pull back all our forces in these caves to reinforce the back lines. But your victory here has produced a unexpected opportunity."
[/message]
[message]
speaker=Nym
message= _ "It has?"
[/message]
[message]
speaker=Grimnir
message= _ "Right before the trolls overran this area of the mines, our scouts had found an old tunnel south of here that leads almost straight to the main lair of this tribe of trolls. We believe that protected in the lair is one of their main leaders who is directing the battle. We were going to try to sneak in and lead a surprise attack, but frankly we didnt have enough dwarves to spare. If by using this passage you can sneak past their front lines and kill him, then it will throw the trolls into disarray and relieve the pressure on our front lines. If you do this our King has promised to help you return your people to the sunlit lands. When youre ready Ill show you the way. Its not far."
[/message]
[message]
speaker=Elyssa
message= _ "Their knowledge of these tunnels is uncanny. I could have sworn a minute ago that that wall was solid rock."
[/message]
[if]
[have_unit]
id=Cloaked Figure
[/have_unit]
[then]
[message]
speaker=Kaleh
message= _ "Wait a moment, Grimnir, we must deal with this mysterious cloaked figure before we can follow you."
[/message]
{CLOAK_KILL_OBJECTIVES}
[/then]
[else]
[message]
speaker=Kaleh
message= _ "It sounds like our work is not yet done. Very well, gather yourselves together, we must follow Grimnir."
[/message]
[endlevel]
result=victory
next_scenario=06a_In_the_Tunnels_of_the_Trolls
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]
[/else]
[/if]
[/event]
#enddef
# Event 2: Entering the large cavern
#player chooses one side (trolls or dwarves) then:
@ -1285,14 +1070,6 @@
message= _ "Bah! Your kind all the same. Everyone turns on trolls. But youll see, Griknagh will smash you all."
[/message]
{DWARF_ALLY_VICTORY}
[event]
name=troll_victory_test
[endlevel]
result=defeat
[/endlevel]
[/event]
#set new scenario objectives
[objectives]
@ -1351,14 +1128,6 @@
message= _ "I knew elves couldnt be trusted. Foolish boy, you will regret your betrayal. Taste dwarven steel!"
[/message]
{TROLL_ALLY_VICTORY}
[event]
name=dwarf_victory_test
[endlevel]
result=defeat
[/endlevel]
[/event]
#set new scenario objectives
[objectives]
summary= _ "New Objectives:"
@ -2514,15 +2283,6 @@
speaker=Fundin
message= _ "The rest is silence..."
[/message]
[kill]
id=Fundin
animate=yes
[/kill]
[fire_event]
name=troll_victory_test
[/fire_event]
[/event]
[event]
@ -2536,15 +2296,6 @@
speaker=Nori
message= _ "I go to my ancestors..."
[/message]
[kill]
id=Nori
animate=yes
[/kill]
[fire_event]
name=troll_victory_test
[/fire_event]
[/event]
[event]
@ -2558,10 +2309,6 @@
speaker=Thungar
message= _ "Arrghh!!"
[/message]
[fire_event]
name=dwarf_victory_test
[/fire_event]
[/event]
[event]
@ -2575,15 +2322,264 @@
speaker=Gnarl
message= _ "I will be avenged..."
[/message]
[/event]
[event]
name=die
[filter]
canrecruit=yes
[filter_side]
[allied_with]
side=1
[/allied_with]
[/filter_side]
[/filter]
[endlevel]
result=defeat
[/endlevel]
[/event]
[event]
name=die
first_time_only=no
[filter]
canrecruit=yes
[/filter]
[filter_condition]
[have_unit]
canrecruit=yes
[filter_side]
[enemy_of]
side=1
[/enemy_of]
[/filter_side]
[not]
id=$unit.id
[/not]
count=0
[/have_unit]
[/filter_condition]
[kill]
id=Gnarl
animate=yes
id=$unit.id
fire_event=no
animate=no
[/kill]
[fire_event]
name=dwarf_victory_test
[/fire_event]
[switch]
variable=ally_race
[case]
value="troll"
[fire_event]
name=troll_victory_test
[/fire_event]
[/case]
[case]
value="dwarf"
[fire_event]
name=dwarf_victory_test
[/fire_event]
[/case]
[/switch]
[/event]
[event]
name=troll_victory_test
[terrain]
x=22,21,20,19,19,18,17
y=14,14,14,15,16,16,17
terrain=Uu
[/terrain]
{NAMED_NOTRAIT_UNIT 2 (Troll Shaman) 20 14 (Zurg) ( _ "Zurg")}
[remove_shroud]
x=19-23
y=12-16
side=1
[/remove_shroud]
[redraw]
side=1
[/redraw]
[delay]
time=200
[/delay]
# wmllint: recognize Cloaked Figure
[message]
speaker=Zurg
message= _ "Congratulations! Some of trolls didnt think you strong enough to beat Dwarves."
[/message]
[message]
speaker=Kaleh
message= _ "Where did you come from?"
[/message]
[message]
speaker=Zurg
message= _ "There many secret tunnels that you sun dwellers not know of. Only troll know. We smarter than you think. Zurg would have killed dwarves himself, but he was just sent back from where real fighting is."
[/message]
[message]
speaker=Zhul
message= _ "The real fighting? I thought that was what we were waist-deep in?"
[/message]
[message]
speaker=Zurg
# wmllint: local spelling tricksy
message= _ "While you fighting, another clan of dwarves sneak around and flank us. They tricksy like that. We must leave you and run back to defend women and little trolls. Dwarves never give up, many trolls die today, very hard fighting. But dwarves make mistake, you stronger than dwarf or troll thought. You trolls secret weapon."
[/message]
[message]
speaker=Nym
message= _ "How do you mean?"
[/message]
[message]
speaker=Zurg
message= _ "Right before battle, we find secret passage just to the north leading straight to big dwarf stronghold. Hiding in stronghold is big important dwarf, directing the battle. Dwarves always think they best fighters around so they leave only a few dwarves guarding their stronghold. If you elves can break through dwarf defenses and kill dwarf chieftain, then it will do much damage to dwarves, make them afraid and confused, easy prey for trolls. You do this and we can drive them back. Then troll leader can help show you how to return to surface. You come with Zurg, he show you way to secret passage."
[/message]
[message]
speaker=Elyssa
message= _ "Their knowledge of these tunnels is uncanny. I could have sworn a minute ago that that wall was solid rock."
[/message]
[if]
[have_unit]
id=Cloaked Figure
[/have_unit]
[then]
[message]
speaker=Kaleh
message= _ "Wait a moment, Zurg, we must deal with this mysterious cloaked figure before we can follow you."
[/message]
#set new scenario objectives
{CLOAK_KILL_OBJECTIVES}
[/then]
[else]
[message]
speaker=Kaleh
message= _ "It sounds like our work is not yet done. Very well, gather yourselves together, we must follow Zurg."
[/message]
[endlevel]
result=victory
next_scenario=06b_In_the_Domain_of_the_Dwarves
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]
[/else]
[/if]
[/event]
[event]
name=dwarf_victory_test
[terrain]
x=24,23,22,21,20,19,18
y=44,45,45,46,46,46,45
terrain=Uu
[/terrain]
[delay]
time=200
[/delay]
{NAMED_NOTRAIT_UNIT 5 (Dwarvish Pathfinder) 21 46 (Grimnir) ( _ "Grimnir")}
[remove_shroud]
x=20-26
y=43-46
side=1
[/remove_shroud]
[redraw]
side=1
[/redraw]
[message]
speaker=Grimnir
message= _ "Congratulations, some of me boys didnt think you could beat the trolls."
[/message]
[message]
speaker=Kaleh
message= _ "Where did you come from?"
[/message]
[message]
speaker=Grimnir
message= _ "Dont think you know all the tunnels and passages that twist through these caves, elf. I would have killed him myself, but I was just sent back from the main front of the battle."
[/message]
[message]
speaker=Zhul
message= _ "The front? I thought this was the front."
[/message]
[message]
speaker=Grimnir
message= _ "While you were fighting, a separate clan of trolls sneaked around our sentries and flanked us, attacking our supply depots. There are more of those stinking buggers than we had originally thought. To tell you the truth, we are hard pressed. Were going to have to pull back all our forces in these caves to reinforce the back lines. But your victory here has produced a unexpected opportunity."
[/message]
[message]
speaker=Nym
message= _ "It has?"
[/message]
[message]
speaker=Grimnir
message= _ "Right before the trolls overran this area of the mines, our scouts had found an old tunnel south of here that leads almost straight to the main lair of this tribe of trolls. We believe that protected in the lair is one of their main leaders who is directing the battle. We were going to try to sneak in and lead a surprise attack, but frankly we didnt have enough dwarves to spare. If by using this passage you can sneak past their front lines and kill him, then it will throw the trolls into disarray and relieve the pressure on our front lines. If you do this our King has promised to help you return your people to the sunlit lands. When youre ready Ill show you the way. Its not far."
[/message]
[message]
speaker=Elyssa
message= _ "Their knowledge of these tunnels is uncanny. I could have sworn a minute ago that that wall was solid rock."
[/message]
[if]
[have_unit]
id=Cloaked Figure
[/have_unit]
[then]
[message]
speaker=Kaleh
message= _ "Wait a moment, Grimnir, we must deal with this mysterious cloaked figure before we can follow you."
[/message]
{CLOAK_KILL_OBJECTIVES}
[/then]
[else]
[message]
speaker=Kaleh
message= _ "It sounds like our work is not yet done. Very well, gather yourselves together, we must follow Grimnir."
[/message]
[endlevel]
result=victory
next_scenario=06a_In_the_Tunnels_of_the_Trolls
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]
[/else]
[/if]
[/event]
# When cloaked figure dies and if player has already killed both enemy