// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(27,0) == 0;
	question = "special";
	text1 = "The lands northeast of Formello were once a lovely and productive farmland, with many rows of magically engineered mushrooms and tall, delicate cavewood trees.";
	text2 = "Now that the Blight has made this region far less useful, the slithzerikai have developed a new purpose for it. Dotted around the region, you can see low stone platforms, clearly marked by bright lights and wooden pillars.";
	text3 = "The smell of sulfur is strong in the air, and, through the mist, you can see a little of what is happening on the platforms. Groups of slithzerikai are standing in a circle and chanting.";
	text4 = "Occasionally, a demon appears in the circle. You can't clearly see the form from this distance, but the furious, infernal howls that echo to you are unmistakable.";
	text5 = "You have discovered a new and highly unsettling weapon in the horde's war against Avernum.";
	action = SET_SDF 27 0 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(27,1) == 0;
	question = "special";
	text1 = "During your travels through these occupied lands, you have come to be very familiar with slith clawprints. Through the fields, along the roads, everywhere humans once walked.";
	text2 = "But there are few signs of slithzerikai coming here, and the totems by the passages in the north wall seem to be there as a warning. The air is cold and still, and the sounds from the nearby city seem muted and distant.";
	text3 = "Very odd. You wonder what is keeping the invaders away.";
	action = SET_SDF 27 1 1;

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = get_sdf(27,2) == 0;
	question = "special";
	text1 = "This cavern is a very gruesome sight. It is full of bones. Some of them are old and crumbling. Others are disturbingly recent. There is a firepit in the center of the cave, here to cremate the fallen. It has not been lit in a while.";
	text2 = "After Formello fell to the horde, the bones of the fallen had to end up somewhere. This cave was selected as a charnel house. That doesn't solve the mystery of why it is so cold and grim, or why the horde avoids the place.";
	text3 = "But then the mystery is solved. You hear the sound of running, coming from the tunnel to the north. Several terrified horde scouts run into the room.";
	text4 = "And then several of the piles of bones come to life. They leap to their feet and move to trap the terrified slithzerikai.";
	action = SET_SDF 27 2 1;
	code =
		activate_hidden_group(25);
		set_name(2920,"Horde Scout");
		set_name(2921,"Horde Scout");
		set_name(2922,"Horde Scout");
	break;
	
begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = get_sdf(27,3) == 0;
	question = "special";
	text1 = "You enter the tunnels under the bone cave. It looks like there was a magical workshop down here. It's been mostly abandoned for many years. It was used for alchemy (and perhaps worse things as well).";
	text2 = "Recently, someone has been working here. Some of the tables have been cleared off, and there are signs of recent alchemy and stoneworking.";
	text3 = "You listen carefully and hear two things. From deep in the tunnels, you hear the faint echoes of stone scraping on stone.";
	text4 = "And, much closer, you can hear ... Yes. Someone is humming.";
	action = SET_SDF 27 3 1;

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = get_sdf(27,4) == 0;
	question = "special";
	text1 = "There are two stone servants here. They are simple magical automata, created and set to work burrowing out a narrow tunnel through the rock. The tunnel heads in the vague direction of Formello.";
	text2 = "It is remarkable what one enterprising wizard snuck behind enemy lines can accomplish.";
	action = SET_SDF 27 4 1;

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

begintalknode 7;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This journal has been left down here for years. It is full of the mad rantings of someone named Hirickis, left barely readable by the constant, creeping moisture.";
	text2 = "And yet the ritual described on one page actually seems useful. It describes how to make a ward that will protect you from magical attacks. (Your skill with the spell Ward of Elements increases.)";
	text3 = "You browse through the book a bit more, but you don't learn anything new.";
	text4 = "You browse through the book, but you can't understand any of it. You don't know enough magical lore. (Improve your Arcane Lore skill to understand books like these.)";
	code =
		if (gf(27,6) == 0) {
			rs(3);
			if (get_stat_total(13) < 10)
				rs(2);
				else {
					rs(4);
					sf(27,6,1);
					alter_stat(30000,75,1);
					}
			}
			else {
				rs(1); rs(2); rs(4);
				}
	break;

begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There are several slith farmers cowering in the back of this home. What with the demon activity outside, they aren't sure if you are an invader or just a magic-induced hallucination.";
	text2 = "All they do is stare at you and shudder. There is nothing to be gained from talking to them.";

begintalknode 9; // servant
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The stone servant is working to burrow out a narrow tunnel to Formello. The construct is starting to crumble. There isn't enough raw magic here to sustain it. And yet, as long as it has a working limb, it will continue to dig.";


// Sage Tobias

begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "There is a small pitiful camp in this cave. A smoky brazier, a filthy bedroll, a miserably small store of food, all next to a dusty magical circle that has not seen use in decades.";
	text2 = "There is a human in mage's robes sitting cross-legged on the bedroll, gnawing on a moldy chunk of roll. He looks up at you, and it takes some time for his eyes to fully process who you are.";
	text3 = "_I ... I ... I had given up. Thought you would never come. I am ... I am Sage Tobias. I have cleared the way. Yes._ He lets out a nervous giggle. He has surrendered at least a little bit of sanity here in these caves.";
	text5 = "Sage Tobias is still sitting on the bedroll, giggling nervously and nibbling at the miserable rations he is able to steal from the slithzerikai. _Still here, eh? I want to help. That's why I came here! To help. Help._";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "Where are you from?";
	text1 = "_Ohhh ... Avernum. Was ... I was from here! A sage in Formello. Had to flee. Went to the Great Cave. Volunteered to come back, to help Captain Esmee clear the way to here. I knew the lands, you see._";
	text2 = "_And then I ... We, we left Esmee behind. We came to here. To find a path._";

begintalknode 12;
	state = 10;
	nextstate = 12;
	condition = 1;
	question = "How have you survived here?";
	text1 = "He scratches at the stone floor with a dirty fingernail. _The horde. Superstition. Bones. They brought many bones. Dumped them. And I used them. Scared the sliths away._";
	text2 = "_Gave me time. For my work._";

begintalknode 13;
	state = 10;
	nextstate = 14;
	condition = gf(170,6) == 0;
	question = "I could use your help.";
	text1 = "Tobias nods. _Oh, yes. Help. Help, I have. Worked hard. Ready to help. Just hoped the slith didn't find me first. Wanted to show off my work._";
	text2 = "_I made a tunnel. A narrow tunnel. It will get you where you need to go. And I can revive you, so you are at full strength when you go to be devoured._";

begintalknode 14;
	state = 10;
	nextstate = -1;
	condition = gf(170,6) > 0 && gf(27,5) == 0;
	question = "The Shadow and the Impaler are dead. Your mission is a success. You should go.";
	text1 = "_I succeeded? We won? I ... I don't think I can. Can go, I mean. I don't think I can be ... Maybe I will stay here. Or not. We will see. Thank you for letting me know._";
	code =
		sf(27,5,1);
		award_party_xp(300,30);
	break;
	
begintalknode 15;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Can you teach me any magic?";
	text1 = "Tobias lets out a high, nervous giggle. _I could. I could have. But I ... I forget a lot now. Only the bones. Only know about the bones._";

begintalknode 16;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "I will be going now.";
	text1 = "_Yes. I will stay here. Stay safe. Here with the bones. The cold bones, always whispering, always ... I will be here. Travel safely._";
	action = END_TALK;
	
begintalknode 17;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "What was your actual mission?";
	text1 = "_To help you, of course. To help infiltrators to get into Formello. It seemed so ... so ..._ His voice trails off.";

begintalknode 18;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "Who did you come here with?";
	text1 = "_Another ... Another mage. She ... She ..._ He starts to shudder uncontrollably. His eyes get wide. _They caught her. Outside these tunnels. Took her to one of her circles. Used her to ... to ... They used her._";
	text2 = "_I fled down here. I was blind. Running. Was luck that I found a place._";

begintalknode 19;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "How long have you been in this cave?";
	text1 = "_Weeks. Me. And the bones._";
	
begintalknode 20;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "You made the skeletons that attacked me?";
	text1 = "_I did. I hope they were not ... They are hard to control, once made. I order them and they ... They whisper. It is hard to talk to them. I can't command them as much as I want._";
	text2 = "_Sorry._";

begintalknode 21;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "The slithzerikai fear the bones?";
	text1 = "_The ones of the tribes, they ... There are superstitions. They hear the bones talk as well as I do. They stay away. Never suspect ... It is not the vengeful dead. It is only little me. Here. With the whispering._";

begintalknode 22;
	state = 12;
	nextstate = 13;
	condition = 1;
	question = "You know about necromancy?";
	text1 = "_It is ... Some would call it fortunate. I read a little of it in my studies. Only to understand, never to use. I never thought I would ... I had to do the mission. Made me do desperate things._";
	text2 = "_But necromancy is easy. One of the easiest sorts of magic, if you don't mind the cost._";

begintalknode 23;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "The cost?";
	text1 = "_It eats you away. Takes bits of your spirit, piece by piece. The true necromancers are the ones who have the gift of keeping themselves despite it._";
	text2 = "He lets out a quick, sharp bark of laughter. _I don't have the gift._";

begintalknode 24;
	state = 14;
	nextstate = 15;
	condition = 1;
	question = "Tell me about the tunnel.";
	text1 = "_I made servants. Good work. Clean work. They found old tunnels under Formello. I knew they were there. They were used once to ... Ancient history. Never mind._";
	text2 = "_Go that way._ He points to the southwest. _You can find your way into Formello. The sewers, only, but you can work from there._";

begintalknode 25;
	state = 14;
	nextstate = -1;
	condition = 1;
	question = "You can revive me?";
	text1 = "_I made pools. Potions. Alchemy. Four basins. The north two heal. The south two recharge. I will open the gates. Use them before you enter the city. You will need all your strength._";
	code =
		sf(27,11,1);
	break;
	
begintalknode 26;
	state = 14;
	nextstate = -1;
	condition = 1;
	question = "Go to be devoured?";
	text1 = "_I ... I am sorry. Misspoke. Was only thinking of ... Of friend. No. You will be fine. Be brave. Be very brave._";

begintalknode 27;
	state = 15;
	nextstate = 16;
	condition = 1;
	question = "What should I do when I enter Formello?";
	text1 = "_I don't know what the city looks like anymore. The slithzerikai have been building nonstop since they entered. Strange. For creatures that used to hate buildings ..._ He shakes his head.";
	text2 = "_It is sad, but the only thing I can tell you is how you might escape. As if survival is possible._";

begintalknode 28;
	state = 16;
	nextstate = -1;
	condition = 1;
	question = "Go on.";
	text1 = "_The city had a portal pylon. In the southeast corner. If you need to flee the city and are trapped, you might try to reach it. I doubt the sliths will have destroyed it. They may have thought they could use it themselves._";

//

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

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

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

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

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

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

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