// TOWN DIALOGUE SCRIPT
//    Town 1: Formello

begintalkscript;

variables;

short i,j,k,r1,choice;


begintalknode;
	tag = 1;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = "You try to talk to one of the Formello guards, but they are still distracted by the recent cavequake. They suggest you talk to Mayor Amtar. City Hall is in the northeast corner of town.";
	text2 = "The city guards are still dangerously distracted by the arrival of the shade and the destruction of a good part of their town. You aren't able to get much information from them.";
	text3 = "Now that the barriers are down, the Formellan guards are a cheerier lot. Sure, the Empire is still invading, but death now seems slightly less inevitable.";
	code =
		cs();
		if (gf(20,0) > 0)
			as(3);
			else if (gf(1,1) > 0)
				as(2);
				else as(1);
	break;


begintalknode;
	tag = 2;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = "There are several merchants sitting in this inn, silently muttering plans to each other. When you get close, they get quiet. When you move away, they start talking again.";
	text2 = "You think you heard one of them say, _Barrier's still not down. We're doomed._";
	text3 = "You think you heard one of them say, _Barrier doesn't matter. Empire's still down here. We're doomed._";
	code =
		if (gf(20,0) == 0)
			rs(3);
			else rs(2);
	break;

begintalknode;
	tag = 3;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = "These guards are watching the mayor's quarters. They seem strangely unconcerned about your presence. _Amtar said you can be here. Just don't mess anything up more than it is._";

begintalknode;
	tag = 4;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = "These soldiers are practicing their techniques, but they are using real weapons. They are being very careful, but you decide that it would be better to not distract them too much.";
	text2 = "You note that one of them seems far more skilled than the other.";
	
// Ken

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Ken";
	text1 = "You meet a tall, rugged, middle-aged man. He has long, blond hair, a lizard-skin jerkin, and many scars on his hands and arms. You introduce yourself. _Good to meet you. Call me Ken. Watch out for the lizards._";
	text5 = "Ken keeps talking to you, but he never stops keeping an eye on the lizards. One of them occasionally tries to bite his foot off and gets a kick in the face for its trouble.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_How did you get those scars?_";
	text1 = "A giant lizard lunges at him. He dodges nimbly. _I raise lizards, that's how._ He kicks the lizard. It backs away and prepares for another attempt.";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Where did you learn to raise lizards?_";
	text1 = "_Before I got exiled, I raised pigs. I liked them. They didn't always try to kill you. But this isn't the surface, so you do what's necessary to live._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Do you miss the pigs?_";
	text1 = "_Of course, but we raise what we can. All we have down here are sickly cows and vicious lizards. We make do with what we have._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Why were you sent to Avernum?_";
	text1 = "_Jen and I were exiled together. We didn't like the way things were going. Heck, who did? But we just couldn't keep our mouths shut about it, so they took care of us! That's for damn sure._";

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Can I buy some meat?_";
	text1 = "_Of course. Jen is inside. She can help you._";
	
begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Any advice for dealing with lizards?_";
	text1 = "_Yes. Never forget: They are vicious, spiteful, cruel creatures, capable only of violence. They will always hate you. They cannot feel joy or love._";
	text2 = "_Keep that in mind and you'll do fine._";

// Jen

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 28;
	question = "Jen";
	text1 = "You meet a tired-looking woman. She is in her thirties, but the hard life of Avernum ages people prematurely. She nods and gives you a little smile. _My name's Jen. Welcome to our shop._";
	text2 = "She is a combination cook and butcher, processing the livestock that get brought in from the farms around Formello.";
	text5 = "Jen continues to wait on you. She looks very tired. In the next room, you can hear lizards and cave cows, brought in from the surrounding farms and awaiting their final fate.";
	action = INTRO;

begintalknode;
	state = 28;
	nextstate = 29;
	question = "_What can I purchase here?_";
	text1 = "_We sell rations. Not much food coming in, what with the barrier and all. Still, we try to give people a fair price._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_How does the barrier affect your food supply?_";
	text1 = "_A lot of this area's food came from Mertis, way down south. Lots of people up here. With the barrier, we'll be having shortages before too long._ She shakes her head sadly. _Just one thing after another._";
	text3 = "She smiles sadly. _Well, the barrier's down. You must have heard. But merchants don't come up here much. They're afraid the barriers will come back. We struggle by on what food we can raise here._";
	action = DEP_ON_SDF 20 0 0;

begintalknode;
	state = 29;
	nextstate = 28;
	question = "_So the rations are expensive?_";
	text1 = "_I'm afraid so. Our rations aren't too cheap, what with things the way they are._ She shrugs. _Not much I can do about it. I'm just a humble servant of the people. Let me know if you want to buy something._";

begintalknode;
	state = 28;
	nextstate = -1;
	condition = 1;
	question = "_Tell me about the farms around here._";
	text1 = "_They produce what they can. Mushrooms don't grow as well here as in some of the caves. Don't know why. Just one of the mysteries. At least they grow at all._";
	
begintalknode;
	state = 28;
	nextstate = -1;
	question = "_I'd like to buy something._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Jen and Ken","Jen and Ken bring in meat from the surrounding countryside and convert it into something edible. Supplies are low, so prices are high.",19,5,3);
	break;

// Stoppard

begintalknode;
	tag = 50;
	state = -1;
	nextstate = 55;
	question = "Stoppard";
	text1 = "There is a tall, gangly man grinding up fungus behind the counter. He is surrounded by bundles and bunches of mold and mushrooms.";
	text2 = "He sets aside the mixture and crosses his hands on the table in front of him. _Welcome to my shop. My name is Stoppard._";
	text5 = "Stoppard grinds up fungus in his mortar and pestle. His fingers and sleeves feature permanent green stains. _Need anything else?_";
	action = INTRO;

begintalknode;
	state = 55;
	nextstate = 57;
	condition = 1;
	question = "_Do you have a hard time finding herbs to make your potions?_";
	text1 = "_Yes. There have been shortages of everything lately, but the biggest problem has been getting ingredients for healing potions. The army needs them, and I can't make them._";
	text2 = "_Of course, the barriers blocking the roads have been an utter disaster. Soon, it will start to cost lives._";
	code =
		if (gf(20,0) > 0)
			rs(2);
	break;
	
begintalknode;
	state = 57;
	nextstate = 58;
	condition = 1;
	question = "_Where do you find your herbs?_";
	text1 = "_That ... is a secret. A very impolite question to ask an alchemist, especially one who is making potions for the soldiers._";
	
begintalknode;
	state = 58;
	nextstate = -1;
	condition = 1;
	question = "_But I am a soldier. Surely you can help me?_";
	text1 = "He sighs. _I suppose. There is a grove in the mostly barren tunnels northwest of Formello, between two lakes. Please don't share that secret with anyone else._";

begintalknode;
	state = 55;
	nextstate = 56;
	question = "_What are you grinding fungus for?_";
	text1 = "_I have a wide variety of potions which you can purchase. Of course, I'll buy almost any useful equipment you want to part with. I've had to be versatile lately._";

begintalknode;
	state = 56;
	nextstate = -1;
	question = "_Versatile? How?_";
	text1 = "_What with the war with the Empire, the soldiers and mercenaries have many needs. I fill them as best I can. Have to earn my keep._";
	
begintalknode;
	state = 55;
	nextstate = 59;
	question = "_Can you make a potion for me?_";
	text1 = "_Well, that is my specialty, but you will have to provide the materials. If you have foraged any lichen or moss or fungi with the proper properties, you can show them to me._";
	text2 = "_For example, if you brought me healing herbs in adequate quantities, I could make you healing or curing potions._";
	text3 =  "_Even better, with the right mix of herbs, I could make a brew to speed you up in combat or restore your magical energy. Very useful. Much in demand._";
	code =
		toggle_quest(15,1);
	break;
	
begintalknode;
	state = 59;
	nextstate = -1;
	condition = num_of_item(289) >= 2;
	question = "_I would like a healing potion._ (Give 2 sprigs of healing herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Stoppard hands you a clay jug filled with a bitter, medicinal brew.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,2);
		reward_give(220);
		play_sound(22);
	break;
	
begintalknode;
	state = 59;
	nextstate = -1;
	condition = num_of_item(289) >= 1;
	question = "_I would like a curing potion._ (Give 1 sprig of healing herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Stoppard hands you a clay jug filled with a bitter, medicinal brew.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,1);
		reward_give(221);
		play_sound(22);
	break;

begintalknode;
	state = 59;
	nextstate = -1;
	condition = num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like a speed potion._ (Give 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Stoppard hands you a clay jug filled with a green, minty-smelling brew.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(222);
		play_sound(22);
	break;

begintalknode;
	state = 59;
	nextstate = -1;
	condition = num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like an energy potion._ (Give 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work. Soon, Stoppard hands you a clay jug filled with a thick brew with little bits of brown stuff suspended in it.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(223);
		play_sound(22);
	break;
	
begintalknode;
	state = 59;
	nextstate = 55;
	condition = 1;
	question = "_I don't need any potions._";
	text1 = "_Anything else, then?_";
	
begintalknode;
	state = 55;
	nextstate = -1;
	question = "_I'd like to buy some stuff._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Stoppard's Miscellany","Stoppard has a few potions not set aside for the army that he can part with.",20,4,3);
	break;

begintalknode;
	state = 55;
	nextstate = -1;
	condition = 1;
	question = "_I would like to sell something._";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;
	
begintalknode;
	state = 55;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_All right. Safe travels to you._";
	action = END_TALK;	
	
// Townsend

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 82;
	question = "Townsend";
	text1 = "Considering the unpleasantness of the food down here, it's amazing that this man managed to get so large. He is working on a pair of leather gauntlets. His fingers are thick, but they maneuver the needle and thread with remarkable dexterity."; 
	text2 = "When you enter, he motions for you to sit across from him. _I am Townsend. Townsend the sage. How may I help you?_";
	text5 = "_Anything I can do for you?_ Townsend studies your possessions with a practiced eye, looking for something he can work on.";
	action = INTRO;

begintalknode;
	state = 82;
	nextstate = 83;
	question = "_What can you do for me?_";
	text1 = "_You look like a warrior. A soldier, if I guess right. Warriors tend to accumulate items. I may be able to make something of use for you, if you provide the correct components._";

begintalknode;
	state = 83;
	nextstate = 84;
	question = "_But you are a sage._";
	text1 = "_I am. I have studied many things, and I still do. However, in this time of war, I have been forced to turn my skills to more practical applications._";

begintalknode;
	state = 84;
	nextstate = -1;
	question = "_What would you like to study?_";
	text1 = "_The properties of the flora of Avernum, both the natural flora and that created by the Tower of Magi. I would choose to be a simple botanist._ He smiles. _And chef. I would like to find a way to make the native ingredients delicious._";

begintalknode;
	state = 82;
	nextstate = 85;
	condition = 1;
	question = "_Can you make something for me?_";
	text1 = "_I can, if you provide the proper materials. I have been studying the uses of fine leather, especially that taken from drakes or similar creatures._";
	text2 = "_My items will contain an enchantment. I need fine leather to craft the item and focusing crystals to channel my power into the skin. The more you provide, the more I can make. I will also need a fee of 300 coins for my time._";
	text3 = "_Also, I am learning more all the time. If you return later, I might be able to do more for you._";
	code =
		toggle_quest(72,1);
		if (gf(1,18) > 0)
			rs(3);
	break;

begintalknode;
	state = 85;
	nextstate = -1;
	condition = has_spec_item(25) > 0 && gf(1,18) == 0;
	question = "_Have you learned how to make new items recently?_";
	text1 = "_I have! It will take more leather and crystals, but I can make some high-quality equipment._";
	action = SET_SDF 1 18 1;

begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) == 0 || num_of_item(295) == 0;
	question = "_Do I have the correct materials?_";
	text1 = "_I'm afraid not. I need at least one piece of fine leather and at least one focusing crystal._";
	
begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) >= 1 && num_of_item(295) >= 1;
	question = "_Can you make a leather cloak for me?_ (Give one leather, one crystal, and 300 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Townsend takes the money and the materials. Then he shoos you out of his workshop. _Sorry. My secrets are secrets. Give me a few hours._";
	text3 = "You return a few hours later and the sage presents you a new leather cloak. _A modest enchantment, I'm afraid, but I think you will find it to be worthwhile._";
	code =	
		cs();
		if (coins_amount() < 300)
			as(1);
			else {
				as(2); as(3);
				inc_flag(190,8,1);
				change_coins(-300);
				take_num_of_item(294,1);
				take_num_of_item(295,1);
				reward_give(21);
				}
	break;
	
begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) >= 2 && num_of_item(295) >= 2;
	question = "_Can you make a leather jerkin for me?_ (Give two leather, two crystals, and 300 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Townsend takes the money and the materials. Then he shoos you out of his workshop. _Sorry. My secrets are secrets. Give me a few hours._";
	text3 = "You return a few hours later and the sage presents you a new leather jerkin. _A solid enchantment. I think I did a good job with it._";
	code =	
		cs();
		if (coins_amount() < 300)
			as(1);
			else {
				as(2); as(3);
				inc_flag(190,8,1);
				change_coins(-300);
				take_num_of_item(294,2);
				take_num_of_item(295,2);
				reward_give(40);
				}
	break;
	
begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) >= 2 && num_of_item(295) >= 1;
	question = "_Can you make a leather shield for me?_ (Give two leather, one crystal, and 300 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Townsend takes the money and the materials. Then he shoos you out of his workshop. _Sorry. My secrets are secrets. Give me a few hours._";
	text3 = "You return a few hours later and the sage presents you a new, thick leather shield. _A solid enchantment. I think I did a good job with it._";
	code =	
		cs();
		if (coins_amount() < 300)
			as(1);
			else {
				as(2); as(3);
				inc_flag(190,8,1);
				change_coins(-300);
				take_num_of_item(294,2);
				take_num_of_item(295,1);
				reward_give(130);
				}
	break;

begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) >= 3 && num_of_item(295) >= 2 && gf(1,18) > 0;
	question = "_Can you make a fine belt for me?_ (Give three leather, two crystals, and 300 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Townsend takes the money and the materials. _Ah ... One of my new tricks. I am pleased._ Then he shoos you out of his workshop. _Sorry. My secrets are secrets. Give me a few hours._";
	text3 = "You return a few hours later and the sage presents you a new, finely tooled leather belt. _A solid enchantment. My new skills are proving to be very useful._";
	code =	
		cs();
		if (coins_amount() < 300)
			as(1);
			else {
				as(2); as(3);
				inc_flag(190,8,1);
				change_coins(-300);
				take_num_of_item(294,3);
				take_num_of_item(295,2);
				reward_give(163);
				}
	break;

begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) >= 4 && num_of_item(295) >= 3 && gf(1,18) > 0;
	question = "_Can you make a fine pair of gloves for me?_ (Give four leather, three crystals, and 300 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Townsend takes the money and the materials. _Ah ... One of my new tricks. I am pleased._ Then he shoos you out of his workshop. _Sorry. My secrets are secrets. Give me a few hours._";
	text3 = "You return a few hours later and the sage presents you a new, beautiful pair of gloves. _A solid enchantment. My new skills are proving to be very useful._";
	code =	
		cs();
		if (coins_amount() < 300)
			as(1);
			else {
				as(2); as(3);
				inc_flag(190,8,1);
				change_coins(-300);
				take_num_of_item(294,4);
				take_num_of_item(295,3);
				reward_give(188);
				}
	break;

begintalknode;
	state = 85;
	nextstate = -1;
	condition = num_of_item(294) >= 4 && num_of_item(295) >= 3 && gf(1,18) > 0;
	question = "_Can you make a fine pair of greaves for me?_ (Give four leather, three crystals, and 300 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Townsend takes the money and the materials. _Ah ... One of my new tricks. I am pleased._ Then he shoos you out of his workshop. _Sorry. My secrets are secrets. Give me a few hours._";
	text3 = "You return a few hours later and the sage presents you a new, beautiful pair of greaves. _A solid enchantment. My new skills are proving to be very useful._";
	code =	
		cs();
		if (coins_amount() < 300)
			as(1);
			else {
				as(2); as(3);
				inc_flag(190,8,1);
				change_coins(-300);
				take_num_of_item(294,4);
				take_num_of_item(295,3);
				reward_give(355);
				}
	break;

begintalknode;
	state = 85;
	nextstate = 82;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_Then I should return to my work. Anything else?_";

begintalknode;
	state = 82;
	nextstate = -1;
	condition = 1;
	question = "_I'll be going now._";
	text1 = "_Thank you for dropping by._";
	action = END_TALK;	
	
	
// Caius

begintalknode;
	tag = 90;
	state = -1;
	nextstate = 109;
	question = "Caius";
	text1 = "You are greeted by a graying man in spotless white robes. He approaches you and bows humbly. _I am Father Caius, current caretaker of this temple. I welcome you. It is always inspiring to see new faces here. How can I be of service to you?_";
	text5 = "Father Caius gives you another humble little bow. _Is there any way I can be of use to you, honored visitors?_ Having someone be so friendly to you is simultaneously refreshing and unnerving.";
	action = INTRO;

begintalknode;
	state = 109;
	nextstate = 114;
	condition = 1;
	question = "_Tell me about your temple._";
	text1 = "_We are the Speakers of Holy Chance. We are the faith of miners and warriors and adventurers and explorers of Avernum. All who depend on the proper turn of fortune to survive and thrive. All who know that, despite our best efforts, all can be lost._";


begintalknode;
	state = 114;
	nextstate = -1;
	condition = 1;
	question = "_Why is it such a good faith for Avernum?_";
	text1 = "_Because all of our lives depend on fortune now. One ill turn and we will all fade. Even now, the Empire rampages through our lands. A great stroke of ill luck, one we are forced to face. We all must learn to accept our precarious fates._";

begintalknode;
	state = 114;
	nextstate = -1;
	condition = 1;
	question = "_Do you pray to Chance?_";
	text1 = "He laughs. _Pray? Of course not. Chance does not care what we say or what we hope for. If it did, would the Empire come? The barriers tear up our roads?_";
	text2 = "_No, we come to this temple simply to learn to accept all that is out of our control._";


begintalknode;
	state = 109;
	nextstate = 110;
	question = "_What sort of services do you perform?_";
	text1 = "_It has fallen to me to end my wanderings here, as caretaker of this temple. I comfort those who are distressed by the fluctuations of Chance._";
	text2 = "_I perform services in that capacity. I can teach certain holy rituals to you, for a small donation. I can also teach you how to be calm and accepting, so that the natural fluctuations of luck do not disturb you. Please let me know instantly how I can assist you._";

begintalknode;
	state = 109;
	nextstate = 111;
	question = "_How did you come to this temple?_";
	text1 = "_I once served here under Claudette, a fine woman, but I left to search for a safer place for my family during the slith wars. I ended up comforting the frightened souls near the front line! I helped them accept what needed to happen to them. We all end up doing what we must._";
	text2 = "_When Claudette passed away, let her soul find rest, I finally returned here. And here I will stay._";

begintalknode;
	state = 111;
	nextstate = 112;
	question = "_It is dangerous to travel, even in the best of times._";
	text1 = "_Agreed. But I have learned tricks that can help make a long journey over rough terrain much easier. The important thing is to never forget: You must prepare. You must struggle._";
	text2 = "_However, in the end, there will always be things you cannot control._";


begintalknode;
	state = 110;
	nextstate = -1;
	question = "_Can you teach me some holy rituals?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Caius the Priest","Caius can teach you a variety of the less involved holy rituals.",22,3,3);
	break;

begintalknode;
	state = 110;
	nextstate = -1;
	question = "_I'd love to learn what you can teach me about chance._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Lessons In Luck","Caius can't teach you how to have better luck. However, he can help you to adjust to bad luck, when it invariably comes.",21,6,3);
	break;

begintalknode;
	state = 110;
	nextstate = -1;
	condition = 1;
	question = "_That is all I need to know._";
	text1 = "_Then I wish you good luck and the wisdom to know when it has arrived._";
	action = END_TALK;

// Alice

begintalknode;
	tag = 110;
	state = -1;
	nextstate = 136;
	question = "Alice";
	text1 = "You meet a young girl in the robes of a mage's apprentice. They're at least two sizes too big for her. She wanders around keeping things clean and organized. Right now, she's mopping up a big patch of mold on the stone floor.";
	text2 = "You ask who she is. She smiles proudly. _I'm Alice. I'm an apprentice mage!_";
	text5 = "Alice brushes some fragments of lichen parchment off of her robes. _Is there anything else I can do for you in my capacity as an apprentice mage?_ She's quite proud of that last part.";
	action = INTRO;

begintalknode;
	state = 136;
	nextstate = 139;
	condition = 1;
	question = "_You are an apprentice?_";
	text1 = "_I am! I am a full apprentice mage, ready to learn the deepest secrets of the world! But I haven't been one for very long, so I can't blow anything up yet._";

begintalknode;
	state = 139;
	nextstate = -1;
	condition = 1;
	question = "_The deepest secrets of the world?_";
	text1 = "_Yes. Secret knowledge. The True Names of things. How to summon fire and blow stuff up. All that sort of stuff._";

begintalknode;
	state = 139;
	nextstate = -1;
	question = "_Who are you apprenticed to?_";
	text1 = "_To Miles. He runs the library, and he's really powerful! He's going to teach me magic for the next five years! And I'll do a lot of sweeping._ She brushes off her skirt, and stands up straight.";
	text2 = "_I don't mind the scut work, as long as I get to learn magic!_";
	
begintalknode;
	state = 136;
	nextstate = 137;
	question = "_Looks like you have a lot of work to do._";
	text1 = "_I mostly have to run errands. And sometimes it's really difficult!_";


begintalknode;
	state = 137;
	nextstate = 138;
	question = "_What sort of difficult errands are you on right now?_";
	text1 = "_Right now, I'm supposed to be finding this book on holy rituals, stinktification, or something like that. But I can't find it anywhere! These shelves aren't very well organized._";

begintalknode;
	state = 138;
	nextstate = -1;
	question = "_Stinktification?_";
	text1 = "_No, that's not right._ She thinks. _Sanctification! It's a ritual to make evil magic places lose their evil magic. Very strong._";

begintalknode;
	state = 138;
	nextstate = -1;
	question = "_Think hard. Can you remember where the ritual was?_";
	text1 = "She thinks for a while. _No, I can't. Somewhere in Formello, in a different library. Not sure where. Hard to find, though. Just a little library. Maybe if you come back later, I'll have remembered._";
	text3 = "She thinks for a while. _Wait! I remember why it's so hard to find! It's in a little nook in the city walls, in the northwest corner of town. The entrance is just inside the moat. You can only get into it from the outside of the wall, not the inside._";
	action = DEP_ON_SDF 20 0 0;

// Miles

begintalknode;
	tag = 130;
	state = -1;
	nextstate = 163;
	question = "Miles";
	text1 = "A very tall man with raven black hair and a short beard reclines behind his desk, humming something that sounds like a sea chanty. _Welcome to the library, travelers!_ He stands to greet you. _I'm Miles._";
	text2 = "_The soldiers of Avernum are always welcome here, especially if they wish knowledge or spells of great power._";
	text5 = "Miles hums softly under his breath as he watches you. He is eager to help you out. _Let me know if you need anything, soldier._";
	action = INTRO;

begintalknode;
	state = 163;
	nextstate = -1;
	question = "_I wish to learn spells of great power._";
	text1 = "_Who doesn't? Every mage and priest in Avernum wants to learn how to cast each spell at the highest power. But when the same priests learn how, they jealously hoard the knowledge. Each wants to be able to cast Bolt of Fire better than anyone else._";
	text2 = "_It's foolishness, and you pay the price. You will have to search well to truly master any ritual. Look in dungeons and the libraries of rogue wizards. It is knowledge that would benefit all of Avernum._";

begintalknode;
	state = 163;
	nextstate = 164;
	question = "_Are you the librarian here?_";
	text1 = "_Yes. I run the Library of Formello, one of the three centers of magical learning in Avernum. Feel free to browse the scrolls. Also, for a small fee, you can purchase the magical knowledge of the ages. This is a school as well as a library._";

begintalknode;
	state = 164;
	nextstate = -1;
	question = "_Where are the other centers of learning?_";
	text1 = "_Patrick's Tower, in the Great Cave, is the source of much powerful and arcane research. But the greatest center of magical learning is the Tower of Magi, a huge basalt tower in the southeastern corner of Avernum._";
	text2 = "_That is the place to go to do any really serious magical learning. I hate to admit it, but there it is._";

begintalknode;
	state = 163;
	nextstate = -1;
	question = "_What knowledge can you give me?_";
	text1 = "_It depends on what you need. If you're seeking a specific tome, ask my apprentice. She's cleaning up in the stacks._";

begintalknode;
	state = 163;
	nextstate = -1;
	question = "_May I learn some spells?_";
	text1 = "You conclude your training.";
	code =
		begin_shop_mode("Library of Formello","Miles is able to teach you some of the less powerful spells. The greater rituals must be learned in the Tower of Magi.",23,3,3);
	break;
	
begintalknode;
	state = 163;
	nextstate = -1;
	condition = 1;
	question = "_That is all I need to know._";
	text1 = "_Understood. Good day to you._";
	action = END_TALK;

// Amtar

begintalknode;
	tag = 150;
	state = -1;
	nextstate = 190;
	question = "Amtar";
	text1 = "You meet a man in his fifties, very old for Avernum. He wears the traditional mayor's sash and a large gold necklace. He nods to you. _I am Amtar. Mayor Amtar, honored ruler of the city of Formello._";
	text2 = "He seems very upset. It's not a surprise, considering that the south end of his hall just collapsed.";
	text5 = "Amtar looks with dismay at the ruins of his city hall. The stress of his position is wearing him down more every moment. _What is it, warrior? Please distract me from this catastrophe._ He constantly fidgets with his necklace.";
	action = INTRO;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = gf(1,19) == 0;
	question = "_I need to speak with you._";
	text1 = "You try to speak with Amtar, but he is understandably distracted by the giant stone spire that just destroyed his city hall. He points at the shade with a trembling hand. _That ... Do something about that._";
	action = END_TALK;

begintalknode;
	state = 190;
	nextstate = 191;
	condition = gf(1,19) > 0;
	question = "_Could Formello use the services of a soldier of Avernum?_";
	text1 = "He shakes his head. _So many troubles, and even my secretary has gone off to fight the Empire. I'm glad to see adventurers here. At this point, we need all the assistance we can get._";

begintalknode;
	state = 191;
	nextstate = -1;
	question = "_Who was your secretary?_";
	text1 = "_His name is Foley. He's a captain now. If you meet him, be sure to mention my name. I'm sure he'd be happy to help some adventurers out._";
	action = SET_SDF 1 22 1;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = gf(1,19) > 0;
	question = "_That is a beautiful necklace._";
	text1 = "He puts his hand on it protectively. _This is the badge of office of the mayor of Formello. We had a bit of trouble over it a few years ago. It was stolen from Mayor Evelyn. Some adventurers got it back for her._";
	text2 = "_Then, when her term was up, Mayor Evelyn ran off and left me with all of the messes. Plenty of trouble. But none with the necklace, since._";

begintalknode;
	state = 190;
	nextstate = 192;
	condition = gf(1,19) > 0 && gf(20,3) == 1 && gf(20,0) == 0;
	question = "_I have come from Fort Draco to see if you are in need._";
	text1 = "_We ... Well ... See for yourself._ He points at the ruin of his hall. _These things, these shades, they are attacking us. They created the barriers. They think we are their foes, and we don't even know who they are!_";
	text2 = "_The thing opened up a hole in the wall. It leads to ... to whatever that thing was._ He points to the northeast. _Someone must do something._";
	code =
		sf(1,4,1);
		sf(20,3,2);
		toggle_quest(102,3);
		award_party_xp(QUEST_XP,6);
		
	break;

begintalknode;
	state = 192;
	nextstate = 193;
	condition = 1;
	question = "_And you think I can do something about it?_";
	text1 = "_If not you, then who? Someone must go. You are armed. You have potential. You need to explore. Find out what is happening, and inform The Castle. I implore you. I command you._";
	
begintalknode;
	state = 193;
	nextstate = -1;
	condition = 1;
	question = "_Can you give me aid?_";
	text1 = "_We have little to spare, but it is yours. Take whatever you find in my library and chambers. I would not deny you anything that could aid you in your hard journey._";

begintalknode;
	state = 193;
	nextstate = -1;
	condition = 1;
	question = "_Do you have the authority to give the order?_";
	text1 = "_Are you dense? The barriers have cut us off from The Castle! From Avernum itself! Of course I can give the order. I am the only one left who can. You must go. I wish you the best of luck. Avernum needs you._";
	text2 = "_Now, excuse me. I must tend to my own people._";
	action = END_TALK;
	
begintalknode;
	state = 193;
	nextstate = -1;
	condition = 1;
	question = "_I will see that it is done._";
	text1 = "_Thank you, soldier. The barriers have cut us off from The Castle! From Avernum itself! I know you did not ask for this burden, but it is our only hope._";
	text2 = "_Now, excuse me. I must tend to my own people._";
	action = END_TALK;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = gf(1,19) > 0 && gf(20,3) == 1 && gf(20,0) > 0;
	question = "_I have come from Fort Draco to see if you are in need._";
	text1 = "_We were. Now the barriers are down and we are repairing the damage. I have heard rumors that you had a hand in the deed. For this, we are all grateful. You may have saved us all._";
	code =
		sf(1,4,1);
		sf(20,3,2);
		toggle_quest(102,3);
		award_party_xp(QUEST_XP,6);
	break;
	
begintalknode;
	state = 190;
	nextstate = -1;
	condition = gf(1,19) > 0;
	question = "_What do you know about the barriers?_";
	text1 = "_We all heard what that shade said. That vahnatai thing._ He points to the east. _The quake made a tunnel back there. It may be our only hope to get rid of that cursed barrier. There are few warriors around here that can be spared. Only you can investigate it._";
	text3 = "_They are gone, and we must return to the war against the Empire. Anything you can do to help in that struggle, you should do. We are all in this mess together. If the state of Avernum falls, we all fall._";
	action = DEP_ON_SDF 20 0 0;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = gf(1,19) > 0;
	question = "_Your hall is kind of broken._";
	text1 = "_Yes. It is unsafe and humiliating, but, right now, we have far worse problems._";
	text3 = "_Yes, and it will be so for some time. I've been speaking with contractors about repairing it, but, well, you know what a mess that is._";
	action = DEP_ON_SDF 20 0 0;

// Gibbon

begintalknode;
	tag = 170;
	state = -1;
	nextstate = 217;
	question = "Gibbon";
	text1 = "The bar is tended by a young, unshaven, ferret-faced man. Despite his unsavory appearance, he runs a good inn. Pots of stew bubble happily behind him and kegs of mushroom ale are lined up, ready for tapping.";
	text2 = "He sidles up to you to see if there's any money to be made here. _I'm Gibbon. What can I do for you?_";
	text5 = "Gibbon waits on you attentively, hoping that you order something.";
	action = INTRO;

begintalknode;
	state = 217;
	nextstate = 218;
	question = "_What's on the menu here?_";
	text1 = "_Well, we have stew for two coins, and a round of beer for all of you for three. Also, one of our rooms is still free. That's only five coins._ He winces. _It's the only room available, I'm afraid._";

begintalknode;
	state = 218;
	nextstate = -1;
	question = "_I'll take some stew._ Pay 2 coins.";
	condition = coins_amount() >= 2;
	text1 = "He serves up a stew of thick lizard broth with big chunks of mushroom. It's as tasty as anything you've eaten down here. Could use some salt, but salt is rare and expensive.";

begintalknode;
	state = 218;
	nextstate = -1;
	condition = coins_amount() >= 3;
	question = "_Beers all around please._ Pay 3 coins.";
	text1 = "He gives you mugs of the bone-warping, mind-fogging, eyesight-blurring brew that is standard in Avernum. They've been able to get mushrooms to ferment, but they've never gotten the result to taste good.";
	text3 = "_Three gold, please._";
	action = PAY -1 -1 -1 3;
	code =
		set_char_status(30000,1,25);
	break;

begintalknode;
	state = 218;
	nextstate = -1;
	condition = coins_amount() >= 5 &&  gf(1,7) == 0;
	question = "_I'll rent the room for the night._";
	text1 = "Gibbon shows you to a large, empty room down the hall. You have a long night's sleep and a complimentary breakfast of fried mushrooms. Pretty nice.";
	action = END_TALK;
	code =
		//teleport_party(41,49,FALSE);
		revive_party();
		change_coins(-5);
		relocate_char(get_pc_id(0),20,43,FALSE);
		relocate_char(get_pc_id(1),21,43,FALSE);
		relocate_char(get_pc_id(2),21,44,FALSE);
		relocate_char(get_pc_id(3),20,44,FALSE);
	break;
	
begintalknode;
	state = 218;
	nextstate = 217;
	condition = 1;
	question = "_I don't need anything right now._";
	text1 = "_Oh. OK._ He seems eager to leave.";

begintalknode;
	state = 217;
	nextstate = -1;
	question = "_Are most of your rooms booked?_";
	text1 = "He leans close to you. _I only say this because you're a soldier. Keep it quiet. There's something weird in one of the rooms, like a ghost. Down the hall, last room on the left._";
	text2 = "_I saw it, slammed the door, and locked it. It had some stuff with it. If you kill it, you can have it all._";
	text3 = "_Thanks for getting rid of the spook. I'm not going to open the room til' I've cleaned it. Plus, it's still spooky in there. Oh, well. Won't last forever._ He serves you complimentary beer and stew by way of thanks.";
	action = DEP_ON_SDF 1 7 0;

begintalknode;
	state = 217;
	nextstate = -1;
	question = "_Anything you can tell me about the magical barriers?_";
	text1 = "_They scare the hell out of us. We're all cut off. Who knows what's going on in the rest of Avernum? Don't know anything about how to bring them down, though._";
	text3 = "_Thank Chance they're gone, that's all I can say about it._";
	action = DEP_ON_SDF 20 0 0;

begintalknode;
	state = 217;
	nextstate = -1;
	condition = gf(1,1) >= 1 && gf(20,0) == 0;
	question = "_Heard any rumors about the recent cavequake? Or the new tunnel in the northeast corner of town?_";
	text1 = "_I don't know anything about it. We've had enough strangeness as it is. We had a big quake about two months ago. Hear about it? The new thing was just too much._";

begintalknode;
	state = 217;
	nextstate = -1;
	condition = gf(1,29) >= 1;
	question = "_I cleared out the room with the ghost in it. Can I use it for the night?_";
	text1 = "_No! I wouldn't let you use that awful, haunted place! After the way you helped me, you can stay in a real room!_ He shows you to an empty room. After a good night's sleep and a free breakfast, you're in great shape.";
	action = END_TALK;
	code =
		//teleport_party(41,49,FALSE);
		revive_party();
		change_coins(-5);
		relocate_char(get_pc_id(0),20,43,FALSE);
		relocate_char(get_pc_id(1),21,43,FALSE);
		relocate_char(get_pc_id(2),21,44,FALSE);
		relocate_char(get_pc_id(3),20,44,FALSE);
	break;
	
begintalknode;
	state = 217;
	nextstate = -1;
	condition = 1;
	question = "_I'll be moving on._";
	text1 = "Gibbon nods. _Good day to you._";
	action = END_TALK;


// Rose

begintalknode;
	tag = 190;
	state = -1;
	nextstate = 244;
	question = "Rose";
	text1 = "A woman in leather armor sits at the table, swilling down ale. A rapier hangs at her side. She doesn't look happy.";
	text2 = "_I'm Rose._ She belches, grimacing as the taste of the ale returns to her mouth. _You look like you work for a living. Have a seat._";
	text5 = "Rose pulls down another long swig of the mushroom ale. It doesn't seem to be affecting her in the slightest. She keeps the rapier close to hand, just in case.";
	action = INTRO;

begintalknode;
	state = 244;
	nextstate = 245;
	question = "_So how do you make your living?_";
	text1 = "_Achhh._ She spits on the floor. _Adventuring. But that damned Townsend rooked me._";

begintalknode;
	state = 245;
	nextstate = 246;
	question = "_What did Townsend do?_";
	text1 = "_Fat bastard!_ Customers turn to look at her. She quiets down. _He had me find some herbs for him. I did, but he won't pay me because they aren't 'magical enough,' whatever the hell that means! Then he offers me half price! I stomped on 'em and left._";
	text2 = "She takes a swig, and leans close to you. _Want to hear a secret?_";

begintalknode;
	state = 246;
	nextstate = -1;
	question = "_A secret? Sure!_";
	text1 = "She laughs, takes another swig, and says, _I found out where he gets his fungus. Go to the tunnels northwest of town, where nobody lives? Yeah? Go there. Look for two little lakes and search between them._";
	text2 = "She leans back. _That'll show that turd!_ She orders three more beers. None of them are for you.";

begintalknode;
	state = 244;
	nextstate = -1;
	question = "_Have any news?_";
	text1 = "_As little as possible. I don't want to know about the mess outside this inn. I'm taking a break from all that for a few hours._";

begintalknode;
	state = 244;
	nextstate = -1;
	condition = gf(20,24) == 1;
	question = "_We have a message for you from Harg, in Fort Draco. He wants you to marry him, but he's too shy to tell you._";
	text1 = "_And I can't blame him! He's dumb, he's crude, he's poor, and he has quite a strong odor. And he can't hold his drink. Plus, if he can't propose to me himself, he's a coward. No interest in him. None at all. And you can tell him that._";
	text2 = "_You must have a short memory. I'm not interested in Harg. Never have been. Never will be. Now quit pestering me!_";
	code =
		if (gf(1,21) == 0) {
			sf(1,21,1);
			rs(2);
			}
			else rs(1);
	break;

// Captain Graham

begintalknode;
	tag = 210;
	state = -1;
	nextstate = 271;
	question = "Ken";
	text1 = "A heavily armed and armored man sits behind a desk, shuffling papers. He looks like nothing would make him happier than going out and killing something.";
	text2 = "He stands to introduce himself. It takes a while. Decades in Avernum have left him with a lot of joint pain. _I'm Captain Graham. Welcome to our little garrison, warrior._";
	text5 = "Captain Graham chats wistfully with you as he works on his paperwork. He seems to envy you your life of travel and adventure.";
	action = INTRO;

begintalknode;
	state = 271;
	nextstate = 276;
	condition = 1;
	question = "_You look like you've been a soldier for a long time._";
	text1 = "_Don't remind me. I was sent down here a long time ago. Can't remember what the sun looks like. Moment I got to Fort Avernum, they stuck a spear in my hand. Been fighting ever since._";

begintalknode;
	state = 276;
	nextstate = 277;
	condition = 1;
	question = "_Why were you sent down here?_";
	text1 = "_A rude question, but I'll answer. I was sent down because the late unlamented Emperor Hawthorne was a monster, and I was dumb enough to say it aloud._";
	text2 = "_We killed Hawthorne, so the Empire invaded us. It's a harsh price to pay, but we needed to pay it. The world is better off without that tyrant._";

begintalknode;
	state = 277;
	nextstate = -1;
	condition = 1;
	question = "_Who replaced him?_";
	text1 = "_Some young princess. Prazac, I think. Don't know. Don't keep up much on surface politics._";

begintalknode;
	state = 271;
	nextstate = 275;
	condition = 1;
	question = "_How are things in Formello?_";
	text1 = "_Hard. The barriers. The Empire. Guards sent to the front. Low supplies._";
	text2 = "_And then the cavequake. Destroyed half of city hall. One disaster after another._";
	code =
		if (gf(1,1) == 0)
			rs(2);
	break;

begintalknode;
	state = 275;
	nextstate = 272;
	question = "_Is there much Empire activity around Formello?_";
	text1 = "He shakes his head. _Not much. Not much in this area. Nothing for my boys. Yet. Though I occasionally get missions. If you help me out, I can help you get a higher clearance._";

begintalknode;
	state = 272;
	nextstate = -1;
	question = "_What do I need clearance for?_";
	text1 = "He shakes his head. _Don't they tell you guys anything? Clearances! To determine where you can go and what you're allowed to know!_";
	text2 = "_Adventurers, to get clearance, do missions. And we keep track._";

begintalknode;
	state = 278;
	nextstate = -1;
	condition = 1;
	question = "_What are the classes?_";
	text1 = "_There's Soldier clearance, for grunts like you, and Magi clearance, the next one up, for mages, and Crown Clearance._";

begintalknode;
	state = 278;
	nextstate = -1;
	condition = 1;
	question = "_Where do I go to get promoted?_";
	text1 = "_The Castle. That's where it's done._";
	text2 = "_Alas, the barriers make it impossible. Hopefully someone can find a way to bring them down._";
	code =
		if (gf(20,0) > 0)
			rs(2);
	break;
	
begintalknode;
	state = 271;
	nextstate = -1;
	condition = gf(1,20) <= 1;
	question = "_Got any missions I can do?_";
	text1 = "_Yeah. There's some crazy nephilim in some ruins to the west. They're making undead and sending them to attack us. Go there and get them to cut it out. Destroy the creature that is making the undead, and I'll help you out._";
	text2 = "_The ruins are a long march to the west, on the south side of the river._";
	action = SET_SDF 1 20 1;
	code =
		toggle_quest(14,1);
	break;
	
begintalknode;
	state = 271;
	nextstate = -1;
	condition = gf(1,20) == 1 && gf(24,22) >= 1;
	question = "_I found the altar they've been using to make the undead. The nephil shaman responsible is dead._";
	code =
	run_hardcode(104);
	break;

begintalknode;
	state = 271;
	nextstate = -1;
	condition = gf(1,20) == 2;
	question = "_Got any more missions for me?_";
	text1 = "He shakes his head. _Don't have any missions now. Sorry. Maybe later. If you want to try to get higher clearance, go to the Castle._";
	text2 = "_Also, be sure to keep an eye on the job board outside._";
	
// _Tybalt

begintalknode;
	tag = 230;
	state = -1;
	nextstate = 298;
	question = "Tybalt";
	text1 = "You meet a taciturn man in moss-stained clothes. He stalks up and down Formello's park, tending to a small patch of mushrooms. You ask his name. He grunts. _Tybalt._";
	text5 = "Tybalt reluctantly engages in conversation with you. He'd much rather be working on his little farm.";
	action = INTRO;

begintalknode;
	state = 298;
	nextstate = -1;
	question = "_This is a nice park._";
	text1 = "_No. It's a stupid park. It's a waste. Every scrap of land needs to be used for food. There's a war on!_";

begintalknode;
	state = 298;
	nextstate = 299;
	question = "_What do you do here in Formello?_";
	text1 = "_I'm a farmer._";

begintalknode;
	state = 299;
	nextstate = 300;
	question = "_Where do you farm?_";
	text1 = "_I grow the mushrooms in the corner of town. Don't touch 'em, or you'll be in some trouble!_";

begintalknode;
	state = 300;
	nextstate = -1;
	question = "_Why can't I touch the mushrooms?_";
	text1 = "_They're emergency crops, in case we get sieged! And I'm in charge of 'em! Touch 'em, and you might get in serious trouble, if you live past what I do to you!_";
	text2 = "He stomps off.";
	action = END_TALK;

// Becca

begintalknode;
	tag = 250;
	state = -1;
	nextstate = 325;
	question = "Stoppard";
	text1 = "A young woman with a leather pack is walking about, checking and occasionally maintaining the ballistas. She doesn't seem very enthusiastic about it.";
	text2 = "_Hi. You stuck here too? I'm Becca._ Her clothes are worn from travel, and the spear slung over her back looks like it's seen some combat.";
	text5 = "Becca seems happy to be in a conversation. It breaks the monotony of being stuck in Formello.";
	action = INTRO;

begintalknode;
	state = 325;
	nextstate = -1;
	question = "_What are the ballistas for?_";
	text1 = "_Holding off the Empire when they come, which they will. They can fire spears or rocks, depending on what works best. Or what is left._";
	
begintalknode;
	state = 325;
	nextstate = 326;
	question = "_Do you live here?_";
	text1 = "_No. I was heading south to Cotra to visit my family. From there, I was going to join the fight against the Empire._";

begintalknode;
	state = 326;
	nextstate = -1;
	question = "_What's keeping you from heading south?_";
	text1 = "_I was just leaving here when I heard about the barrier. You know, the one that cut us off from anywhere else? Now I'm just doing odd jobs, waiting to get away._";
	text3 = "_Well, I was stuck here for a while after the barrier appeared. Now it's finally gone, but I have to wait for a caravan to head south that I can travel with. It's dangerous around here now. I can handle a lot, but even I am afraid of going it alone now._";
	action = DEP_ON_SDF 1 8 0;

begintalknode;
	state = 325;
	nextstate = 327;
	question = "_You look like you have traveled far._";
	text1 = "_That is true enough. I want to do what's best for Avernum. It's not much of a home, to be honest, but it is my home, and if the Empire gets its way, I don't like the thought of what will happen to us all._";
	text2 = "_That is why it's so maddening to be trapped here like this._";

begintalknode;
	state = 327;
	nextstate = -1;
	question = "_Why don't you join me, then?_";
	text1 = "She smiles. _Kind words, but I think I will stay here._ She waves at the ballistas in the courtyard. _As long as I'm here and ready to defend Formello, Captain Graham keeps me fed. I'm doing good by staying alive._";
	text2 = "_I still appreciate the thought. Safe travels to you._ With a smile and a nod of her head, she moves on.";
	action = END_TALK;

begintalknode;
	state = 327;
	nextstate = -1;
	question = "_That's too bad. Well, good luck to you._";
	text1 = "_And safe travels to you._ With a smile and a nod of her head, she moves on.";
	action = END_TALK;

// Amber

begintalknode;
	tag = 270;
	state = -1;
	nextstate = 379;
	question = "Caius";
	text1 = "A woman, flushed with exertion, nods to you in greeting. A large broadsword hangs from her belt. _I'm Amber. Welcome, soldier, to Formello's training center._";
	text5 = "Amber shouts orders and insults at the soldiers below. She seems more interesting in teaching and working than chatting.";
	action = INTRO;

begintalknode;
	state = 379;
	nextstate = 380;
	question = "_Are you in charge of the training?_";
	text1 = "_Yes, I run this training center. It's where all the soldiers and mages and such come to learn new skills to use against the enemy. You can get training too, if you want._";
	text2 = "_Pity you're just Soldier clearance. If you had Magi clearance, there's some secret new techniques I could teach you._";
	text3 = "_Lucky for you that you have Magi clearance. There's some secret new techniques I could teach you._";
	code =
		if (has_spec_item(25))
			rs(2);
			else rs(3);
	break;
	
begintalknode;
	state = 380;
	nextstate = -1;
	condition = 1;
	question = "_What can you teach me?_";
	text1 = "You conclude your training.";	
	code = 
		begin_shop_mode("Amber's Training",
		  "Since you are an Avernite soldier, Amber can train you. It will still cost you.",
		  24,4,0);	
	break;
	
begintalknode;
	state = 380;
	nextstate = -1;
	condition = has_spec_item(25) == 0;
	question = "_How would I get Magi clearance?_";
	text1 = "_You'd need to get to the Castle somehow._";
	
begintalknode;
	state = 380;
	nextstate = -1;
	condition = has_spec_item(25);
	question = "_What are your 'secret techniques'?_";
	text1 = "You conclude your training.";	
	code = 
		begin_shop_mode("Amber's Training",
		  "Since you are an Avernite soldier, Amber can train you. Since you have Magi Clearance, you can learn some of her secret, elite techniques.",
		  25,4,0);	
	break;

begintalknode;
	state = 380;
	nextstate = -1;
	condition = 1;
	question = "_I don't need training._";
	text1 = "She nods and returns to work. She's not much for chat.";
	action = END_TALK;
	
begintalknode;
	state = 379;
	nextstate = -1;
	question = "_Are you in the Avernite army?_";
	text1 = "_I'm not actually in the army. I just teach what I know, and if I don't know it, I find someone who does. Captain Graham runs the garrison here, if you have any questions about it. He's across the road._";

begintalknode;
	state = 379;
	nextstate = -1;
	condition = 1;
	question = "_I'll be going now._";
	text1 = "She nods and returns to work.";
	action = END_TALK;

//

begintalknode;
	tag = 400;
	state = -1;
	nextstate = 400;
	condition = 1;
	text1 = "You climb the outcropping to face the shade. Any hope that the nearby guards will follow you and back you up are soon dashed. You approach the figure alone.";
	text2 = "The shade is dim and insubstantial. It is a humanoid, seven feet tall and skeletally thin. You can't make out any more details than that.";
	text3 = "Somehow, it senses that you come close. It doesn't turn to look at you. It opens its mouth to speak.";
	code =
		set_dialogue_pic(263);
		run_hardcode(1001);
	break;

begintalknode;
	state = 400;
	nextstate = -1;
	condition = 1;
	question = "_Who are you?_";
	text1 = "The shade ignores you.";
	
begintalknode;
	state = 400;
	nextstate = -1;
	condition = 1;
	question = "_Leave this place, or you will be destroyed._";
	text1 = "The shade ignores you.";
	
begintalknode;
	state = 400;
	nextstate = 401;
	condition = 1;
	question = "Listen to it.";
	text1 = "Its voice is slow and the accent is strange. It struggles with your tongue. It begins.";
	text2 = "_You have taken some of our lands. A few. It doesn't matter. Humans have committed a greater theft from us, a hideous theft. It has been decided you will be destroyed. The barriers are the beginning._";
	
begintalknode;
	state = 401;
	nextstate = 402;
	condition = 1;
	question = "_But who are you?_";
	text1 = "The shade ignores you. Whoever projected it here, their magic doesn't carry your voice back to it. The shade continues.";	
	text2 = "_Some do not think this is just. I am one. Some of you must come to us to explain why you have done what you have done. Here ..._ The figure points at the cave wall to the northeast.";
	
begintalknode;
	state = 401;
	nextstate = 402;
	condition = 1;
	question = "_A theft? What was stolen?_";
	text1 = "The shade ignores you. Whoever projected it here, their magic doesn't carry your voice back to it. The shade continues.";	
	text2 = "_Some do not think this is just. I am one. Some of you must come to us to explain why you have done what you have done. Here ..._ The figure points at the cave wall to the northeast.";
	
begintalknode;
	state = 401;
	nextstate = 402;
	condition = 1;
	question = "Keep listening.";
	text1 = "_Some do not think this is just. I am one. Some of you must come to us to explain why you have done what you have done. Here ..._ The figure points at the cave wall to the northeast.";
	
begintalknode;
	state = 402;
	nextstate = 403;
	condition = 1;
	question = "_Wait!_";
	text1 = "Your words have no effect. There is another brief quake. You are knocked painfully to the ground. When you look up, you see there is a large crevice in the wall where there wasn't one before.";
	code =
		play_sound(165);
	break;
	
begintalknode;
	state = 402;
	nextstate = 403;
	condition = 1;
	question = "Duck.";
	text1 = "Your quick action saves you some pain. There is a brief, sharp cavequake. When you look up, you see there is a large crevice in the wall where there wasn't one before.";
	code =
		play_sound(165);
	break;
	
begintalknode;
	state = 403;
	nextstate = -1;
	condition = 1;
	question = "Try to stand up.";
	text1 = "As dust and the screams of the townsfolk fill the air, you manage to rise from the ground. The shade begins to fade away.";	
	text2 = "As he does, he says, _Come to us to protest your innocence. But if you are guilty, we will not rest until our Crystal Souls are returned to us._ Then the vahnatai, as it called itself, is gone.";
	text3 = "The people in the courtyard get up and mill about, stunned. You see a man wearing the mayor's sash. He looks at you with interest. Then he looks at the rubble of what was, up until recently, his city hall. Then he sighs, shakes his head, and walks back into the ruins of his office.";
	text4 = "Nearby, the dark crevice in the wall waits. Nobody goes near it. The townspeople mill about, terrified, seemingly intent on forgetting that what just happened happened.";
	action = END_TALK;
	code =
		erase_char(142);
		toggle_quest(107,1);
		toggle_quest(102,3);
		sf(1,19,1);
	break;