// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(68,0) == 0;
	question = "special";
	text1 = "As you get closer to the north wall of the Eastern Gallery, you smell smoke. A huge gateway blocks the northern road out of the gallery. It is surrounded by huge, natural stone spires, which bear an uncanny resemblance to horns.";
	text2 = "This is the Horned Gate. It is the border between Avernum and the lands lost to the Slith Horde. It is also predictably well-defended. You can see dozens of guards outside. The cream of the horde army.";
	text3 = "They sit outside the gate, clustered around cookfires, waiting for spies or raiders. They haven't seen you yet, but anyone walking up the main road is sure to be spotted quickly.";
	action = SET_SDF 68 0 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(68,1) == 0;
	question = "special";
	text1 = "From here, you have a good view of the Horned Gate itself. It is a massive gridwork of steel, topped with spikes and reinforced by magical runes.";
	text2 = "You can see the gate's soft green glow from here. The wizards of the horde have protected it well. It will take a lot of power or brute force to get it open.";
	text3 = "This is probably as close a view of the gate as any Avernite scout has had in quite a while.";
	action = SET_SDF 68 1 1;
	code =
		sf(68,8,1);
	break;
	
begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = get_sdf(68,2) == 0;
	question = "special";
	text1 = "There was a vicious skirmish here recently. Avernites and warriors of the horde met in a brief, intense battle. The rock is scorched, and streaks of blood are still plainly visible. Rats sniff around, looking for carrion.";
	action = SET_SDF 68 2 1;

begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = get_sdf(68,3) == 0;
	question = "special";
	text1 = "There is a huge chamber on the far side of the Horned Gate. Once, it was a simple clearing, where caravans would meet to camp and trade. The horde seems to have adapted it for their own purposes.";
	text2 = "There is a circle etched into the stone in the center, surrounded by crystal pylons and piles of trophies taken in battle. It is now a giant ceremonial chamber, for the rites and ceremonies of the horde.";
	text3 = "There is a ledge at the northwest corner. A handful of slith warriors stands up there, watching you silently.";
	text4 = "But nobody else is here. It is eerily quiet.";
	action = SET_SDF 68 3 1;

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";



//

begintalknode 10;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "One of the slithzerikai on guard sees you. It points and lets out a long, angry hiss.";

begintalknode 11;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Vanderin nods in greeting to you. He is too excited to talk. Part of him is thrilled to be engaged in such a heroic act. And a small but growing part of him wishes desperately that he was anywhere but here.";
	text2 = "When he finally speaks, his voice comes out in a gasp. _Glad you're here. I'm not in charge. This is Solberg's show. Talk to him._";

begintalknode 12;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You try to talk to Vanderin, but he is too distracted. _Not now. Watch for sliths. They could come from anywhere and do anything. Just follow Solberg and do what he says._";

begintalknode 13;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Your act of treachery irritates Solberg. Alas, the old wizard has called forth every scrap of his power. He waves his hand and mutters a single syllable. In one highly impressive moment, you are reduced to ash.";
	code =
		erase_char(30000);
	break;

begintalknode 14;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Solberg closes his eyes and spreads his hands wide. Before, the air around him was hot. In a moment, it drops to freezing. A circle of ice appears at his feet. Balls of blue light fly in all directions, homing in on your enemies.";
	text2 = "Since slithzerikai are not bothered by high heat, cold was a good mode of attack. The old mage seems erratic, but he does know what he is doing here.";
	text3 = "Then Solberg lowers his arms and continues to walk forward. That was a remarkable display of raw power, and it doesn't appear to have drained him at all.";

begintalknode 15;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Solberg reaches the Horned Gate itself. The steel grid is held shut by a variety of powerful enchantments, placed by the most powerful wizards of the Slith Horde. Solberg smiles.";
	text2 = "_You know,_ he says. _I used these wards myself. I placed them on the gates of Skarragath to hold Grah-Hoth in. Perhaps the horde is stealing my tricks, eh?_";
	text3 = "And then he claps his hands together. There is a shockwave and a dull boom. As you rise to your feet and feel your hearing slowly return, you realize that the gates are opening.";
	text4 = "Solberg says, loudly so that you can hear, _These are the tricks of children. Even Ess-Kalyn, for all her tricks, is still a child._ And he walks forward.";
	
begintalknode 16;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Vanderin whispers to you, _This is very impressive. Think of telling the tale of this in the alehouses. Think of how many drinks they will buy us. Think of how impressed the girls will be!_";
	text2 = "He looks down at his bow, still glowing. _Really gives you something to live for, doesn't it?_";

begintalknode 17;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Solberg stands in the circle in the very center of the meeting hall. The place of honor, no doubt, where their chieftains stand. Where Ghavassa-Oss came to view his army, before you killed him.";
	text2 = "The old wizard begins to speak. His voice is soft, but his power carries to the farthest corners of the chamber. _Ess-Kalyn, I am here._";
	text3 = "At first, nothing happens. The warriors watching you from the shadows are still and silent.";
	text4 = "And then the gate to the north opens very slightly. Giant lizards scuttle under it. Warlizards, trained by the shamans of the horde. They rush toward you, hungry for fresh meat.";
	text5 = "The gate behind you closes, trapping you in here. Solberg says, in a whisper, _You might want to stay close to me._";
	
begintalknode 18;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The lizards are dead. Solberg slowly, theatrically shakes his head. Again, he speaks, in his quiet, powerful voice.";
	text2 = "_Ess-Kalyn, the others in your triad are dead. They faced their test. And they failed. Now you are challenged. Do you want your servants to know that you are weak? That you must hide even from a handful of the enemy?_";
	text3 = "And then you hear the response. A voice, coming from nowhere and everywhere, soft, sibilant, and full of contempt. _I am no fool, Solberg. I know why you are here. I will not be tricked._";
	text4 = "_You have no right to fight me. I will slay you with our castoffs!_";
	text5 = "And then the northern gate opens slightly. Several armed humans and drakes come through. As the gate closes behind them, the voice speaks again. _Prove yourselves, outsiders. Prove you deserve the mercy of the horde!_";

begintalknode 19;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The humans and drakes lie dead around you. Solberg smiles once again. _You know, you can kill us. You have the power. Why don't you? Send your best and bravest. They will overwhelm us._";
	text2 = "Vanderin mutters, _Is that really the best plan? Maybe less with the overwhelming?_";
	text3 = "Solberg ignores him. _Come on, Ess-Kalyn. Let the horde see that all of their years of strength, training and bravery only serve to let them become a shield. For you to hide behind._";
	text4 = "And there is a flash of light. A pillar of flame, in the shadowy tunnel above you. Someone up there is very angry.";
	text5 = "Ess-Kalyn speaks again. _Their purpose is to fight! To slay for the horde! I command them, and they obey! Go, heroes of the horde. Destroy them!_";
	text6 = "Once again, the northern gate opens for a short time. Several warriors slip under it and charge you. You look to Solberg and see that he is growing tired. His forehead is covered with sweat. He's having a hard time standing.";

begintalknode 20;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "It is a good thing the slithzerikai aren't as close as you to Solberg. If they were, they would see how his strength is fading. He doesn't speak. He just smiles and looks at the cream of the Slith Horde, dead and dying around him.";
	text2 = "And then the clearing grows brighter, illuminated by a flame to the north. Not a bonfire. A lone slithzerikai, on fire. Ess-Kalyn, called the Manburner, has appeared inside the gate.";
	text3 = "As she walks slowly toward you, servants appear at her side in greasy clouds of smoke. Solberg mutters a word, and two familiars appear next to him. He nods in approval. _I think I finally can create a proper servant._";
	text4 = "Ess-Kalyn says, _You are weakening, old man. You are worn down. Now I will kill you, and all will see my courage. The Impaler and the Shadow will not be missed. The Circle of the Scourge will place all power in me._";
	text5 = "_I hope you have made your peace. Because now ..._ She holds out her hands, and a ball of searing flame, too intense to look at, appears between them. _Now you will burn!_";

begintalknode 21;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Ess-Kalyn is starting to weaken under her foe's constant onslaught. Solberg is getting the worst of it, though. His shield is holding off his enemy's bolts of fire, but it is weakening. Soon it will fade, and one blast will be the end of him.";
	text2 = "_Solberg,_ she hisses. _I have heard of you. You are a worthy foe, at last._ The archmage doesn't respond. All of his concentration goes into controlling the raw power he has unleashed.";
	text3 = "She continues. _Why don't you help me to test my new spell ... See the firebugs I will soon unleash into the cities of Avernum. And then into the forests and plains of the surface!_";
	text4 = "Four imps appear around her. They too are wreathed in flame. They let out loud, hideous cackles. And then the manic little creatures run toward you, leaving trails of fire as they move.";
	text5 = "Solberg gasps, _Keep ... me ... alive. I don't ... need ... much longer._";
	

begintalknode 22;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Solberg has been kept alive for many years by pure magic. Magic that infused every particle of his being. He tapped into all of that energy, letting it pour forth, to fight the slithzerikai. And now it is gone.";
	text2 = "The archmage has taken too much damage to sustain himself. He doesn't just die. He crumbles into powder.";
	text3 = "And then the slithzerikai, seeing that the hero of Avernum has fallen, charge you. You try to run, but they easily overwhelm you. And then, heartened by this success, they charge on toward Fort Duvno ...";
	code =
		erase_char(30000);
	break;
	
begintalknode 23;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Ess-Kalyn lets out a long, agonized scream. The damage she has sustained is too much for her. Wizards normally hesitate to summon up such power because of the horrible consequences of failing to control it.";
	text2 = "At last, the Manburner is too weak to control the energy she has called forth. The tendrils of flame that surround her begin to lash about wildly. And then they consume her.";
	text3 = "As she shrieks, the fire turns her into dust. It starts with her feet and hands. Then it crawls slowly up her limbs. Then, as slithzerikai warriors watch from the shadows, she is destroyed.";
	text4 = "Her servants, both those who were present and those who were forming, fade away. Freed of her control, they don't linger.";
	text5 = "The last of the triad, the Shadow, the Impaler, and the Manburner, is gone.";

begintalknode 24;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You turn and see that Solberg has fallen to his knees. You rush to help him, but he waves you back. _No. I have ... I gave all. All for Avernum. And now ... Safe. The enemy is ... gone. Was my last ... wish._";
	text2 = "Solberg has been kept alive for many years by pure magic. Magic that infused every particle of his being. He tapped into all of that energy, letting it pour forth, to fight the slithzerikai. And now it is gone.";
	text3 = "He slowly lies down on the ground. His eyes close. He smiles. And then, in a moment, he is gone. The power that sustains him flees. He turns to dust, a mass of powder in the shape of the archmage. And then a draft begins to blow it away.";
	text4 = "Archmage Solberg, hero of Avernum, fearless defender of your homeland since the earliest days, is gone. Even if Avernum survives, its path forward will be a darker, more perilous journey without him.";
	text5 = "You hear the grinding of metal on stone, coming from the north and south. Now that Ess-Kalyn is gone, her spells holding the gates closed have faded. You can return to the Castle and report your victory.";
	code =
		toggle_quest(110,3);
		erase_char(7364);
		erase_char(7397);
		erase_char(7398);
	break;
	
begintalknode 25;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Vanderin lets out a long sigh of relief. _Well. We survived. Didn't expect that. Now, if you'll excuse me, I'm going to get out of here before the sliths regain their senses._";
	text2 = "And then he, in a perhaps unheroic way, runs for his life.";
	code =
		erase_char(7365);
	break;

begintalknode 26;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Solberg looks irritated. _Not now. We need to move forward quickly, while my power holds. Stay close to me and protect me from the pests._";

begintalknode 27;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Vanderin is, to all appearances, mortally wounded. He falls to the ground and gasps, _Avenge me ... Ghhhahhhhhh ..._ shudders, and closes his eyes.";
	text2 = "A tragic end for one who came from a foreign land to help your people. And all he asked for in return was great fame and wealth.";

begintalknode 28;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The slithzerikai on the ledge are esteemed members of the Slith Horde. They are covered with intricate webs of scars and painted designs. Trinkets and battle trophies hang from their necks and belts.";
	text2 = "They are here to observe and record the battle, to bear witness to the destruction of Solberg. For now, they are content to watch. They don't respond to you. They remain silent.";
	text3 = "They are stunned by what they have seen. They are on their knees, mourning the loss of Ess-Kalyn. For now, they seem content to avoid battle with you. These are the ones who will spread the news of your victory.";
	code =
		if (gf(170,8) == 0)
			rs(3);
			else rs(2);
	break;

begintalknode 29;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "You have caught up with Solberg. He is standing here, out in the open, looking up at the Horned Gate. He is making no effort to stay hidden. Surely the guard have seen him, but, suspecting a trap, they haven't been drawn out.";
	text2 = "The air around Solberg feels different. Now that he is free of the fort and able to focus, everything near him seems ... hot. Electric. Powerful. He stands upright, held and sustained by the magic at his command.";
	text3 = "He starts to speak, and, when he does, his voice has changed too. Deep and hollow. _You are here. You are ready, I hope. I cannot control this much power forever._";

begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "What are you doing? What has changed?";
	text1 = "_I am summoning up all the power at my disposal. All the power. All the years of focus and study._ He gives a cold smile. _All my tricks._";

begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "What do I need to do?";
	text1 = "He doesn't turn to look at you. Tiny droplets of sweat appear on his gray, waxy skin. _Follow me. Keep me alive. I will do ... the work._";

begintalknode 33;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I am not ready yet.";
	text1 = "Solberg grimaces. _Go. Do what you need to do. Hurry! There is little time left. We only get one chance._";
	action = END_TALK;

begintalknode 34;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I am ready.";
	text1 = "Solberg nods. He looks over at Vanderin and mutters a brief spell. Vanderin's bow begins to glow. A fiery nimbus surrounds his arrows. _Wow!_ he says.";
	text2 = "Then he looks at you. _You will have to sustain yourself. Be sure to stay close to me, or I won't be able to protect you. Stay alive. Follow me. Now! Now the gate will open!_";
	text3 = "He turns and begins to walk up the hill.";
	action = END_TALK;
	code =
		sf(68,6,2);
	break;

	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 51;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 54;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 55;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 56;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 57;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 58;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 59;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 60;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 61;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 62;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 63;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 64;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

////

begintalknode 299;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		