// TOWN DIALOGUE SCRIPT
//    Town 111: Thompson's Lair

begintalkscript;

variables;

short i,j,k,r1,choice;

// Thompson

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Thompson";
	text1 = "You finally reach Thompson. He is a small, terrified man. It takes some quick talking to convince him you are not Empire agents come to kill him.";
	text2 = "It is difficult, but, luckily, he has been informed of the existence of the vahnatai. When he learns that you are, in fact, the explorers who met them, he suddenly finds you more interesting than threatening.";
	text3 = "He is profoundly relieved that the person who broke into his home is not about to assassinate him. He says, in a weak voice, _Yes, I know you. I've heard of you. I would love to learn of the wonders you have seen, when peace comes at last. I am Thompson. Welcome._";
	text5 = "Thompson smiles weakly. _Anything else? You came a long way to see me. I think I should try to help._";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_It was very difficult to find you. What are you doing here?_";
	text1 = "He bows his head. _Hiding. Cowering, like a vole._";

begintalknode;
	state = 2;
	nextstate = -1;
	question = "_You are like a vole?_";
	text1 = "_Or some other sort of small, grubby creature._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Why did you decide to go into hiding?_";
	text1 = "_I'm not paranoid. Coming here, I was one step ahead of my potential assassins. But I'm safe here, and I can tell you what I have discovered._";

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_Tell me of your discovery._";
	text1 = "He sits. _You see, I was doing research for the Tower of Magi. I was trying to discover coordinates for their portal._";

begintalknode;
	state = 4;
	nextstate = 5;
	question = "_Tell us about the portal._";
	text1 = "_A wondrous creation. It can send you anywhere, if you only know the right thing to chant when you step into it! I was trying to discover the chants. I'd developed a special technique._";

begintalknode;
	state = 5;
	nextstate = 6;
	question = "_Exactly what sort of technique did you develop?_";
	text1 = "_I can travel with my mind, all over Avernum. And I figured out a way to match coordinates with the places where I ended up. But that's technical and not very important. What is important was that one day, when traveling through the ether, I became lost!_";

begintalknode;
	state = 6;
	nextstate = 7;
	question = "_Go on._";
	text1 = "_I traveled too far away to be safe. I wandered for hours, looking for a landmark. And, eventually, I found one. A crumbling pillar, etched with ruins, placed by scouts in the remote regions of Avernum. A pillar that I could use to remember the location._";
	text2 = "_I noted its coordinates, and then I made the mistake of exploring. My spirit wandered a short distance away, and I saw a huge fortress, black and surrounded by lava and chasms! And when I was there, the master of the fort detected me!_";

begintalknode;
	state = 7;
	nextstate = 8;
	question = "_Do you know who detected you?_";
	text1 = "_It was Garzahd! It was his fortress! The power of his mind was great. His identity overwhelmed me. He detected me, and I fled, before he could disrupt me. I finally found my way home, after many more hours, but it was too late. I had the forbidden knowledge._";
	text2 = "_Strangely, this made some sort of link between him and me. I sensed it when you killed him._";
	code =
		if (gf(16,11) == 0)
			rs(2);
	break;
	
begintalknode;
	state = 8;
	nextstate = 9;
	condition = gf(16,11) == 0;
	question = "_What knowledge?_";
	text1 = "_I detected the coordinates to reach Garzahd's fortress, and he knew it. That's why he will stop at nothing to kill me, and anyone who finds him out. And that is why I must tell you that they ..._ He takes a deep breath.";
	text2 = "_The coordinates are Vag Obb Tor._ He sighs. _What a relief._ (You take note of them.)";
	action = SET_SDF 191 11 1;
	code =
		toggle_quest(138,3);
	break;
	
begintalknode;
	state = 9;
	nextstate = -1;
	question = "_Why didn't you tell others the coordinates?_";
	text1 = "_I could not. I would be giving them a death sentence. I can only give the coordinates to those who seek it. As it is I'm still probably a dead man. At least now the secret won't die with me._";

begintalknode;
	state = 1;
	nextstate = 10;
	question = "_You are a wizard? Can you teach me magic?_";
	text1 = "He shudders. _I suppose. I have a lot of time on my hands here. I know a few minor spells._";

begintalknode;
	state = 10;
	nextstate = 11;
	question = "_How do you spend your time?_";
	text1 = "_I can travel with my mind. I explore the area, and I share what I have learned with Avernum._";

begintalknode;
	state = 10;
	nextstate = -1;
	condition = get_prestige() >= 25;
	question = "_Will you teach me some of your spells?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Thompson's Spells","Thompson knows a wide variety of unusually powerful spells.",86,5,3);
	break;

begintalknode;
	state = 10;
	nextstate = -1;
	condition = get_prestige() < 25;
	question = "_Will you teach me some of your spells?_";
	text1 = "_I ... I am afraid not. If you had done more and proved yourself more, maybe. But, for now, I am nervous about sharing my magical knowledge with one as unseasoned as you. No offense._";

begintalknode;
	state = 11;
	nextstate = -1;
	question = "_Learned anything we might find interesting?_";
	text1 = "_Maybe. I have been watching the rakshasa lair to the east. It was tricky to find the way in. There is a secret passage at the east edge of their outer wall._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(16,11) > 0;
	question = "_I have slain Garzahd._";
	text1 = "_I know. I sensed it. I am grateful. I believe, now, I have a chance to survive._";
	text2 = "_And yet, I must hide here. The Empire will still hunt me. They will still want revenge. As long as they own much of Avernum, I cannot leave this miserable cell._";
	

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I must go._";
	text1 = "_And I must stay here. Until the Empire is defeated, I fear they will never stop hunting me. Thank you for your visit._";
	action = END_TALK;

