// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(150,0) == 0;
	question = "special";
	text1 = "You are at the western entrance to what is now called the Portal Caldera. From here, you have an excellent view of the tumult to the south.";
	text2 = "A river runs into this enormous cavern from the north and flows into the volcanic region of basalt to the south. There, it pours into lava-filled pits, filling the cavern with sulfurous steam.";
	text3 = "Far to the southeast, you can make out a gleaming pillar of light, rising up to the rock ceiling above. That marks your destination: the Great Portal. You can feel it more than you see it. The energy it puts off sets your teeth on edge.";
	text4 = "The cavern is painfully hot and humid, and moss and fungus grow on any surface that stays still for even a minute. Which makes life difficult for the many refugees and soldiers out here, all waiting for a chance to use the portal.";
	action = SET_SDF 150 0 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(150,1) == 0;
	question = "special";
	text1 = "How interesting. There are the remains of an old crypt or shrine down here. It's very quiet, and the cool air provides a nice respite from the humidity of the caldera.";
	text2 = "As you look around, you think that you can hear giggling from somewhere in the shadows. Someone or something is down here.";
	action = SET_SDF 150 1 1;
	code =
		if (gf(164,3) != 2)
			rs(2);
	break;
	


begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This shop has two large slith guards, who stoically watch the door and scare off brigands and desperate refugees.";
	text2 = "They are very quiet. If the heat and sound from the portal bothers them, they are taking pains not to show it.";

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There are several miserable soldiers watching the road. The heat and the humming and static from the portal prevent sound sleep, relaxation, and happiness.";
	text2 = "Now that the Great Portal has been damaged, things are only worse. Panicking refugees have been added to their list of troubles.";
	text3 = "You try to speak with them, but they mainly want to complain. Eventually, they suggest that you try to get information from Captain Skye.";
	code =
		if (gf(170,1) < 12)
			rs(2);
	break;

begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "These barracks have been provided by the army to give the refugees a safe place to stay and rest while waiting to use the Great Portal. They sit here, hungry and sweltering in the heat. The radiation from the portal puts them all on edge.";
	text2 = "They also have very short tempers, and all they want to talk about is the difficulties of life here. You speak with them briefly, and then pull yourself away.";

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

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

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


//

begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Hossni";
	text1 = "This trading post is packed with a remarkable variety of items, purchased from the passing refugees. Weapons and armor. Curios and family heirlooms. Tools and junk. All heaped against the wall, waiting for buyers.";
	text2 = "The store is run by slithzerikai. Only this reptilian race is comfortable in the steam room that is the Portal Caldera. The proprietor walks up to greet you.";
	text3 = "_Ahssss ... A soldier. A buyer. We have many sellersss. Few buyersss. I am Hossni. I hope we can trade._";
	text5 = "Hossni stands politely off to one side, perfectly comfortable in the still, muggy air. _Let me know if you wish to buy. Low pricesss for warriorsss of Avernum._";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "How has business been?";
	text1 = "_Ahssss. Businessss is all right, but too many sellersss and too few buyersss._";
	text2 = "_Many refugeesss come. Come to use the portal, or pass by looking for new fortunesss. And they need to sell thingsss. Sell to me. And I sell to army._";
	text3 = "_Isss difficult, so difficult, with Portal gone. Refugeesss more desperate. More dangerousss. Am glad soldiersss are still here. Would be at risk otherwise._";
	code =
		if (gf(170,1) < 12)
			rs(3);
			else rs(2);
	break;
	
begintalknode 12;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "Why do the refugees need to sell so much?";
	text1 = "_Isss one thing having heavy item in home. Another to carry it acrossss Avernum. Better to sell heavy thingsss and get money. Money needed to buy food._";
	text2 = "_Also, lucky onesss are only allowed to take so much into Great Portal. So might asss well sell the thingsss to me._";
	code =
		if (gf(170,1) >= 12)
			 rs(2);
	break;
	
begintalknode 13;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "And you sell things to the army?";
	text1 = "_Yessss. Those who go north to fight the Slith Horde, they often lack suppliesss. Thingsss are difficult everywhere. So they buy from me, for reasonable pricesss. We help Avernum as we can._";

begintalknode 14;
	state = 11;
	nextstate = -1;
	condition = gf(170,1) >= 12;
	question = "You think you're in danger?";
	text1 = "_Portal is gone, and all are scared. Think they will starve. And they may be right. And some blame all slithzerikai, not just the horde. So soon comes the mobs._";
	text2 = "_I have guardsss from my clan, but, one day, they will not be enough._";

begintalknode 15;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Let me sort through your wares.";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Hossni's Shop",
		  "You set to sorting through all of the junk in this shop, looking for anything useful.",
		  39,1,0);	
	break;


begintalknode 16;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "I'd like to sell something.";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;

begintalknode 17;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "I'll be going now.";
	text1 = "_Then we wish you well, warrior of Avernum._";
	action = END_TALK;

// Captain Skye

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "There is a large camp of Avernite soldiers here, watching the road and keeping order. Between the heat and the energy constantly put off by the portal, it is a miserable post.";
	text2 = "The ranking officer, sweat dripping off of her face, walks up to greet you. _Greetings, soldier. I am Captain Skye. Always good to get reinforcements out here. It's a ... a ..._";
	text3 = "She looks over her shoulder at the portal and shakes her head. _Well, you'll figure it out soon enough._";
	text5 = "Captain Skye takes a towel and dips it into the water. Then she returns to the camp, sits down, and rubs her face and shoulders with it. Then she looks up at you. _Need anything else?_";
	action = INTRO;

begintalknode 31;
	state = 30;
	nextstate = 31;
	condition = 1;
	question = "Tell me about this area.";
	text1 = "_Well, you've seen the worst of it. The heat. The humming. And it only gets worse. The sound from the portal, it even gets into your dreams._";
	text2 = "_Plus, the wreckage of the portal is attracting all sorts of infernal creatures. Get closer, and you'll see what I mean._";
	text3 = "_As for the area, the Great Cave is west. The Honeycomb is north. And the road up to the Eastern Gallery heads east._";
	code =
		if (gf(170,1) < 12)
			rs(2);
	break;
	
begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Any problems with the refugees?";
	text1 = "_Not yet. As long as they have the hope of using the portal and getting to the surface, they're pretty manageable. They come, they get their number in the lottery, and they wait._";
	text3 = "_Just don't ask. Few of them camp near here anymore, but a lot pass through. They're getting scared, and they're getting desperate._";
	text4 = "_The Slith Horde doesn't have to kill us. If the portal isn't repaired soon, hunger and madness will do the job._";
	action = DEP_ON_SDF 170 1 10;
	
begintalknode 33;
	state = 30;
	nextstate = 32;
	condition = gf(150,2) < 2 && gf(164,3) < 2;
	question = "You need any assistance?";
	text1 = "_We do, actually. It's the Portal, you see. The humming and buzzing drives us to the edge of madness, but it attracts certain ... things._";
	text2 = "_Some refugees have been claiming they saw something, some demon creature, hiding in the wastes to the south. It laughed at them, that's right, it laughed, and they ran._";
	text3 = "_If you go down there, see if there's any truth to the story. And, if so, drive the creature away._";
	code = 
		set_flag(150,2,1);
		toggle_quest(87,1);
	break;
	
begintalknode 34;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "Tell me about the Honeycomb.";
	text1 = "_It's a tangle of tunnels. It's pretty much impossible to find your way around in there. A hideout for bandits and scum since the earliest days of Avernum._";
	text2 = "_I'll tell you what we tell all the refugees. Just stay out of it._";

begintalknode 35;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "How is the road north?";
	text1 = "_Dangerous. Unguarded. And then you get to the Eastern Gallery, full of chitrachs and at the mercy of the Slith Horde._";
	text2 = "_As much as we hate being here, being up north is worse._";
 
begintalknode 36;
	state = 30;
	nextstate = -1;
	condition = gf(164,3) == 2;
	question = "I found the demon and drove it away.";
	text1 = "Captain Skye snorts. _That's right, you did. It ran through here, screaming and laughing all the way, terrifying a bunch of refugees. And then it ran into the tunnel north of here._";
	text2 = "_Now, in addition to everything else, we hear it laughing back there. We need you to rid us of it!_";

begintalknode 37;
	state = 32;
	nextstate = -1;
	condition = 1;
	question = "Any advice on where to look?";
	text1 = "_The refugees, who, I remind you, were probably half mad, all said they saw it at a pile of old, bleached bones. Playing with them._";

begintalknode 38;
	state = 32;
	nextstate = -1;
	condition = 1;
	question = "And it didn't attack them?";
	text1 = "_No. But, then again, it might have attacked some others. And those are the ones who were never heard from again._";

begintalknode 39;
	state = 30;
	nextstate = -1;
	condition = gf(150,2) == 1 && gf(164,3) >= 3;
	question = "I killed that demon.";
	text1 = "She nods. _We could tell. The laughing stopped. We appreciate it, believe me. Here's something for you._ She gives you a ring. _We lost an archer, but this got left behind. We don't need it._";
	text2 = "_Thanks again. At least someone's getting something done out here._";
	code = 
		set_flag(150,2,2);
		toggle_quest(87,3);
		award_party_xp(400,15);
		reward_give(445);
	break;	
	
begintalknode 40;
	state = 30;
	nextstate = -1;
	condition = gf(150,2) > 1;
	question = "Need any more help?";
	text1 = "_Nothing that justifies keeping you from your mission. Don't worry about it. Unless you can cool things down a bit._ She chuckles. Then she walks over to the water and dips her head into it.";
	action = END_TALK;

	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Murdock";
	text1 = "There is only one refugee left in these barracks. He is an old man with thinning hair. He sits on a pallet, his back against the wall. He barely has enough energy to move.";
	text2 = "He looks up at you. _What brings you here? Soldiers like you got better things to do than talk to old Murdock, I gather._";
	text5 = "Murdock looks up at you. _What else you need? I don't want to waste your time here._";
	action = INTRO;

begintalknode 51;
	state = 50;
	nextstate = 51;
	condition = 1;
	question = "What are you doing here?";
	text1 = "_I'm waiting._";
	
begintalknode 52;
	state = 51;
	nextstate = 52;
	condition = 1;
	question = "Waiting for what?";
	text1 = "_I'm waiting for the portal to open up again. I was near to being able to use it. If it opens, I'll be here._";
	
begintalknode 53;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "You may have quite a wait.";
	text1 = "_Then I'll wait. Don't think there's a better place to be in Avernum. Not these days._";
	
begintalknode 54;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "Why were you about to use the portal?";
	text1 = "_Family got a lucky draw on the lottery. We were close. So close. Then it all went wrong._";
	
begintalknode 55;
	state = 50;
	nextstate = 53;
	condition = 1;
	question = "Are you doing all right?";
	text1 = "_I'm hungry. But who isn't? My whole family was hungry. I just choose to be hungry here._";
	
begintalknode 56;
	state = 53;
	nextstate = -1;
	condition = 1;
	question = "Do you need some food?";
	text1 = "He shakes his head. _I'm not going to go out of this world begging. You don't worry. The soldiers will look after me._";
	text2 = "_I've lived my whole life down here. Not my first time short on food. Won't be the last. I hope._";
	
begintalknode 57;
	state = 53;
	nextstate = -1;
	condition = 1;
	question = "What happened to your family?";
	text1 = "_I sent them on. They went northeast, looking for a place to work and find food. I was a drag on them. So I slipped away._";
	text2 = "He sighs. _It was hard. But Avernum's got harder choices ahead._";
	
begintalknode 58;
	state = 50;
	nextstate = -1;
	condition = get_quest_status(175) == 2;
	question = "Your family put a posting on a job board about you.";
	text1 = "_Did they? Not what I want. They probably offered a reward too. They should have just let me slip away._";
	text2 = "_Well, what's done is done. Tell them I'm all right. And to forget about me. Look after the young ones, not the old. And please, don't take too much from them._";
	text3 = "_I'm a bit tired. Please leave me._ He closes his eyes and keeps still, trying to conserve strength.";
	action = END_TALK;
	code =
		sf(150,3,1);
	break;

begintalknode 59;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "Good day to you.";
	text1 = "_Safe travels. Just leave me be. I'll be fine._ He closes his eyes and keeps still, trying to conserve strength.";
	action = END_TALK;

////

begintalknode 299;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Unfortunately, the Portal Caldera, in the heart of Avernum, was a poor place to begin your life of crime. Most of the soldiers have had to travel northeast to fight the slithzerikai, but enough remain down here to hunt you down.";
	text2 = "You are jailed in Fort Remote. By the time you are able to get free, the multiple disasters that afflict Avernum have doomed you and all around you.";	
	code =
		erase_char(30000);
	break;
