
begintalkscript;

variables;

begintalknode 1;
	state = -1;
	nextstate = 1;
	question = "Guard";
	text1 = "You tentatively approach a friendly-looking Smiley Face. It's standing beside an ornate door. _Hello,_ it says. _I'm a guard. Do you need any help?_";

begintalknode 2;
	state = 1;
	nextstate = -1;
	question = "What do you do here?";
	text1 = "_Well, I guard King Smiley's Throne Room,_ it says. You're pretty sure from its voice that it is male, but they all seem to have the same high-pitched voice.";

begintalknode 3;
	state = 1;
	nextstate = -1;
	question = "Where can I find your King?";
	text1 = "The guard jumps at your words. Clearly his job is very boring. _You want to see the King? He's just through this door._";
	text2 = "Owing to its -- his -- lack of limbs, he merely twists around and faces the door behind him.";

begintalknode 4;
	state = -1;
	nextstate = 2;
	question = "King Smiley";
	text1 = "_Welcome to my throne room,_ booms King Smiley. His voice is very uncharacteristic of a Smiley Face, the voices of those you encountered so far having been high-pitched and squeaky.";
	text2 = "_What has brought you to my precious Vale of Faces?_";

begintalknode 5;
	state = 2;
	nextstate = 3;
	question = "Your majesty, we have come... (Tell the Truth)";
	text1 = "You finish telling your story. The King seems lost in thought. After a while he says, _Then it is not as bad as we thought._";
	text2 = "_We have long known of the Empire's plans for us. But we had not known how easy it would be to lead them astray._";

begintalknode 6;
	state = 3;
	nextstate = -1;
	question = "What do you mean?";
	text1 = "_They have sent you to tell them how strong we are, so they need not waste troops. That is to say that if they were lead to believe we were weak, they would not send a large force._ You start to understand what he's saying.";
	text2 = "_When you return to the Empire, please, tell them of our plague-stricken, dying forces._ He smiles more widely than before.";
	code = 
		set_flag(2,3,1);
		toggle_quest(1,1);
		end();
	break;
begintalknode 7;
	state = 2;
	nextstate = 3;
	question = "I have come to aid the Smileys in... um... whatever needs doing. (Lie)";
	text1 = "King Smiley frowns at you. _We know the truth,_ he says. _There is no need for lies._";
	text2 = "_The truth is that we have known about the Empire for quite some time. And we know what they have planned for us. And we know of your mission._";
	text3 = "_But hopefully you will embrace happiness and lead them astray._";

begintalknode 8;
	state = -1;
	nextstate = 4;
	question = "Cook";
	text1 = "This Frowney Face appears to be two things: female, and cooking. Of course, you're not one hundred percent sure about the female part, but she-- it-- whatever-- is definitely cooking. And she's definitely not happy about it, either.";

begintalknode 9;
	state = 4;
	nextstate = -1;
	question = "What are you doing?";
	text1 = "The Frowney rounds on you. _What does it look like I'm doing?_ she snaps. _I'm cooking, you twit!_";

begintalknode 10;
	state = 4;
	nextstate = -1;
	question = "Do you like cooking?";
	text1 = "The Frowney turns to you, breathing so heavily that steam starts to come from her ears. You had no idea Frowneys could do that.";
	text2 = "Her voice is almost more terrifying than if she had yelled. It's ice-cold and venomous. To make things worse she gives a horrifying smile. _Would you like being forced to cook for a whole castle by an old smiling crackpot?!_";

begintalknode 11;
	state = 4;
	nextstate = 0;
	question = "Is there anything we can do for you?";
	text1 = "The Frowney stops muttering under her breath to turn to you. She is clearly taken aback.";
	text2 = "_Well, um... there is one thing... um..._";
	text3 = "She comes to her senses. _No! Go away! Now! Get out!_";
	action = END_TALK;

begintalknode 12;
	state = -1;
	nextstate = 5;
	question = "Bitter Frowney";
	text1 = "The Frowney Face living in this tiny little room is standing protectively in front of a locked box when you enter. _What do you want?_ he says automatically. _Stay away from my Box._";

begintalknode 13;
	state = 5;
	nextstate = -1;
	question = "Why? What's in your box?";
	text1 = "The Frowney's eyes widen. _No! I can't tell you. Stay away from my box._";
	action = END_TALK;

begintalknode 14;
	state = 5;
	nextstate = -1;
	condition = get_flag(2,4) == 0;
	question = "Is there anything we can do for you?";
	text1 = "The Frowney's eyes widen. _Help? Yes. You can help. The Smiley next door won't let me in there. Go find out what he's hiding._";
	code = 
		toggle_quest(2,1);
		set_flag(2,4,1);
	break;
begintalknode 15;
	state = 5;
	nextstate = -1;
	condition = get_flag(2,4) == 2;
	question = "I found the Smiley's room. (Describe it)";
	text1 = "The Frowney nods. _So they ARE biased against the Frowneys. They give us mediocre lodgings while the Smileys get ivory towers. The King will be hearing from me._";
	text2 = "The Frowney opens his box with a key and indicates for you to take a handful from a pile of shining coins. Why this rich Frowney can't afford better lodgings, the world will never know.";
	code = 
		change_coins(50);
		set_flag(2,4,3);
		toggle_quest(2,0);
	break;
begintalknode 16;
	state = -1;
	nextstate = 6;
	question = "Smiley Face";
	text1 = "This Smiley Face is happily poring over a very heavy tome resting on the desk in front of him. He looks up when you enter and then returns to his reading.";

begintalknode 17;
	state = 6;
	nextstate = 7;
	question = "*Ahem.*";
	text1 = "The Smiley looks up, slightly annoyed. _What do you want?_ he asks.";

begintalknode 18;
	state = 7;
	nextstate = 8;
	question = "What are you reading?";
	text1 = "The Smiley seems a bit flattered. _I'm just poring over these records of this Keep's history. His eyes dart back to the book for a fraction of a second before he looks back at you expectantly.";

begintalknode 19;
	state = 8;
	nextstate = -1;
	question = "The history of Happy Keep? Tell me about it.";
	text1 = "He clears his throat, obviously about to go on a long rant, but what he actually says is very anti-climatic. _There was a war, peace, and then this place was built._";

begintalknode 20;
	state = -1;
	nextstate = 9;
	question = "Priest";
	text1 = "This Smiley is a priest. She-- you think it's female-- seems to be in some sort of a trance, her eyes out of focus. She jumps (or does the Smiley equivalent) when you enter. _Hello,_ she says excitedly. _Are you here to talk to me? I love to talk!_";

begintalknode 21;
	state = 9;
	nextstate = 10;
	question = "What do you do at Happy Keep?";
	text1 = "_Ooh! That's a good question! I like to talk, sometimes I think, and sometimes I spin around!_ She does a twirl, as if to prove this.";

begintalknode 22;
	state = 10;
	nextstate = 11;
	question = "You don't practice Priest Spells?";
	text1 = "_Oh,_ she says. _I forgot about that! Yes! Yes! I love doing that. But I'm not very good. I can only heal! But I'm good at that!_";

begintalknode 23;
	state = 11;
	nextstate = -1;
	question = "You practice healing? Can you heal us?";
	text1 = "_Ooh, yeah! I love healing!_ she squeaks. She concentrates very hard on you, and suddenly you feel completely better. You don't mention that she forgot the price.";
	text2 = "_Oh, so you don't really need healing,_ she says disappointedly. _I wanted to practice._";
	code = 
		clear_strings();
		if (run_select_a_pc(1) == 0) {
			add_string(2);
		}
		else {
		add_string(1);
		restore_pc(get_selected_pc);
	}
	break;
begintalknode 24;
	state = 11;
	nextstate = -1;
	question = "Can you teach us any Priest Spells?";
	text1 = "She appears genuinely sad. _No, I don't think I'm good enough to teach anything._";

begintalknode 25;
	state = -1;
	nextstate = 12;
	question = "Captain Frowney";
	text1 = "For some reason, this Frowney is the only person in here training. He does not seem like this is a fact that makes him happy.";
	text2 = "_What do you want?_ he barks.";

begintalknode 26;
	state = 12;
	nextstate = 13;
	question = "What do you do here?";
	text1 = "Before, he was teetering on the brink of madness. Your question sends him over the edge. _I TRAIN THE SOLDIERS!_ he says. He paused, to let the suspense to build up. _BUT WE DON'T HAVE ANY SOLDIERS!_";

begintalknode 27;
	state = 13;
	nextstate = -1;
	question = "Why not?";
	text1 = "_Well, apparently the Smileys are too wimpy to even learn to weild a sword, let alone kill with it! They'll all be useless when the Empire launches their attack! Select few of them don't scream and run when they see the practice dummies!_";
	action = END_TALK;

begintalknode 28;
	state = 12;
	nextstate = 14;
	condition = get_flag(2,5) == 0;
	question = "Is there anything we can do for the Keep?";
	text1 = "He takes a deep breath, about to go on some rant about the Smileys but pauses when he realizes what you said. _What?_";
	code = 
		set_flag(2,5,1);
	break;
begintalknode 29;
	state = 14;
	nextstate = -1;
	question = "We asked if you had any quests for us?";
	text1 = "_You did...?_ he says, caught off guard.";
	text2 = "He regains his composure. _Oh! You asked if there was anything to do... hmm..._";
	text3 = "_Well, a camp of particularly hostile Frowneys to the east has been bothering us. Of course, if we got some decent soldiers it wouldn't pose a threat...._ He mutters the last bit.";
	code = 
		toggle_quest(3,1);
	break;
begintalknode 30;
	state = 12;
	nextstate = -1;
	condition = get_flag(1,3) == 1 && get_flag(2,5) == 1;
	question = "We killed those Frowneys.";
	text1 = "You can tell from Captain Frowney's reaction that he had not meant for you to come back successful. Or alive. You resist the urge to stick out your tongue as he opens and closes his mouth like a fish.";
	text2 = "At last, he chokes out, _That's wonderful._";
	text3 = "You see no reward forthcoming.";
	code = 
		toggle_quest(3,0);
		award_party_xp(100,3);
		set_flag(2,5,2);
	break;
begintalknode 31;
	state = 12;
	nextstate = -1;
	condition = get_flag(2,5) == 2;
	question = "Shouldn't we get a reward?";
	text1 = "Captain Frowney grumbles something, and conjures a key from seemingly nowhere. _This will get you into the Keep's storerooms. Knock yourself out._";
	code = 
		change_spec_item(1,1);
		set_flag(2,5,3);
	break;
begintalknode 32;
	state = -1;
	nextstate = 15;
	question = "Frowney Mage";
	text1 = "This female Frowney Face appears to be the town's mage. She is still busy grumbling about something when you enter, but quickly catches herself and says, in a forced welcoming voice, _Hello, I am Happy Keep's mage. Is there anything you need?_";

begintalknode 33;
	state = 15;
	nextstate = 16;
	question = "What do you do here?";
	text1 = "Her kind voice falters. _I'm a mage, you id--_";
	text2 = "_I practice magery and I teach it to people who want to learn. Would you like for me to teach you?'";

begintalknode 34;
	state = 16;
	nextstate = -1;
	question = "Yes, please.";
	text1 = "You conclude your work with the Frowney Mage.";
	code = 
		begin_shop_mode("Frowney's Mage Spells","The Frowney Mage at Happy Keep has offered to teach you Mage Spells.",0,4,-1);
	break;
begintalknode 35;
	state = 16;
	nextstate = -1;
	question = "No, thank you.";
	text1 = "The Frowney Mage shrugs. _Whatever,_ she mumbles. _Just make up your mind._";

begintalknode 36;
	state = -1;
	nextstate = 17;
	question = "Lemonhead";
	text1 = "At first glance, this smiley appears to be completely normal. At second glance, not...";

begintalknode 37;
	state = 17;
	nextstate = 18;
	question = "Who are you?";
	text1 = "_Has Captain Frowney sent you to finally kill me?_";
	code = 
		large_draw_pic_dialog(513,"The figure turns to look at you.");
	break;
begintalknode 38;
	state = 18;
	nextstate = 19;
	question = "What the--?";
	text1 = "_So you're like the others. You can't stand the sight of me. But apparently you're not here to finish me off._";
	text2 = "_People think I'm a mutant because I don't look normal. They call me things like 'Lemonhead'. Don't ask me why._";
	text3 = "_They imprisoned me here, and every week Captain Frowney comes to torture me. The injustice of it all..._";

begintalknode 39;
	state = 19;
	nextstate = 20;
	question = "So you're trying to dig yourself out?";
	text1 = "Lemonhead nods. _I've been at it for weeks. When Frowney comes I pretend that everything's normal, and get back to digging when he leaves._";

begintalknode 40;
	state = 20;
	nextstate = -1;
	question = "The door's open, just so you know.";
	text1 = "Lemonhead's eyes widen. You're saying I can go? Yippee!_";
	text2 = "The strange mutant quickly floats by you and out the door. You doubt you'll see him again.";
	action = END_TALK;
	code = 
		erase_char(16);
		set_flag(2,7,1);
		award_party_xp(50,3);
	break;
begintalknode 41;
	state = 20;
	nextstate = -1;
	question = "Well, I'll be going now.";
	text1 = "_Okay, then,_ says Lemonhead. He returns to digging.";
	action = END_TALK;

begintalknode 42;
	state = -1;
	nextstate = -1;
	question = "King Smiley";
	text1 = "You return to King Smiley. He is, as always, happy.";
	text2 = "_You have done well,_ he says. _The Empire has sent only a small force of soldiers. They are hidden in a hill to the northeast. A smiley will ferry you across the river. Your mission is to go there and capture a soldier. Kill the rest._";
	text3 = "King Smiley appears grave. _For some reason the Empire has sent a large force. We know not why. Your orders are to go to their camp under a hill to the northeast, and kill them. A smiley will ferry you across the river.";
	action = END_TALK;
	code = 
		clear_strings();
		if (get_flag(4,1) == 0) {
			add_string(1);
			add_string(2);
			toggle_quest(4,1);
		}
		else {
		add_string(3);
		toggle_quest(5,1);
	}
	set_flag(2,20,1);
	break;
begintalknode 43;
	state = -1;
	nextstate = 21;
	question = "King Smiley";
	text1 = "_I see that you have done as you were ordered,_ booms King Smiley. _I have one more task for you._";

begintalknode 44;
	state = 21;
	nextstate = -1;
	question = "What is it?";
	text1 = "_The Empire is fed up with us. They did not expect so much resistance. They are sending in an army._";
	text2 = "_Without your aid, our Valley will be finished. Please, go back the way you have come and stop the army. We will give you what aid we can._";
	action = END_TALK;
	code = 
		toggle_quest(7,1);
		set_flag(1,29,1);
	break;
begintalknode 45;
	state = -1;
	nextstate = 22;
	question = "Prisoner";
	text1 = "The Empire soldier you abducted from their camp stands, wearing a ragged robe, in this small, incredibly cramped cell.";
	text2 = "_Hello,_ he says. _Did those vicious Faces send you to kill me?_";

begintalknode 46;
	state = 22;
	nextstate = 23;
	question = "No. We're here to ask if you know anything about the Empire's plans.";
	text1 = "He laughs. _Sure, I know the Empire's plans. The question is if I'll tell traitorous scum like you._";

begintalknode 47;
	state = 23;
	nextstate = 24;
	question = "Yes, that's the question, and the answer is yes. Tell us now.";
	text1 = "You manage to make yourself sound commanding. The prisoner is reduced to cowering in the corner of his cell. _I'll tell you,_ he whimpers. _Just don't hurt me._";
	text2 = "_The Empire is sending an Army._";

begintalknode 48;
	state = 24;
	nextstate = 25;
	question = "An Army? What do you mean?";
	text1 = "_Just that. An Army. It's coming to kill all of these atrocities that call themselves Faces. And they'll kill you too, for treason!_";
	text2 = "That's all he's going to say. He turns his back towards you.";

begintalknode 49;
	state = 25;
	nextstate = -1;
	question = "Tell me more, whelp!";
	action = END_TALK;
	code = 
		message_dialog("Suddenly King Smiley's voice rumbles out of the walls around you.","_Do not torture our guest. I have heard all that he said. You must go to this army he spoke of and destroy it._");
		set_flag(1,29,1);
		toggle_quest(7,1);
	break;
