
begintalkscript;

variables;
int revive;
string resurrect;

begintalknode 10;
	state = -1;
	nextstate = 10;
	question = "Martha";
	text1 = "This woman is dressed in robes similar to those of an apprentice mage. However, they differ enough to suggest that she is no longer an apprentice. Her eyes practically glow with rage as she notices you.";
	text2 = "_Good, adventurers. You saw those cowards? We're facing a catastrophe here, and those bastards would rather save a few books and their own skins. Unbelievable!_";
	text3 = "_Well it doesn't matter now, because you're going to help me. And no, you don't get a choice. My name is Martha, and you're going to help me save the fabric of time._";
	text5 = "Martha taps her foot imatiently.";
	text6 = "_Well, get on with it!_";
	action = INTRO;
	code = 
		if(get_flag(0,3) == 1)
			message_dialog("Martha anxiously paces the archives, arms loaded with scrolls and tomes. She occasionally stops to glance at a paragraph or two.","_What? What do you want?_");
	break;
begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = get_flag(0,3) == 0;
	question = "Um... okay?";
	text1 = "She nods. _Good. Now listen carefully if you want us to make it out of this alive._";
	text2 = "_My mentor is a powerful mage named Ethalia. I've worked with her for years, and so I know things about her that other people don't. Her colleagues wonder how she commands such power, but I know._";
	text3 = "_Back when she was an apprentice herself, she summoned a demon from the Distant Realms. She bargained with it for power, and took the deal. I never learned the terms, but it doesn't matter now._";
	text4 = "_For whatever reason, Ethalia decided that she regrets the deal. And this lead her to experiment with her power. Are you with me so far?_";

begintalknode 12;
	state = 11;
	nextstate = 12;
	question = "I think so.";
	text1 = "_Good. Now, I've helped Ethalia with her experiments for years, and quite frankly, they have a theme. She has been obsessed for years with controlling the flow of time. For the longest time, her efforts were purely theoretical._";
	text2 = "_Lately, they have taken an unusually practical turn. She has perfected a few spells that speed up her own actions, and can very easily slow the actions of others. I thought that would be the end of it. Of course, I was wrong._";
	text3 = "_She busied me with research in the archives, all about portals. Specifically, the exact manner in which portals maintain a folded conduit in space linking two areas, without risking an implosion throughout the range._";
	text4 = "_No sooner had I produced a meaningful equation modeling the exact distortion, than she sent me to work in the alchemy lab. Of course, I knew something was amiss. Understand?_";

begintalknode 13;
	state = 11;
	nextstate = -1;
	question = "Not really.";
	text1 = "Martha sighs.";
	text2 = "_My mentor Ethalia made a deal with a demon. That clear enough?_";

begintalknode 14;
	state = 12;
	nextstate = 13;
	question = "Um... yes?";
	text1 = "_Okay, good. So of course I wasn't going to stick around in the alchemy lab, not when I was sure that my mentor was about to do something foolish. I went down to check on her, and the door to the test chamber was locked._";
	text2 = "_I knocked, and all I could hear was Ethalia chanting. I thought for a second that I was overreacting, and then it felt like a bolt of lightning struck the building. I could hear howling winds and loud crackling, and then the door flew off the hinges._";
	text3 = "_Inside, the room was swirling with raw elemental magic. At the center of the test chamber, there was a portal, and there was Ethalia. She stepped into the portal and disappeared._";
	text4 = "_She's joked to me that if she had the chance, she'd go back and decline the demon's deal. But I think she finally did it. She went back in time... do you understand?_";

begintalknode 15;
	state = 13;
	nextstate = 14;
	question = "I think I get it.";
	text1 = "_Naturally, the other researchers fled as soon as they felt the explosion. Those test chambers are built to contain anything, and if they don't it's immediate grounds for evacuation. But I didn't expect them to be such cowards._";
	text2 = "_But it doesn't matter, because you're here, and you get to help. You see, there's a major problem with Ethalia's portal. I said earlier that I had researched an exact measure of the portal's preservation of the folds of space intervening._";
	text3 = "_Here's the problem: it's only calibrated for the specifics of space. The challenges presented by chronological leaps are immense, even more so when you factor in antichronological leaps like Ethalia's. It can't work the same way._";
	text4 = "_But she forced the portal's structure with her power, and now it's unstable. You're familiar with unstable portals, hopefully. Well this is a hundred, no, a thousand times worse. I won't bother with the specifics, you don't want to know. Are we clear?_";

begintalknode 16;
	state = 13;
	nextstate = -1;
	question = "...wait, what?";
	text1 = "_She went back in time, dammit._";

begintalknode 17;
	state = 14;
	nextstate = 15;
	question = "Um, yes?";
	text1 = "_Good. Now the portal itself isn't the worst part. I can close the portal, particularly since I think I know the formulas she used. The real problem lies in what Ethalia could do if she attempted to change the course of history._";
	text2 = "_The slightest change, propagated throughout time, can result in untold changes down the timeline. In fact, it could invalidate the trip back itself, resulting in a time paradox. The results of that... well, the world would have to adjust._";
	text3 = "_That adjustment could take any form. We don't know exactly which fork of time the world would take, and we could cease to exist. Or the timeline could attempt to integrate both realities, which would be... messy. And destructive._";
	text4 = "_So now that you know exactly what we're up against, let me tell you what I want from you. Are you still following?_";

begintalknode 18;
	state = 14;
	nextstate = -1;
	question = "Uh...";
	text1 = "Martha's eyes flash with frustration.";
	text2 = "_She made a portal, it's not stable. Better?_";

begintalknode 19;
	state = 15;
	nextstate = -1;
	question = "Close enough, yes.";
	text1 = "_Good, good. Now, there's little we can do here apart from close the portal, and that won't help prevent a paradox. It would just trap Ethalia in the past, and ideally we can rescue her._";
	text2 = "_This means that you'll have to use the portal. I need to stay here to keep it under control, to the best of my ability. But you need to use the portal in test chamber B, go back in time, and convince Ethalia not to meddle._";
	text3 = "_Let me repeat that, just to be perfectly clear. You get to use the portal, go back in time, and stop Ethalia. Bring her back if you can._";
	text4 = "_Now quick, go down to the test chamber and use the portal. I need to go find those scrolls and see if I can correct the portal's deviation before the flux consumes it._";
	text5 = "With that, she runs off, leaving you alone and confused.";
	action = END_TALK;
	code = 
		set_flag(0,3,1);
		toggle_quest(0,1);
		set_mobility(6,1);
		set_creature_memory_cell(6,0,0);
		relocate_character(6,13,10);
		force_instant_terrain_redraw();
	break;
begintalknode 20;
	state = 15;
	nextstate = -1;
	question = "Not in the slightest.";
	text1 = "Martha glares at you.";
	text2 = "_We need to fix it, or we're done for._";

begintalknode 21;
	state = 10;
	nextstate = -1;
	condition = get_flag(0,3) == 1;
	question = "What was I supposed to do again?";
	text1 = "_Go downstairs, use the portal, and stop Ethalia from altering history,_ she snaps at you, before going back to her books.";
	action = END_TALK;

begintalknode 22;
	state = 12;
	nextstate = -1;
	question = "Not really.";
	text1 = "She growls.";
	text2 = "_She's been working on this for a long time. Moving on._";

