// TOWN DIALOGUE SCRIPT
// 	Town 9: Homeland Guardpost

// This is the dialogue for this town.
// You can use states numbered from 1 to 99.

// Nodes
// 1-11: Kass
// 12-20: Ethass
// 21-33: Pithoss
// 34-40: Phaedra at the chessboard
// 41-3: Machrone while playing Phaedra at chess
// 44-7: Machrone after playing Phaedra at chess
// 48: Pithoss
// 49: Phaedra at the chessboard
// 50-52: unused
// 53-5: Phaedra at the gate
// 56-9: Kass
// 60-2: the Boat Guard
// 63-8: Kass
// 69-78: Silthokh

begintalkscript;

variables;

// *** Kass ***
// Kass's dialogue consists of nodes 1-11 and 56-9 and 63-7

begintalknode 1;
	state = -1;
	personality = 90;
	nextstate = 1;
	condition = 1;
	question = "Kass";
	text1 = "Kass stands before you staring at the wreckage of what was once a path away from this guardpost. _Greetings,_ he says. _I must congratulate you on your work so far. You did an excellent job clearing the way to that door._";
	text2 = "He smiles briefly. _I must also welcome you to the lands beyond the gate._";
	text5 = "_What else do you wish to know?_ Kass asks.";
	action = INTRO;
	
begintalknode 2;
	state = 1;
	personality = 90;
	nextstate = 2;
	condition = 1;
	question = "What is this place?";
	text1 = "_It is a guardpost. At one time, sliths from the homeland manned this post guarding the steel doors. I do not understand why they chose to do so, because anything powerful enough to open those doors would have torn an armed guard apart._";
	text2 = "_The post has long since been abandoned, however._";
	
begintalknode 3;
	state = 2;
	personality = 90;
	nextstate = 3;
	condition = 1;
	question = "Abandoned?";
	text1 = "_The walls are cracked and rotting. The mushroom fields are untended and dying. This area has been abandoned for decades._";

begintalknode 4;
	state = 3;
	personality = 90;
	nextstate = 1;
	condition = 1;
	question = "Where did they go?";
	text1 = "_I do not know. We have found no sign of their intentions or motivations anywhere. The old path out of the guardpost was to the east from here, but it has collapsed. We don't know whether that was before or after this place was abandoned, though._";
	text2 = "He adds, _They left behind some writing that the Prophet has been attempting to translate, but he has been unsuccessful so far._";
	text3 = "An ancient text? You've learned enough of the Bahssikavan language that if this dialect is similar, you might be able to help him read it.";
	code =
	if (get_flag(9,16) == 2)
		remove_string(2);
	if (get_flag(250,2) < 2)
		remove_string(3);
	if (get_flag(9,16) == 0)
		set_flag(9,16,1);
break;
	
begintalknode 5;
	state = 3;
	personality = 90;
	nextstate = 3;
	condition = get_flag(6,21) == 1;
	question = "Maybe they left because of the cavequake. (Explain what the ghost in Ancient Bahssikava told you.)";
	text1 = "Kass thinks for a long moment. _The Prophet makes occasional reference to the 'Cataclysm,' but I never asked him what it was. This may be what he meant. I shall ask him._";
	text2 = "He thinks more. _If I remember his words correctly, he said that Cataclysm happened more than sixty years ago. If that was the cause for abandoning the guardpost, it has been vacant for a long time._";
	action = SET_SDF 6 21 2;
	
begintalknode 6;
	state = 1;
	personality = 90;
	nextstate = 1;
	condition = 1;
	question = "Where is Legare?";
	text1 = "_The Prophet is communing with the Goddess and planning the next stage of our journey. He is in the offices to the north of here._ Kass indicates a building to the north.";
	text2 = "_He is also attempting to translate some texts that he discovered. He hopes that those texts will shed some light on the question of where the inhabitants of this guardpost went._";
	text3 = "Kass adds, _He will be unavailable for a while. In the meantime, you should still speak to me to get your assignments._";
	code =
	if (get_flag(9,16) > 1)
		remove_string(2);
	if (get_flag(9,16) == 0)
		set_flag(9,16,1);
break;

begintalknode 7;
	state = 1;
	personality = 90;
	nextstate = 20;
	condition = (get_flag(12,6) == 1) && (get_flag(9,11) == 0) && (get_flag(9,12) == 0);
	question = "I found out where the river leads. It leads back into Bahssikava.";
	text1 = "_It is as I suspected,_ Kass says, nodding. _That would be a dead end. The Bahssikavans surely did not have a way back, or else they would not have stayed in exile for so long. We cannot travel south along the river._";
	text2 = "_We have also had little luck clearing this blocked path out of the guardpost. There are tons upon tons of rock in our way. We cannot leave to the east._";
	text3 = "_However, Phaedra has returned with good news. The path to the north leads deeper into the homeland. Our way is obvious, then: we head north!_";
	text4 = "_I have already told the others here to begin making ready. We will leave shortly._";
	code =
	set_flag(9,10,1);
	toggle_quest(2,0);
break;

begintalknode 8;
	state = 20;
	personality = 90;
	nextstate = -1;
	condition = (get_flag(12,7) == 0);
	question = "What should I do now?";
	text1 = "_We have had little luck clearing this blocked path out of the guardpost. There are tons upon tons of rock in our way. We cannot leave to the east._";
	text2 = "_However, Phaedra has returned with good news. The path to the north leads deeper into the homeland. Our way is obvious, then: we head north!_";
	text3 = "_I have already told the others here to begin making ready. We will leave shortly. In the meantime, you should head up north with Phaedra. She said that she saw something that she thought was questionable. Talk to her. She'll fill you in._";
	code =
	set_flag(9,11,1);
	toggle_quest(3,1);
	end();
break;

begintalknode 9;
	state = 20;
	personality = 90;
	nextstate = 21;
	condition = (get_flag(12,7) == 1);
	question = "There is one other thing. We found a ghost. (Describe the Bahssikavan and what he told you.)";
	text1 = "_That is very interesting,_ Kass murmurs, his eyes unfocusing for a moment as he thinks. _You should help them, because they sound in dire need. However, it is in the opposite direction as our journey._";
	text2 = "He decides. _Help them, but if at any time you feel that you cannot continue, you may come back to me and tell me that you wish to head north. The Bahssikavans need help, though, so do not give up easily._";

begintalknode 10;
	state = 21;
	personality = 90;
	nextstate = -1;
	condition = 1;
	question = "All right. Is there anything else?";
	text1 = "_Take Phaedra with you. She should be useful in a pinch. And when you have resolved the situation, find me again. I will here, waiting._";
	code =
	set_flag(9,12,1);
	toggle_quest(4,1);
	end();
break;

begintalknode 11;
	state = 1;
	personality = 90;
	nextstate = 28;
	condition = (get_flag(15,21) == 0) && (get_flag(9,12) == 1) && (get_flag(9,11) == 0);
	question = "I'm done in the south with the ghosts in Bahssikava. I want to head north.";
	text1 = "_Are you completely sure? The Bahssikavans sounded desperately in need._";

// *** Ethass ***
// Ethass's dialogue consists of nodes 12-20

begintalknode 12;
	state = -1;
	personality = 91;
	nextstate = 6;
	condition = 1;
	question = "Ethass";
	text1 = "At first you are surprised to see someone at the desk here. Then you realize that this is not one of the legendary homeland sliths, but a simple fellow traveler, one who merely got here before you.";
	text2 = "She smiles at you pleasantly. _Hi, there._";
	text5 = "_What else would you like to know?_ Ethass asks, smiling.";
	action = INTRO;
	
begintalknode 13;
	state = 6;
	personality = 91;
	nextstate = 6;
	condition = 1;
	question = "Who are you?";
	text1 = "_My name is Ethass. I'm from Gnass. I was the librarian at the Temple of the Goddess before it was destroyed. Now I'm Kass's personal assistant._";
	text3 = "_Don't you remember me? I'm Ethass. We met when I was the librarian at the Temple of the Goddess. Now I'm Kass's personal assistant._";
	action = DEP_ON_SDF 0 22 0;
	
begintalknode 14;
	state = 6;
	personality = 91;
	nextstate = -1;
	condition = 1;
	question = "Do you know where Kass is?";
	text1 = "_Yes,_ she replies. _He's down by the east gate. Cross the river and head east. You'll find him._";

begintalknode 15;
	state = 6;
	personality = 91;
	nextstate = 7;
	condition = 1;
	question = "What is this building?";
	text1 = "_It was the offices of the two commanding officers for this guardpost, we think. Now Lega -- err -- the Prophet and Pithoss have taken it over._";

begintalknode 16;
	state = 7;
	personality = 91;
	nextstate = 6;
	condition = 1;
	question = "Pithoss? Who's that?";
	text1 = "_He's one of Leg -- I mean, the Prophet's chief assistants. I'm surprised you haven't heard of him yet. I suppose he never left the Prophet's side while the Prophet was sick, though, so you must have only dealt with Kass._";
	text2 = "_Pithoss and I were the ones who first saw Le -- I mean, the Prophet -- when he came to Gnass. We were neighbors on the outskirts of Gnass, and he came stumbling up to Pithoss's doorstep while the two of us were talking._";
	text3 = "_We listened as his story came pouring out, and it was Pithoss who first called him 'the Prophet.' That's why it's so hard for me to remember. I knew him when he was just Legare. Pithoss told him that he should go to Gnass and tell everyone his story._"; 
	text4 = "_Yes, indeed. Little did we know what that would eventually lead to. Well, what's done is done. Pithoss has been with the Prophet since the beginning, though._";

begintalknode 17;
	state = 6;
	personality = 91;
	nextstate = 6;
	condition = get_flag(0,22) == 1;
	question = "Do you still doubt that Legare is a prophet, now that he has opened the doors?";
	text1 = "She looks around furtively to make sure no one is in the room to hear her. _A little. He showed power, all right, but did he show godly power? That display of fireworks that we saw could've just been him casting magical spells. No goddess necessary._";
	text2 = "_I don't think it matters, though. We're here, aren't we? Who cares if the Goddess is real?_";

begintalknode 18;
	state = 7;
	personality = 91;
	nextstate = 6;
	condition = 1;
	question = "Can I go in and see Legare?";
	text1 = "_No,_ Ethass says. _He's not seeing visitors right now. You'll still have to talk to Kass to get your orders._";

begintalknode 19;
	state = 6;
	personality = 91;
	nextstate = 6;
	condition = (get_flag(250,2) >= 2) && (get_flag(9,16) == 1);
	question = "I heard that Legare was trying to translate an ancient text. I think I can help him.";
	text1 = "_Really? Well, you're welcome to knock on his door, then. He might talk to you._";

begintalknode 20;
	state = 6;
	personality = 91;
	nextstate = 6;
	condition = (get_flag(9,13) >= 2) && (get_flag(9,14) == 0);
	question = "I want to talk to Legare about whether he's been in Ancient Bahssikava before.";
	text1 = "_Ah, well, you're welcome to knock on his door. He might talk to you._";
	
// *** Pithoss ***
// Pithoss's dialogue consists of nodes 21-33 and 48

begintalknode 21;
	state = -1;
	personality = 93;
	nextstate = 10;
	condition = 1;
	question = "Pithoss";
	text1 = "Here stands the mightiest slith warrior you have ever seen. He is almost as tall as Legare, and he is as thickly built as even the bulkiest human. He keeps a two-tined spear strapped across his back, carrying it as if it weighs nothing.";
	text2 = "_Hello, adventurersss,_ he says, his voice hissing sibilantly.";
	text3 = "_Hello, adventurer,_ he says, his voice hissing sibilantly.";
	text5 = "_What elssse do you wisssh to know?_ Pithoss asks.";
	action = INTRO;
	code =
	if (party_size() > 1)
		remove_string(3);
	else
		remove_string(2);
break;

begintalknode 22;
	state = 10;
	personality = 93;
	nextstate = 11;
	condition = 1;
	question = "Who are you?";
	text1 = "_My name is Pithoss. I am one of Legare's chief assistants._";
	
begintalknode 23;
	state = 11;
	personality = 93;
	nextstate = 12;
	condition = 1;
	question = "Where are you from?";
	text1 = "_Gnass. I, with Ethass, was one of the first to greet Legare when he arrived._";

begintalknode 24;
	state = 12;
	personality = 93;
	nextstate = 13;
	condition = 1;
	question = "How did you come to work for Legare?";
	text1 = "_He told me his story, how he lived in Lost Bahssikava, how the Goddess spoke to him, how Lost Bahssikava was destroyed, and how now, twenty years later, he re-emerged to bring us to our homeland. I knew then that he was the one the prophecies spoke of._";
	text2 = "_He was the Prophet._";
	
begintalknode 25;
	state = 13;
	personality = 93;
	nextstate = 14;
	condition = 1;
	question = "Prophecies? The Prophet?";
	text1 = "_In our oral tradition, we sliths have a set of prophecies about the Return. It comes from an augury cast by Thsss himself, the leader of the original Darklings._";
	text2 = "_It tells that one will lead us from our exile, performing many miracles and... sss... many great deeds. This one is traditionally known as the Prophet. I knew that Legare was this one. I was the first to call him by this name that everyone now uses._";

begintalknode 26;
	state = 14;
	personality = 93;
	nextstate = 11;
	condition = 1;
	question = "If you were the first to call him that, why don't you call him that now?";
	text1 = "_He is the Prophet, but he is also a slith. I knew him as Legare. Therefore he is Legare to me. Sss._ If you had to guess, you'd say there was more to this story, but Pithoss probably isn't going to say anything more now.";

begintalknode 27;
	state = 11;
	personality = 93;
	nextstate = 11;
	condition = 1;
	question = "Isn't Kass supposed to be Legare's chief assistant?";
	text1 = "_He and I work together. Sss. We are equalsss._";
	
begintalknode 28;
	state = 10;
	personality = 93;
	nextstate = 15;
	condition = 1;
	question = "What are you doing right now?";
	text1 = "_I am considering our options. The normal passageway out of here, across the river and to the east, is blocked. The river itself is shallow, so that we might wade or swim it, but we do not know where it leads._";
	text2 = "_We could try to dig out the path to the east or explore the river north or south. I suppose that does not concerns you at the moment, though: you task is different._";
	text3 = "_I think Legare was going to send you on a scouting expedition down the river, but I have not spoken with him recently. You should go to him to find out what he wants you to do._";
	text4 = "_I am thinking over what Phaedra reported about the area to the north. It is filled with monsters and obstacles, but it is the only way out of here. We must cross treacherous land to get through the next stage of our journey._";
	text5 = "He adds, _I suppose that does not concerns you at the moment, though: your task is different._";
	text6 = "He adds, _We are counting on you to clear that area as much as possible._";
	code =
	clear_strings();
	if (get_flag(12,6) == 0)
		{add_string(1);
		add_string(2);
		add_string(3);
		}
	else
		{add_string(4);
		if (get_flag(9,11) == 0)
			add_string(5);
		else
			add_string(6);
		}
break;

begintalknode 29;
	state = 15;
	personality = 93;
	nextstate = 10;
	condition = get_flag(9,6) == 0;
	question = "I'll go talk to him, then.";
	text1 = "_Good. He will give you your instructions._";
	
begintalknode 30;
	state = 15;
	personality = 93;
	nextstate = 10;
	condition = (get_flag(9,6) == 1) && (get_flag(9,11) == 0);
	question = "I talked to him already. He wants me to scout.";
	text1 = "_As I thought. You should do that, then._";
	
begintalknode 32;
	state = 15;
	personality = 93;
	nextstate = 10;
	condition = get_flag(9,12) == 1;
	question = "Yes. We are helping the imprisoned souls of Bahssikavans.";
	text1 = "_Your mission is so important that we are delaying here for you. Free the enslaved, and defeat the demons, and come back soon so that we may continue on our way._";
	
begintalknode 33;
	state = 15;
	personality = 93;
	nextstate = 10;
	condition = get_flag(9,11) == 1;
	question = "Yes. Kass told me to clear the northern path.";
	text1 = "_We are relying on you. Clear that path, and open the way for us Avernite sliths to continue towards the homeland, towards the home we have never known._";

// *** Phaedra at the chessboard ***
// Phaedra's dialogue at the chessboard consists of 34-40 and 49

begintalknode 34;
	state = -1;
	personality = 94;
	nextstate = 16;
	condition = 1;
	question = "Phaedra";
	text1 = "Before you is a great warrior. As she shifts in her chair, you can see her finely toned muscles vividly under her skin. She almost palpably radiates magical energy, too. She is a powerful individual.";
	text2 = "She is playing chess with Machrone. It is Machrone's move, and by the looks of it, it has been his move for quite some time.";
	text3 = "She looks up as you approach. _Hey there,_ she says, smiling.";
	text5 = "_What else do you want to know? I'm in no hurry, after all._ Phaedra looks back at Machrone. _It is your move, remember?_ She sighs.";
	action = INTRO;
	
begintalknode 35;
	state = 16;
	personality = 94;
	nextstate = 16;
	condition = get_flag(1,22) == 1;
	question = "Hi, Phaedra.";
	text1 = "_You remember me! I'm flattered._ She grins.";
	
begintalknode 36;
	state = 16;
	personality = 94;
	nextstate = 17;
	condition = get_flag(1,22) == 0;
	question = "Who are you?";
	text1 = "_My name is Phaedra. I'm an adventurer. The officers at Fort Dranlon sent me to make sure that Legare wasn't trying to start some sort of war, and I got stuck here with everyone else._";
	text2 = "_Not that I mind, really. This is a great adventure._";
	text3 = "She thinks and adds, _I've been around for a while and seen quite a variety of strange things. I can identify your items for you, if you want._";
	
begintalknode 37;
	state = 17;
	personality = 94;
	nextstate = 16;
	condition = party_size() == 1;
	question = "Do you adventure alone?";
	text1 = "_Yup. Just like you. I like to rely only on myself. And besides, it means I don't have to share the loot._";

begintalknode 38;
	state = 17;
	personality = 94;
	nextstate = 16;
	condition = party_size() > 1;
	question = "If you're an adventurer, where's your party?";
	text1 = "_I adventure by myself. It's easier to convince the job-offering people that one person is reliable than that four or five are. And plus, it means I don't have to share the loot._";

begintalknode 39;
	state = 16;
	personality = 94;
	nextstate = 16;
	condition = 1;
	question = "Are you winning the chess game?";
	text1 = "_Yeah, but Machrone won't admit it. I have him in a mate-in-three, and he's convinced that there's some way out of it._ She turns to him. _Give it up, paper-boy! I won!_";
	text2 = "Machrone shakes his head vigorously. _I am in a rather difficult position, yes, but I know, I am sure, I have no doubt, that if I consider all the options carefully, there is some way out._";
	text3 = "Phaedra laughs. _And so we sit. And so we have sat for, oh, I don't know, for a long time._";

begintalknode 40;
	state = 16;
	personality = 94;
	nextstate = 16;
	condition = get_flag(9,6) == 1;
	question = "Legare wants me to scout south, down the river.";
	text1 = "_Interesting. He wants me to scout north. I decided to head that way as soon as I beat Machrone at this game._ She laughs. _I didn't realize how long that might take._";

// *** Machrone ***
// Machrone's dialogue while playing Phaedra in chess consists of nodes 41-3

begintalknode 41;
	state = -1;
	personality = 95;
	nextstate = 18;
	condition = 1;
	question = "Machrone";
	text1 = "The journalist Machrone sits here, playing chess with Phaedra. He is staring at the board intently and only glances up as you approach.";
	text2 = "_Oh, hello. I'm at a rather critical juncture in this game, as you can see._ He looks back down to the board. _Perhaps if I move my rook to A4... no. My knight to b6... no._ He sighs. _Ah, well, I'm sure there's an answer here somewhere._";
	text5 = "Machrone concentrates intently on the board. _Er, yes. What else do you wish to know?";
	action = INTRO;
	
begintalknode 42;
	state = 18;
	personality = 95;
	nextstate = 18;
	condition = 1;
	question = "Are you losing the chess game?";
	text1 = "_Losing? No, no, of course not. I am in a rather difficult position, but I am sure that I will find some way out of it. Sooner or later._";

begintalknode 43;
	state = 18;
	personality = 95;
	nextstate = 18;
	condition = 1;
	question = "How did you get stuck here? You're human.";
	text1 = "_Well, I am a journalist from the surface. I write about interesting current events and send my reports back to a publishing company, who then distributes them across the four continents. We're even looking to expand into Avernum._";
	text2 = "_Well, as you know, I am here because I am a journalist._";
	text3 = "_That's why I went to see Legare in the first place. But then when the sliths of Gnass attacked, I couldn't get out. Anyone coming from Lost Bahssikava was considered to be on Legare's side. They would've killed me._";
	text4 = "_The same thing happened to Phaedra. She tells me that the situation will be remedied soon, that the soldiers of Fort Dranlon will catch wind of these events and will negotiate with High Priest Pathass, leader of the army._";
	text5 = "_But, for the time being, we are stuck. And I have a move to make._ He looks back to the board.";
	code =
	if (get_flag(1,23) == 1)
		remove_string(1);
	else
		remove_string(2);
break;

// *** Machrone 2 ***
// Machrone's dialogue after playing Phaedra at chess consists of nodes 44-7

begintalknode 44;
	state = -1;
	personality = 95;
	nextstate = 19;
	condition = 1;
	question = "Machrone";
	text1 = "Machrone sits, concentrating intently on the chessboard. _Err, ah, yes. What do you wish to know?_";

begintalknode 45;
	state = 19;
	personality = 95;
	nextstate = 19;
	condition = 1;
	question = "Did you lose the game?";
	text1 = "_Yes. Darnedest thing. I was playing with Phaedra, and I had her, really had her, but she escaped somehow and managed to defeat me. I am reviewing the game to determine my mistake._";
	text2 = "_I am sure that any minute now, I will figure out what I should have done to win._";
	text3 = "This seems unlikely. One glance at the board tells you that Machrone got soundly destroyed in this game. Still, you have enough manners not to object.";

begintalknode 46;
	state = 19;
	personality = 95;
	nextstate = 19;
	condition = 1;
	question = "How did you get stuck here? You're human.";
	text1 = "_Well, I am a journalist from the surface. I write about interesting current events and send my reports back to a publishing company, who then distributes them across the four continents. We're even looking to expand into Avernum._";
	text2 = "_Well, as you know, I am here because I am a journalist._";
	text3 = "_That's why I went to see Legare in the first place. But then when the sliths of Gnass attacked, I couldn't get out. Anyone coming from Lost Bahssikava was considered to be on Legare's side. They would've killed me._";
	text4 = "_The same thing happened to Phaedra. She tells me that the situation will be remedied soon, that the soldiers of Fort Dranlon will catch wind of these events and will negotiate with High Priest Pathass, leader of the army._";
	text5 = "_But, for the time being, we are stuck. And I have a move to make._ He looks back to the board.";
	code =
	if (get_flag(1,23) == 1)
		remove_string(1);
	else
		remove_string(2);
break;

begintalknode 47;
	state = 19;
	personality = 95;
	nextstate = 19;
	condition = get_flag(9,5);
	question = "Where did Phaedra go?";
	text1 = "_To scout up the river to the north. She said Legare asked her to. She will be back soon. She promised me another game._";
	
// *** Pithoss 2 ***
// Pithoss's dialogue consists of nodes 21-33 and 48
	
begintalknode 48;
	state = 15;
	personality = 93;
	nextstate = 15;
	condition = (get_flag(7,29) == 1) && (get_flag(12,6) == 0);
	question = "I might know where the river leads. (Describe the book you read about the Bahssikavans' water system.)";
	text1 = "_You think the river leads into Ancient Bahssikava? That would be very strange, indeed. Why wouldn't the Bahssikavans have gone upstream a bit and found their way into the homeland, then?_";
	text2 = "_You will still have to scout down the river and see what is truly there._";

// *** Phaedra at the chessboard 2 ***
// Phaedra's dialogue at the chessboard consists of 34-40 and 49

begintalknode 49;
	state = 16;
	personality = 94;
	nextstate = 16;
	condition = 1;
	question = "Can you identify my items?";
	text1 = "_Sure thing. Only 5 coins per item._.";
	action = ID 5;

// *** Phaedra 2 ***
// Phaedra's dialogue near the gates consists of nodes 53-5

begintalknode 53;
	state = -1;
	personality = 96;
	nextstate = 22;
	condition = 1;
	question = "Phaedra";
	text1 = "Phaedra stands here, apparently having just finished a conversation with Kass. _Hey, there,_ she says in her usual cheerful manner. _Have you talked to Kass yet?_";

begintalknode 54;
	state = 22;
	personality = 96;
	nextstate = -1;
	condition = (get_flag(9,11) == 0) && (get_flag(9,12) == 0);
	question = "No, not yet.";
	text1 = "_Then you should do that. Once you're done talking to him, talk to me, but not before._";
	action = END_TALK;
	
begintalknode 55;
	state = 22;
	personality = 96;
	nextstate = 23;
	condition = (get_flag(9,11) == 1) || (get_flag(9,12) == 1);
	question = "Yes, I have. (Describe your mission.)";
	text1 = "_A ghost in Bahssikava, you say?_ Phaedra looks concerned. _And he wanted a red iron key that was somewhere north of the guardpost?_ She pulls a key out of her pocket. _I found it when I was scouting. It was on the body of a slith._";
	text2 = "She hands the key to you. _Now let's see what we can do about helping out those Bahssikavans._";
	text3 = "_We're heading north, then? Good. I found some tracks that looked suspicious, and we may have to clear out some monsters. Let's head up north to the boat that I have, and we'll check it out._";
	text4 = "_Somehow you don't have enough room for me in your party, though. Drop off some of your fellow travelers somewhere._";
	text5 = "She adds, _By the way, I've been to a lot of places and seen a lot of different kinds of items. I can identify your items for you for a small price._ (To ask her, use your special ability _Phaedra Identify._)";
code =
	if (get_flag(9,11) == 1)
		{remove_string(1);
		remove_string(2);
		}
	else
		remove_string(3);
	if (add_char_to_party(25) == 1)
		{remove_string(4);
		change_custom_abil_uses(0,1,1);
		change_custom_abil_uses(1,1,1);
		change_custom_abil_uses(2,1,1);
		change_custom_abil_uses(3,1,1);
		change_spec_item(3,1);
		set_flag(9,18,1);
		end(); }
break;

// *** More Kass ***
// Kass's dialogue consists of nodes 1-11 and 56-9 and 63-7

begintalknode 56;
	state = 1;
	personality = 90;
	nextstate = 24;
	condition = (get_flag(15,21) == 1) && (get_flag(9,11) == 0);
	question = "We did it! We defeated the demon lord Nolagh-Khar!";
	text1 = "You tell Kass the story of your defeat of the powerful demon slavemaster of Ancient Bahssikava. He listens enraptured as you describe exploring the ruins of the city, slaying the demons, and freeing the sliths.";
	text2 = "_This is an incredible deed,_ he says. _Certainly all Bahssikava owes you a debt of gratitude. I did not make a mistake when I chose to ask you to help us. But now, I am afraid that I we have even more to discuss._";

begintalknode 57;
	state = 24;
	personality = 90;
	nextstate = -1;
	condition = 1;
	question = "What is the next mission?";
	text1 = "_As I mentioned before, we must travel north from here. South leads into Bahssikava, as you know, and east is blocked, so north up the river is our only option. However, the area is blocked by monsters. Phaedra can tell you more._";
	text2 = "_Head north and clear the way for our humble band of pilgrims to travel. It is the next stage in our journey, the next way we must go._";
	code =
	set_flag(9,11,1);
	set_flag(9,12,2);
	toggle_quest(3,1);
break;

begintalknode 58;
	state = 1;
	personality = 90;
	nextstate = 1;
	condition = party_size() == 1;
	question = "What should I do now?";
	text1 = "_As you can see, the path out of this guardpost is destroyed. The tunnel has collapsed. We have an alternate route, however: in the south, we have found a hole in the cave wall._";
	text2 = "_I want you to scout that path. Clear it, if it needs clearing. I need to know if it leads into a larger cavern or if it just dead-ends somewhere. Report back to me when you have discovered something._";
	text3 = "_If you are injured or become injured, you can rest in the same room again to restore your energies._";
	text4 = "_Scout the path to the south. Clear it, if it needs clearing. Report back to me when you have discovered where it leads._";
	text5 = "_Investigate what you found in Bahssikava. If there are spirits there that are trapped by some sort of evil force, it is our duty to help them. Once you have done what they ask of you, report back to me._";
	text6 = "_Scout north. Clear the way for us to pass. We must move out of this guardpost soon, and we need to head north, so you must prepare the way for us. Report back when you think the way is clear._";
	text7 = "_We must discuss exactly that. What did you find to the south?_";
	code =
	clear_strings();
	if ((get_flag(9,6) == 1) && (get_flag(9,10) == 0))
		add_string(4);
	if (get_flag(9,12) == 1)
		add_string(5);
	if (get_flag(9,11) == 1)
		add_string(6);
	if ((get_flag(9,10) == 1) && (get_flag(9,11) == 0) && (get_flag(9,12) == 0))
		add_string(7);
	if (get_flag(9,6) == 0)
		{add_string(1);
		add_string(2);
		add_string(3);
		toggle_quest(2,1);
		set_flag(9,6,1);
		}
break;

begintalknode 59;
	state = 1;
	personality = 90;
	nextstate = 1;
	condition = party_size() > 1;
	question = "What should we do now?";
	text1 = "_As you can see, the path out of this guardpost is destroyed. The tunnel has collapsed. We have an alternate route, however: in the south, we have found a hole in the cave wall._";
	text2 = "_I want you to scout that path. Clear it, if it needs clearing. I need to know if it leads into a larger cavern or if it just dead-ends somewhere. Report back to me when you have discovered something._";
	text3 = "_If you are injured or become injured, you can rest in the same room again to restore your energies._";
	text4 = "_Scout the path to the south. Clear it, if it needs clearing. Report back to me when you have discovered where it leads._";
	text5 = "_Investigate what you found in Bahssikava. If there are spirits there that are trapped by some sort of evil force, it is our duty to help them. Once you have done what they ask of you, report back to me._";
	text6 = "_Scout north. Clear the way for us to pass. We must move out of this guardpost soon, and we need to head north, so you must prepare the way for us. Report back when you think the way is clear._";
	text7 = "_We must discuss exactly that. What did you find to the south?_";
	code =
	clear_strings();
	if ((get_flag(9,6) == 1) && (get_flag(9,10) == 0))
		add_string(4);
	if (get_flag(9,12) == 1)
		add_string(5);
	if (get_flag(9,11) == 1)
		add_string(6);
	if ((get_flag(9,10) == 1) && (get_flag(9,11) == 0) && (get_flag(9,12) == 0))
		add_string(7);
	if (get_flag(9,6) == 0)
		{add_string(1);
		add_string(2);
		add_string(3);
		toggle_quest(2,1);
		set_flag(9,6,1);
		}
break;

// *** Boat Guard ***
// The Boat Guard's dialogue consists of nodes 60-2

begintalknode 60;
	state = -1;
	personality = 96;
	nextstate = 26;
	condition = 1;
	question = "Boat Guard";
	text1 = "The guard here looks at you. _Do you have permission to board this boat and head north?_";

begintalknode 61;
	state = 26;
	personality = 96;
	nextstate = -1;
	condition = get_flag(9,11) == 0;
	question = "No.";
	text1 = "_Then I can't let you pass._ He stands in your way, blocking you.";
	action = END_TALK;
	
begintalknode 62;
	state = 26;
	personality = 96;
	nextstate = -1;
	condition = get_flag(9,11) == 1;
	question = "Yes.";
	text1 = "_Then you may proceed._ He moves out of your way.";
	code =
	relocate_character(26,46,8);
	end();
break;

// *** More Kass ***
// Kass's dialogue consists of nodes 1-11 and 56-9 and 63-7

begintalknode 63;
	state = 1;
	personality = 90;
	nextstate = 27;
	condition = (get_flag(9,17) == 1) && (get_flag(15,21) == 0);
	question = "Ancient Bahssikava is too difficult without Phaedra. I'd like to wait until she's healed and scout north.";
	text1 = "_Are you completely sure?_ he asks.";
	
begintalknode 64;
	state = 27;
	personality = 90;
	nextstate = 1;
	condition = 1;
	question = "No.";
	text1 = "_Then come back if you become certain._";
	
begintalknode 65;
	state = 27;
	personality = 90;
	nextstate = -1;
	condition = 1;
	question = "Yes.";
	text1 = "_Fine,_ Kass says. _Go to your quarters and rest. The Prophet will get you when she is ready._";
	code = 
	set_flag(9,17,2);
	end();
break;

begintalknode 66;
	state = 28;
	personality = 90;
	nextstate = 1;
	condition = 1;
	question = "No, I changed my mind.";
	text1 = "_Then keep exploring. Come back to me only if you are completely sure._";
	
begintalknode 67;
	state = 28;
	personality = 90;
	nextstate = -1;
	condition = 1;
	question = "Yes, I'm sure.";
	text1 = "_Very well. Head north. Phaedra should have some details for you as you progress._";
	code =
	set_flag(9,11,1);
	toggle_quest(3,1);
	end();
break;

begintalknode 68;
	state = 1;
	personality = 90;
	nextstate = 1;
	condition = 1;
	question = "Is there anyone who will buy my extra items?";
	text1 = "Kass thinks for a moment. _We travel light,_ he says, _so there are not many who would be interested in having extra items. However, one among us, Silthokh used to be a merchant; he is by the bend in the river to the west._";

// *** Silthokh ***
// Silthokh's dialogue consists of nodes 69-78

begintalknode 69;
	state = -1;
	personality = 90;
	nextstate = 29;
	condition = 1;
	question = "Silthokh";
	text1 = "A slith stands here at the bend in the river, looking out into the water. He turns to you as you approach. _My name is Silthokh,_ he says, with only a slight trace of the normal slith hissing accent.";
	text5 = "_What else can I do for you?_ Silthokh asks.";
	action = INTRO;

begintalknode 70;
	state = 29;
	personality = 90;
	nextstate = 29;
	condition = 1;
	question = "What are you doing?";
	text1 = "_Thinking,_ he says. _We have finally done it. We are across the threshold into our homeland, but what is here? A deserted guardpost. If this is what the homeland is like all over, we may as well not have come._";
	text2 = "He sounds discouraged. You can hardly blame him. If, when the humans re-emerged from Avernum, they had found the Empire totally destroyed, they would've been devastated.";

begintalknode 71;
	state = 29;
	personality = 90;
	nextstate = 29;
	condition = 1;
	question = "How did you come to be a part of this expedition?";
	text1 = "_I was a trader in Gnass and Blosk. I sold weapons, tools, and assorted other things. When Legare emerged, I thought...._ He pauses and looks at you very carefully.";
	text2 = "Whatever he sees seems to satify him. _I thought it might be profitable to come along. The homeland must surely be rich with treasure. We'd been told that it was a paradise with glorious civilization, so they must have some trinkets they could sell._";
	text3 = "He glances around at the abandoned buildings. _If nothing else, there must be raw materials that are worth something. Spices, perhaps, or exotic plants._ He sighs. _At least, so I hope._";

begintalknode 72;
	state = 29;
	personality = 90;
	nextstate = 29;
	condition = 1;
	question = "Would you like to do some trading?";
	text1 = "You finish shopping. _If you need any items identified,_ he adds, _Phaedra can do that._";
	code =
	begin_shop_mode("Silthokh's Items","This slith merchant has a variety of miscellaneous items at reasonable prices, and he will buy your excess, too.",1,2,2);
break;

begintalknode 73;
	state = 29;
	personality = 90;
	nextstate = 30;
	condition = 1;
	question = "Do you have any unusual items?";
	text1 = "_In fact, I do,_ he says. _I have a few spellbooks that I could allow you to read for certain prices. I don't know magic myself, but I am told that they are quite powerful and could aid you a great deal._ He thinks momentarily.";
	text2 = "_For five hundred coins, I could let you read the text that describes an efficient way to cast Mass Healing._";
	text3 = "_For seven hundred, you could read the one about Fireblast._";
	text4 = "_For a thousand, you could read the one on Divine Retribution._";
	text5 = "He adds, _And my best book, one that teaches a super-efficient Repel Spirit, you could read for a mere two thousands coins._";
	text6 = "_You've read all my books, though._";
	code =
	if (get_flag(9,19) > 0)
		remove_string(2);
	if (get_flag(9,20) > 0)
		remove_string(3);
	if (get_flag(9,21) > 0)
		remove_string(4);
	if (get_flag(9,22) > 0)
		remove_string(5);
	if ((get_flag(9,19) == 0) || (get_flag(9,20) == 0) || (get_flag(9,21) == 0) || (get_flag(9,22) == 0))
		remove_string(6);
break;

begintalknode 74;
	state = 30;
	personality = 90;
	nextstate = 29;
	condition = 1;
	question = "I don't need any spells right now, thank you.";
	text1 = "_Fine. Speak up if you do._";
	
begintalknode 75;
	state = 30;
	personality = 90;
	nextstate = 29;
	condition = get_flag(9,19) == 0;
	question = "I'd like to read the book on Mass Healing.";
	text1 = "He pulls out a book and you learn Mass Healing in greater depth than you knew it before.";
	text3 = "_You don't have enough money to pay for that,_ he says.";
	code =
	if (coins_amount() >= 500) {
		remove_string(3);
		change_coins(-500);
		change_spell_level(0,1,10,1);
		change_spell_level(1,1,10,1);
		change_spell_level(2,1,10,1);
		change_spell_level(3,1,10,1);
		set_flag(9,19,1);
		}
	else
		remove_string(1);
break;

begintalknode 76;
	state = 30;
	personality = 90;
	nextstate = 29;
	condition = get_flag(9,20) == 0;
	question = "I'd like to read the book on Fireblast.";
	text1 = "He pulls out a book and you learn Fireblast in greater depth than you knew it before.";
	text3 = "_You don't have enough money to pay for that,_ he says.";
	code =
	if (coins_amount() >= 700) {
		remove_string(3);
		change_coins(-700);
		change_spell_level(0,0,16,1);
		change_spell_level(1,0,16,1);
		change_spell_level(2,0,16,1);
		change_spell_level(3,0,16,1);
		set_flag(9,20,1);
		}
	else
		remove_string(1);
break;

begintalknode 77;
	state = 30;
	personality = 90;
	nextstate = 29;
	condition = get_flag(9,21) == 0;
	question = "I'd like to read the book on Divine Retribution.";
	text1 = "He pulls out a book and you learn Divine Retribution in greater depth than you knew it before.";
	text3 = "_You don't have enough money to pay for that,_ he says.";
	code =
	if (coins_amount() >= 1000) {
		remove_string(3);
		change_coins(-1000);
		change_spell_level(0,1,17,1);
		change_spell_level(1,1,17,1);
		change_spell_level(2,1,17,1);
		change_spell_level(3,1,17,1);
		set_flag(9,21,1);
		}
	else
		remove_string(1);
break;

begintalknode 78;
	state = 30;
	personality = 90;
	nextstate = 29;
	condition = get_flag(9,22) == 0;
	question = "I'd like to read the book on Repel Spirit.";
	text1 = "He pulls out a book and you learn Repel Spirit in greater depth than you knew it before.";
	text3 = "_You don't have enough money to pay for that,_ he says.";
	code =
	if (coins_amount() >= 2000) {
		remove_string(3);
		change_coins(-2000);
		change_spell_level(0,1,4,2);
		change_spell_level(1,1,4,2);
		change_spell_level(2,1,4,2);
		change_spell_level(3,1,4,2);
		set_flag(9,22,1);
		}
	else
		remove_string(1);
break;

// *** Phaedra identification ***

begintalknode 198;
	state = -1;
	personality = 250;
	nextstate = 99;
	condition = 1;
	question = "Phaedra";
	text1 = "You ask Phaedra if she can identify your items for you. _I sure can,_ she replies, grinning.";

begintalknode 199;
	state = 99;
	personality = 250;
	nextstate = -1;
	condition = 1;
	question = "Please do, then.";
	text1 = "_Sure thing. Only 5 coins per item._ She flashes you another grin,  daring you to ask why she is charging you. You don't.";
	action = ID 5;