// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(143,4) == 0;
	question = "special";
	text1 = "There is a stone circle at the top of this hill. It's not an ancient place of worship, left by pagans in an age long lost. It's recent construction, actually. The stones are smooth and mostly free of moss. It's kind of nice.";
	text2 = "It's also defended. There is a circle of magical sentinels standing inside the stones. Animated suits of armor, covered with nasty, sharp bits of metal. They are arranged in a ring, staring at one sentinel in the center.";
	text3 = "They make no move to attack you when you approach. They seem to be inactive, although you doubt that they would remain so calm if you tried to tamper with them.";
	action = SET_SDF 143 4 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(143,5) == 0;
	question = "special";
	text1 = "You descend into an abandoned mine. Abandoned recently, from the look of it. Or, considering the bones littering the ground, maybe the miners didn't leave peacefully.";
	text2 = "There are also large rat droppings on the floor. You see little glints of light in the distance, probably nasty rodents. When you concentrate, you hear them chittering and squeaking in the darkness.";
	text3 = "For a moment, you almost think that they are talking to each other. You are not far from Patrick's Tower, a great center of magical research. It is possible that the ambient magic in the area had some unpredictable effects.";
	action = SET_SDF 143 5 1;


begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "In this dark alcove, you have found the queen of the rat hive. The creature lets out a long, screeching howl when she sees you. Around her, her rat eggs begin to hatch.";
	text2 = "Wait a second. Rat queen? Eggs? Hatch? The magic from Patrick's Tower has been having stronger effects than you suspected.";

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sentinel doesn't respond to you. It stands perfectly still.";

begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Suddenly, the sentinels stop moving. Then they stand upright. Then they slowly, smoothly move back to their original position.";
	text2 = "All of the sentinels are gone. Probably not the result Sorengard wanted, but it was definitely a test of how they worked.";
	text3 = "The test has been concluded.";
	code =
		if (num_chars_in_group(22) == 0)
			rs(1);
			else rs(2);
	break;
	
begintalknode 7;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "Suddenly, though the test has not been completed, the sentinels stop moving. Then they stand upright. Then they slowly, smoothly move back to their original position.";
	text2 = "All of the sentinels are gone. Probably not the result Sorengard wanted, but it was definitely a test of how they worked.";
	text3 = "It appears that the test requires all of the guinea pigs to stay within a certain distance of the circle. Now the sentinels turn away, unable to chase the planned target for their attacks.";
	code =
		if (num_chars_in_group(22) == 0)
			rs(1);
			else rs(2);
	break;

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

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



//

begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "There is a leatherworker living in this small, comfortable home. Although he is far from any city or settlement that could protect him, he seems unafraid.";
	text2 = "This might be because his door is locked and he has hidden defenses. Or maybe the goop he uses to treat and tan the hides has left him a little unhinged. Your guess is the second one.";
	text3 = "_Ahhh ... Ahhh ... Visitors. Good. Good. I am Cavarin the leatherworker. I work here. For the tower. Yes. But I also help travelers. I sell things. I make crafts. You want business?_";
	text5 = "Cavarin smiles and chats with you. He seems interested in what is happening out in the Great Cave, but his conversation is disjointed. It is hard to follow him at times.";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "Why are you out here?";
	text1 = "_I treat the hides. Yes. Treat them. It smells. Smells pretty bad. To others. I'm not welcome in towns. So I am out here._";

begintalknode 12;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "What do you treat them with?";
	text1 = "_All sorts of things. Strong things. I do work for Patrick's Tower. Leather for them takes stronger stuff. Dangerous stuff. Is all right. I usually wear gloves._";

begintalknode 13;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "You aren't worried about anything attacking you?";
	text1 = "_Attacking me? Why would anyone be attacking me? What? Has something bad been going on?_ To spare yourself a very long conversation, you assure him that everything is fine.";

begintalknode 14;
	state = 10;
	nextstate = 12;
	condition = 1;
	question = "You work for Patrick's Tower?";
	text1 = "_I do. They need leather. The best leather. Well-treated. They keep me here. They give food. And protect me._";

begintalknode 15;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "What do they need leather for?";
	text1 = "_Scrolls. Bindings for wizard books. Gloves and cloaks and hoods to protect them. They need the best. That is what I give them._";

begintalknode 16;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "What do you have for sale?";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Cavarin",
		  "Cavarin has a variety of leather goods. He's a bit crazy, but you can't deny the quality of his work.",
		  18,4,0);	
	break;

begintalknode 17;
	state = 10;
	nextstate = 15;
	condition = 1;
	question = "Can you do some custom work for me?";
	text1 = "_Oh ... I would be pleased. I mean, I can. I will need fine leather. Not crude stuff. Top quality. And focusing crystals. And money. Always money, for my materials and trouble._";
	text2 = "_Show me what you have. The more leather and crystals you have, the more I can make._";
	
begintalknode 18;
	state = 15;
	nextstate = -1;
	condition = num_of_item(294) == 0;
	question = "I don't have any leather.";
	text1 = "_Unfortunate. But I can't make anything without materials._";

begintalknode 19;
	state = 15;
	nextstate = -1;
	condition = num_of_item(294) > 0;
	question = "Here is a piece of fine leather. Can you make me a helmet? (Give 1 fine leather.)";
	text1 = "With great skill, he takes the leather, cuts out a piece for a helmet, and keeps the rest. As you watch, he fashions a very nice leather helmet for you. Then he hands it to you with a proud smile.";
	action = REUSABLE;
	code = 
		take_num_of_item(294,1);
		reward_give(330);
	break;
	
begintalknode 20;
	state = 15;
	nextstate = -1;
	condition = num_of_item(294) > 0 && coins_amount() >= 30;
	question = "Here is a piece of fine leather. Can you make me some greaves? (Give 1 fine leather and 30 coins.)";
	text1 = "With great skill, he takes the leather and cuts it into sections. As you watch, he spends an hour fashioning a very nice pair of greaves for you. Then he hands them to you with a proud smile.";
	action = REUSABLE;
	code = 
		take_num_of_item(294,1);
		change_coins(-30);
		reward_give(352);
	break;

begintalknode 21;
	state = 15;
	nextstate = -1;
	condition = num_of_item(294) > 1 && num_of_item(295) > 0 && coins_amount() >= 50;
	question = "Can you make me a pair of boots? Very nice boots? (Give 2 fine leather, 1 focusing crystal, and 50 coins.)";
	text1 = "With great skill, he takes the leather and cuts it into sections. As you watch, he spends an hour fashioning a very nice pair of boots for you. Then he hands them to you with a proud smile.";
	action = REUSABLE;
	code = 
		take_num_of_item(294,2);
		take_num_of_item(295,1);
		change_coins(-50);
		reward_give(143);
	break;

begintalknode 22;
	state = 15;
	nextstate = -1;
	condition = num_of_item(294) > 1 && num_of_item(295) > 0 && coins_amount() >= 200;
	question = "Can you make me a nice belt? That will aid me in battle? (Give 2 fine leather, 1 focusing crystal, and 200 coins.)";
	text1 = "With great skill, he takes the leather, cuts it into long strips, and braids them. As you watch, he spends an hour fashioning a broad girdle to protect and support your midsection. Then he hands it to you with a proud smile.";
	action = REUSABLE;
	code = 
		take_num_of_item(294,2);
		take_num_of_item(295,1);
		change_coins(-200);
		reward_give(157);
	break;

begintalknode 23;
	state = 15;
	nextstate = -1;
	condition = num_of_item(294) > 4 && num_of_item(295) > 1 && coins_amount() >= 500;
	question = "I want the best suit of leather armor you can make. (Give 4 fine leather, 2 focusing crystal, and 500 coins.)";
	text1 = "_Oh, really? A challenge! Not many challenges, these days. I really am very good. At leather. You know._";
	text2 = "With great skill, he takes the leather, cuts it into pieces, treats it, and forms it into a jerkin. It takes hours. You nod off. You wake up to find that Cavarin has made you tea.";
	text3 = "Then he hands the jerkin to you with a proud smile. _Yes. Best I can do. So much fun. Oh, yes. I thank you._";
	action = REUSABLE;
	code = 
		take_num_of_item(294,5);
		take_num_of_item(295,2);
		change_coins(-500);
		reward_give(40);
	break;

begintalknode 24;
	state = 15;
	nextstate = 10;
	condition = 1;
	question = "I don't need anything made.";
	text1 = "_Ah. I am so sorry to hear it. I love to do work. What else do you want?_";

begintalknode 25;
	state = 10;
	nextstate = 10;
	condition = 1;
	question = "I'll be going now.";
	text1 = "_Oh. Was nice having company. Stop by again. Yes. Come again._ He turns away and immediately forgets that you visited.";
	action = END_TALK;
	
	//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Name";
	text1 = "You approach the sentinel in the center of the circle. It stands next to a stone altar, heavily stained by gruesome goop. No blood. The residue from some quick alchemical work, from the look of it.";
	text2 = "The sentinel slowly turns to look at you. It seems to be waiting for instruction.";

begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = gf(158,16) == 1 && gf(143,1) == 0;
	question = "Solberg commands.";
	text1 = "When you issue the command, the sentinels instantly come to life. They stand up straight. They extend their arms. A surprising array of spikes and blades emerge. And then they move forward to attack.";
	text2 = "But then something goes wrong. They seem unable to distinguish friend from foe. Most of them set upon each other; scraping at each other with vicious blades.";
	action = END_TALK;
	code =
		sf(143,6,1);
		sf(143,7,1);
		set_attitude(15477,10);
		set_attitude(15478,11);
		set_attitude(15479,10);
		set_attitude(15480,11);
		set_attitude(15481,10);
		set_attitude(15482,11);
		set_attitude(15483,10);
		set_attitude(15484,11);
	break;
	
begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = gf(158,16) == 3 && gf(143,2) == 0;
	question = "Sorengard commands.";
	text1 = "When you issue the command, the sentinels instantly come to life. They stand up straight. They extend their arms. A surprising array of spikes and blades emerge. And then they move forward to attack.";
	text2 = "Sorengard has made real progress with his sentinels. They look around, carefully analyze all potential targets, and evaluate the information. Then they identify their foe: You.";
	action = END_TALK;
	code =
		sf(143,6,2);
		sf(143,7,1);
		set_attitude(30022,10);
		set_level(30022,25);
	break;

begintalknode 33;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Ummm ... Hello.";
	text1 = "The sentinel doesn't react. It returns to its neutral position and ignores you.";
	action = END_TALK;

begintalknode 34;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I command you to serve me! Be my tireless army, and we will lay waste to this barren land!";
	text1 = "The sentinel doesn't react. It returns to its neutral position and ignores you.";
	text2 = "Pity. Pretty tempting offer, you thought.";
	action = END_TALK;

begintalknode 35;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "(Just walk away.)";
	text1 = "The sentinel doesn't react. It returns to its neutral position and ignores you.";
	action = END_TALK;
	
begintalknode 36;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

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

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

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

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

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

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

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

begintalknode 44;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
//

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

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

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

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

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

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

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

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

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

////

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