// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(111,1) == 0;
	question = "special";
	text1 = "You are close to the southeast corner of the Eastern Gallery. Unlike the rest of the gallery, which has a fair amount of vegetation, this area is bare. What few plants survive are stunted and unhealthy.";
	text2 = "There is a strange feeling in the air, the tingle of powerful magic. The sort of residual aura that scares away wildlife and makes your skin tingle.";
	text3 = "For once, the explanation is no mystery. You are near the ruins of Fort Avernum. Once, when Avernum was the Empire's prison colony, this is where the newly exiled were teleported. There was a huge portal here, made by the Empire.";
	text4 = "New arrivals haven't appeared here for many years. The Great Portal long ago replaced it. However, the ruins of the fort are not entirely abandoned. You can see a wisp of smoke rising from within. Someone has settled here.";
	action = SET_SDF 111 1 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(111,2) == 0 && gf(111,5) == 0;
	question = "special";
	text1 = "This is the main entrance to Fort Avernum. You try to enter, only to find that the front gates are closed. Nobody is here to greet you.";
	text2 = "You listen carefully. You think you can hear movement and cooking fires within. However, nobody answers your cries. Very odd.";
	action = SET_SDF 111 2 1;

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = get_sdf(111,3) == 0;
	question = "special";
	text1 = "This cavern was the emergency exit from Fort Avernum. It also served as a trash pit. Many layers of trash fill the cavern, left by succeeding generations of Avernites.";
	text2 = "The garbage is old, but there are signs of recent construction. The door in the north wall is new. It's massive and sturdy, bound by thick bands of steel. Whoever is settled here, they want their privacy.";
	action = SET_SDF 111 3 1;

begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = get_sdf(111,4) == 0;
	question = "special";
	text1 = "You enter the portal chamber, the arrival point for so many Avernites. Amazingly, the portal remains. It is faint now, its power drained, but you can still see it in the middle of the chamber.";
	text2 = "Something is standing behind it, drawing its power. Something huge, humanoid, and reptilian. Unguarded magic tends to draw pests and parasites. Sometimes very powerful ones.";
	text3 = "It is busy feeding and has not noticed you. This might change at any moment.";
	action = SET_SDF 111 4 1;

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = get_sdf(111,5) == 0;
	question = "special";
	text1 = "Your approach and entry did not go unnoticed. Several human warriors approach you when you enter this hallway.";
	text2 = "They are clearly old campaigners. Their hair is graying and thin, and they bear the scars and burns from many a battle. They wear no symbols of allegiance, and their equipment is too good for them to be ordinary brigands.";
	text3 = "You wave, expecting some sort of a greeting. In response, one of them points at you and shouts, _Raid! The worms are here! Attack!_";
	action = SET_SDF 111 5 1;
	code =
		activate_hidden_group(25);
		alert_char(11993);
		alert_char(11994);
		alert_char(11995);
		set_level(11994,20);
		set_level(11995,20);
		set_name(11994,"Old Soldier");
		set_name(11995,"Old Soldier");
		
		alert_char(11996);
		alert_char(11997);
	break;
	



begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You have discovered Loyalist Stovall's spellbook. It bears the wear of many years of travel. Stovall spent most of his life in hiding, evading countless Empire assassins and bounty hunters.";
	text2 = "You gain a fair amount of general magical knowledge. You learn tips for more efficiently summoning lightning or calling allies to your aid. (Your skill with the spells Lightning Spray and Summon Aid increase.)";
	text3 = "You browse through the book a bit more, but you don't learn anything new.";
	text4 = "You browse through the book, but you can't understand any of it. You don't know enough magical lore. (Improve your Arcane Lore skill to understand books like these.)";
	code =
		if (gf(111,10) == 0) {
			rs(3);
			if (get_stat_total(13) < 8)
				rs(2);
				else {
					rs(4);
					sf(111,10,1);
					alter_stat(30000,50,1);
					alter_stat(30000,54,1);
					}
			}
			else {
				rs(1); rs(2); rs(4);
				}
	break;

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

begintalknode 10; // portal
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You get a good look at the portal, wondering if it could be helpful for Avernum's current situation. It is very faint now, but it could conceivably be restored.";
	text2 = "However, even with the attention of skilled mages, it is simply too small to help with Avernum's crisis. That is even assuming that it could be linked with the surface again.";
	text3 = "Unfortunate. Yet another disappointment.";

begintalknode 11; // scepter
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You try to inspect this body, but the demon roars and sends a jet of flame at you. You're unable to get close.";
	text2 = "You inspect this body. It is a dead mage. Her robe bears the insignia of the Avernite army. It looks like the demon ambushed her from behind. She was probably dead before she hit the ground.";
	text3 = "Something about the magic in the air here has kept her body entirely preserved. The blood is still wet. It is very unsettling.";
	text4 = "You respectfully search her. There is something interesting under the body: a scepter. It is about a foot long, intricately carved from a single piece of onyx. When you move it around, the portal seems to sway slightly to match the movement.";
	code =
		clear_strings();
		if (gf(111,8) == 0)
			as(1);
			else {
				as(2); 
				as(3);
				if (gf(111,9) == 0) {
					set_spec_item(8,1);
					as(4);
					sf(111,9,1);
					}
				}
	break;
	
begintalknode 12;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You get closer to the massive creature standing by the portal. It is a demon. It stands, arms outstretched, drawing a flow of blue energy out of the portal.";
	text2 = "Then it drops its arms. The flow of energy disappears. It looks down at you.";
	text3 = "_Hurrr ... Hurrrrr ... Little mortal. Little ball of flesh. Too much energy. Now I hunger for meat! Die, little weakling!_";

begintalknode 13;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The demon starts to glow slightly. It has consumed a great deal of energy from the portal without digesting it properly. So it decides to shed a bit of it.";
	text2 = "It points at one of you and releases some portal energy. You fade and reappear elsewhere.";

begintalknode 14;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Emergency Exit.";
	text3 = "  Disposal.";

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

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

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

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

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

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

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

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

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

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

//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "You approach a band of armed humans at the far end of the courtyard, walking around the pit in the middle. Far below, you can see the flicker of what remains of the portal.";
	text2 = "One of them steps forward to confront you. He wears the robes of a mage, but there is nothing else to mark him as a commander here. Still, clearly, he speaks for them.";
	text3 = "_I am Loyalist Stovall,_ he says. _We knew worms would sneak in here one day. Wetzel was weak, but he was the best we had to work with. If he still lives, he will pay._";

begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "You're not the first man here to call me a worm. Why?";
	text1 = "_That is what we call the Avernites, because that is all you are._ Odd. His skin is as pale as that of any Avernite.";

begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Why are you hiding here?";
	text1 = "_Because you worms avoid this place. You fear the magic, and the bad memories. This place represents the Empire's dominion over you, so you stay away. Cowards._";

begintalknode 33;
	state = 30;
	nextstate = 31;
	condition = 1;
	question = "You are a loyalist? What does that mean?";
	text1 = "_We are what is left of the Darkside Loyalists. We are the seed from which our great army will grow!_";
	text2 = "Darkside Loyalists? When you were still young, they assassinated Empress Prazac, leader of the Empire. But then they were hunted to extinction, or so you thought.";

begintalknode 34;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "I thought the Darkside Loyalists were wiped out.";
	text1 = "_Most believe it. Their error profits us. That is why you will never leave this ruin alive._";

begintalknode 35;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "Are you the last of the Darkside Loyalists?";
	text1 = "_No! We have a mighty force, but ..._ One of his lieutenants tugs his arm. He says, _Perhaps I will restrain my boasting. You never know who might be listening._";

begintalknode 36;
	state = 31;
	nextstate = 32;
	condition = 1;
	question = "What on Earth were you trying to achieve here?";
	text1 = "_We Loyalists have two goals. We will destroy Avernum, and we will bring the Empire back to its true purity and glory!_";

begintalknode 37;
	state = 32;
	nextstate = 33;
	condition = 1;
	question = "What does that have to do with Silvar?";
	text1 = "_Every day the Slith Horde advances, we are that much closer to the death of Avernum. The front here teeters on the edge of chaos! So little, a riot, the destruction of a bridge, the correct assassination, would ..._";
	text2 = "One of the warriors clears his throat. _I say too much. It is a bad habit. It is best that we conclude this ugly business._";

begintalknode 38;
	state = 33;
	nextstate = -1;
	condition = 1;
	question = "All right. I'll be going then. Nice meeting you.";
	text1 = "_No ... You have heard too much. That I, perhaps, should not have said what I said is immaterial. You must now die! For the glory of the Empire!_ They charge.";
	action= END_TALK;
	
begintalknode 39;
	state = 33;
	nextstate = -1;
	condition = 1;
	question = "Yes! This business will conclude! With your death! (Attack.)";
	text1 = "Stovall shouts, _You are incorrect! There will be death now, but it is in fact you who will be dying, after you are destroyed, by us! Attack! For the glory of the Empire!_ They charge.";
	action= END_TALK;

//

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 = "";
		