// TOWN DIALOGUE SCRIPT
//    Town 21: Spider Cave

begintalkscript;

variables;

short i,j,k,r1,choice;

// Spider

begintalknode;
	tag = 10;
	state = -1;
	nextstate = 1;
	question = "Spider";
	text1 = "This is a very large spider watching you carefully through a wall of webbing. When you get close, it steps out to greet you. It isn't hostile. _Hi! My name's Spider!_ It has a squeaky, high-pitched voice. _This is our wall!_";
	text5 = "The guard spider watches you.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 6;
	question = "_What are you doing?_";
	text1 = "_I guard the wall!_ It points at the cracked wall, apparently in case you didn't see it.";

begintalknode;
	state = 6;
	nextstate = 7;
	question = "_Who built the wall?_";
	text1 = "_People! They made it! Then they left! Now it's ours!_";

begintalknode;
	state = 7;
	nextstate = -1;
	question = "_Why did they leave?_";
	text1 = "_Other people came. Empire people, I guess you guys call them. Chased the other people off. I don't really understand. It's people stuff._";

begintalknode;
	state = 1;
	nextstate = 3;
	question = "_May I ask what the wall is for?_";
	text1 = "_We guard it in case the nasty spiders come! They're nasty!_";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Why would the nasty spiders come here?_";
	text1 = "_We're at war with the evil spiders! They're mean!_ It hisses loudly, to clarify the point.";

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_What makes them so nasty?_";
	text1 = "_Good question! You're smart! Nasty spiders cast evil magic spells and burn and hurt us. They sneak in somehow and they harm us. It's bad._";

begintalknode;
	state = 4;
	nextstate = 5;
	question = "_Do you need any help dealing with them?_";
	text1 = "_Yeah! Yeah yeah yeah! You big cute folks can help us! Find the mayor spider and he'll tell you how to help us._";
	text3 = "_You already did, silly! Thanks! You're great!_";
	action = DEP_ON_SDF 21 7 1;

begintalknode;
	state = 5;
	nextstate = -1;
	question = "_Where might this mayor spider be found?_";
	text1 = "_Uhhh ... I don't know. Around somewhere. Maybe sort of that way._ The spider points to the northwest.";

// Spider

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 28;
	question = "Spider";
	text1 = "A huge, hairy spider is pacing side to side behind the crumbling wall. When you get close, it turns to look at you. _Hello!_ It bounces up and down a little when it says it. _I'm Spider!_";
	text5 = "The guard spider divides its attention between watching the barrier and talking to you.";
	action = INTRO;

begintalknode;
	state = 28;
	nextstate = 29;
	question = "_Hi. What is your job?_";
	text1 = "_I'm a guarding spider!_";

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_Guarding against what?_";
	text1 = "_Evil spiders, silly! If any evil spiders come, I do the Spider Dance of Alarm, and I bite 'em! I got big fangs!_";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Can you do the Dance of Alarm for me now?_";
	text1 = "_I can't do it for you, silly! There's no alarm!_";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Can I see your fangs?_";
	text1 = "_Yeah! Look!_ It opens its mouth and hisses alarmingly. One thing is for sure. These spiders may not be very bright, but they have fangs the size of your forearm with venom sacs to match. _Cool, huh?_";

begintalknode;
	state = 28;
	nextstate = -1;
	question = "_Is there anything I can to do to help you spiders?_";
	text1 = "_Talk to Spider._ It points a foreleg at the guard on the other side of the entrance. _Spider can tell you about things we need help with._";

// Spider

begintalknode;
	tag = 50;
	state = -1;
	nextstate = 55;
	question = "Spider";
	text1 = "This little spider, only as high as your knee, is dragging around a web bag of bugs twice as large as it is. It bounces a little when it sees you. _I'm Spider!_";
	text5 = "The spider continues to try, with difficulty, to drag the bag of bugs around.";
	action = INTRO;

begintalknode;
	state = 55;
	nextstate = 57;
	question = "_Where'd you get these bugs?_";
	text1 = "_Around here mostly. It's hard to find good bugs and gnats and stuff, but there are some, and we find 'em!_";

begintalknode;
	state = 57;
	nextstate = 55;
	condition = 1;
	question = "_Why?_";
	text1 = "_Because that is what we eat. For food. You are not very smart._";

begintalknode;
	state = 57;
	nextstate = 55;
	condition = 1;
	question = "_Oh._";
	text1 = "Spider nods. This was a satisfactory answer.";

begintalknode;
	state = 55;
	nextstate = 56;
	question = "_That's quite a batch of bugs you got there._";
	text1 = "_Yes! I help wrap up bugs. That's all they let me do._ It looks sad for a moment. At least you think that's what it looks like. Then it perks up. _But someday, I'll be a warrior spider!_";

begintalknode;
	state = 56;
	nextstate = -1;
	question = "_So you really want to be a warrior?_";
	text1 = "_Yeah! Watch this!_ It leaps straight up into the air, about the height of your waist. Then it lands. _I don't know what good doing that is, but it's a good start!_";

begintalknode;
	state = 55;
	nextstate = -1;
	condition = gf(21,20) == 0;
	question = "(Help Spider move the bag of bugs.)";
	text1 = "You help Spider move the heavy bag. The little spider is beside itself with appreciation.";
	action = SET_SDF 21 20 1;

begintalknode;
	state = 55;
	nextstate = -1;
	condition = gf(21,20) > 0;
	question = "(Continue to help Spider move the bag of bugs.)";
	text1 = "Spider hisses at you. _Don't patronize me!_";

// Spider

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 82;
	question = "Spider";
	text1 = "A giant spider wanders around forlornly. _Hi, I'm Spider,_ it says to you. It sounds glum.";
	text5 = "Spider still looks sad.";
	action = INTRO;

begintalknode;
	state = 82;
	nextstate = 83;
	question = "_Is anything the matter?_";
	text1 = "_I have to look for a new mate._";

begintalknode;
	state = 83;
	nextstate = 84;
	question = "_What happened to your old mate?_";
	text1 = "It sighs. _My old mate got eaten up by aranea. It's all sad and stuff._ It looks up at you hopefully. _You need a mate? I have big pedipalps!_";

begintalknode;
	state = 84;
	nextstate = -1;
	question = "_Pedipalps?_";
	text1 = "_Yeah!_ It waves around two small, arm-like appendages near its mouth. It's clear its heart isn't in it. _Oh well. I'm going to go catch some gnats._";
	action = END_TALK;

begintalknode;
	state = 84;
	nextstate = -1;
	question = "_Ewww. We would never mate with you. Get away from me!_";
	text1 = "It backs away. _You're mean!_ it turns its abdomen to you and walks away.";
	action = END_TALK;

begintalknode;
	state = 84;
	nextstate = -1;
	question = "_Uhhh ... I already have a mate. Sorry?_";
	text1 = "_Figures. Thanks anyway._ It slouches off.";
	action = END_TALK;

// Spider

begintalknode;
	tag = 90;
	state = -1;
	nextstate = 109;
	question = "Spider";
	text1 = "A spider is busy practicing for battle. It jumps back and forth, brandishing its eight-inch long fangs and just generally looking impressive. Then it mistimes a jump and flips onto its back. It gets up again and looks at you. _Hi! I'm Spider!_";
	text5 = "The warrior spider keeps jumping around, practicing for battle.";
	action = INTRO;

begintalknode;
	state = 109;
	nextstate = 110;
	question = "_What are you practicing for?_";
	text1 = "_I'm a warrior spider! I'm on a big quest!_";

begintalknode;
	state = 110;
	nextstate = -1;
	question = "_A warrior spider?_";
	text1 = "_We need all the fighters we can get! We're big and tough, but the aranea got spells! Zap!_ It jumps straight up into the air, executes a flying kick, fails to land safely, and thuds to the ground. _Ow. I'm still working on that one._";

begintalknode;
	state = 110;
	nextstate = 111;
	question = "_What quest are you on?_";
	text1 = "It quivers in aggravation. _Those aranea took our babies! They stole a big bunch of eggs. We need to get them back, before nasty magic things get done to them! You should ask Spider about it. He's our leader._ It starts practicing again.";
	text3 = "_Well, our eggs got brought back, so now I'm working on catching a fly. They're really fast and small._ It leaps into the air, bites at something, and crashes to the ground. _Ow._";
	action = DEP_ON_SDF 21 7 1;

begintalknode;
	state = 111;
	nextstate = -1;
	condition = gf(21,7) <= 1;
	question = "_I could use a quest. Where can I find Spider?_";
	text1 = "_Wow! You're brave! The mayor Spider gives all of the quests. I don't know where he is now, though. Maybe in the mighty audience hall._ It points to the northwest.";

begintalknode;
	state = 109;
	nextstate = 112;
	condition = 1;
	question = "_Your battle techniques intrigue me._";
	text1 = "_Really? Want some tips?_";

begintalknode;
	state = 112;
	nextstate = -1;
	condition = 1;
	question = "_Sure._";
	text1 = "_First, grow giant fangs like these._ He bares his fangs, each a foot long and dripping venom. _That's a pretty good start. Then, when your foe comes close, bite it. Not only will you be victorious, but you can also then have dinner!_";

// Spider

begintalknode;
	tag = 110;
	state = -1;
	nextstate = 136;
	question = "Spider";
	text1 = "This spider eyes you intently. It walks up close to you. Very close. Worryingly close. _Hi. I'm Spider. You're cute._";
	text5 = "Spider continues to invade your personal space. Its leg hairs brush against you.";
	action = INTRO;

begintalknode;
	state = 136;
	nextstate = 137;
	question = "_Uh ... Hi._";
	text1 = "_You're cute!_";

begintalknode;
	state = 137;
	nextstate = 138;
	question = "_OK. Thanks, I guess._";
	text1 = "_Would you like to come back and see my web? I have a big mealworm. It's fresh!_";

begintalknode;
	state = 138;
	nextstate = -1;
	condition = 1;
	question = "_Fresh?_";
	text1 = "_I just paralyzed it today!_";

begintalknode;
	state = 138;
	nextstate = -1;
	question = "_A mealworm for me?_";
	text1 = "_Yummy! And just big enough for two. You're cute!_ It runs off, thinking you're going to follow. You don't.";
	action = END_TALK;

begintalknode;
	state = 136;
	nextstate = -1;
	question = "_Eeek! A spider! Get away! Get away!_";
	text1 = "You have hurt the poor little creature's feelings deeply. It slouches away sadly.";
	action = END_TALK;

// Spider

begintalknode;
	tag = 130;
	state = -1;
	nextstate = 163;
	question = "Spider";
	text1 = "One of the spiders is leading around a bunch of other, smaller spiders. The smaller ones must be a different species. Their markings are entirely different. The large spider stops when it sees you. _Oh, hi! My name is Spider._";
	text5 = "Spider continues to struggle to keep her multitude of charges in line.";
	action = INTRO;

begintalknode;
	state = 163;
	nextstate = 164;
	question = "_What are you doing with those little spiders?_";
	text1 = "_I'm trying to teach these dumb spiders things. It's hard._";

begintalknode;
	state = 164;
	nextstate = 165;
	question = "_What are you teaching them?_";
	text1 = "_Yeah! Like how to fight and make web baskets and talk and dance and stuff. They're pretty dumb, though._";

begintalknode;
	state = 165;
	nextstate = -1;
	question = "_Why are you taking care of the dumb spiders?_";
	text1 = "_They get all big like us, but they can't talk and they aren't as cute. A bunch of them live in tunnels here. We leave 'em alone, because they're spiders and aren't mean. But be careful, 'cause they'd probably eat you. They're silly._";
	text2 = "One of the smaller spiders tries to wander off. Spider runs off to collect it and return it to the herd.";
	action = END_TALK;

// Spider

begintalknode;
	tag = 150;
	state = -1;
	nextstate = 190;
	question = "Spider";
	text1 = "This spider carries around a huge egg sac, bigger than your head. It gives a happy little hop when it sees you. _My name is Spider. I've heard of you! Spider told me about you._";
	text5 = "Spider is still carefully guarding its large egg sac.";
	action = INTRO;

begintalknode;
	state = 190;
	nextstate = 191;
	question = "_Are those spider eggs?_";
	text1 = "_Yup, I'm being careful with these eggs. If they got stolen, it would be real sad._";

begintalknode;
	state = 191;
	nextstate = 192;
	question = "_Who would steal your eggs?_";
	text1 = "_A bunch of our eggs got taken by aranea!_ It hisses in anger. _It's true!_";

begintalknode;
	state = 192;
	nextstate = -1;
	question = "_Who are the aranea?_";
	text1 = "_The evil magic spiders. Talk to Spider about it! He's our mayor! If you brought them back, we'd give you valuable, silly things for them!_ ";
	text3 = "_The evil magic spiders you fought!_ It runs up and kisses you on the knee. _Thank you for our eggs! Now I got to make sure it doesn't happen again!_ It hisses.";
	action = DEP_ON_SDF 21 7 1;

// Spider

begintalknode;
	tag = 170;
	state = -1;
	nextstate = 217;
	question = "Spider";
	text1 = "A spider runs up and kisses you on the leg. It feels like a very light pinch. _My name's Spider! Pleased to meet you!_";
	text5 = "Spider looks up at you, its many eyes glistening with adoration.";
	action = INTRO;

begintalknode;
	state = 217;
	nextstate = 218;
	question = "_What is your job here?_";
	text1 = "_I build walls with webs!_";

begintalknode;
	state = 218;
	nextstate = 219;
	question = "_You can build walls out of webs?_";
	text1 = "_I'm a webbing spider. I helped build the big web wall! Aranea and their dumb spiders can get through it, but it slows 'em down, and we beat 'em up! We have big battles._";

begintalknode;
	state = 219;
	nextstate = 220;
	question = "_Why do you fight other spiders?_";
	text1 = "_They attack us. I don't know why. Maybe they want our bugs. Spider says they want our cave. Spider, on the other pedipalp, says they really hate us. But I have my own theory!_ Spider moves closer, as if to whisper it to you.";

begintalknode;
	state = 220;
	nextstate = -1;
	question = "You whisper, _What's your theory?_";
	text1 = "_I think they do it because they're very, very silly._ Satisfied that he delivered this insight, he walks off to build more webs.";
	action = END_TALK;

// Little Spider

begintalknode;
	tag = 190;
	state = -1;
	nextstate = 244;
	question = "Little Spider";
	text1 = "A tiny spider, only a foot long, cowers from you when you get close. _Eeek! Eeeeek!_ It says.";
	text5 = "The tiny spider continues to cower. _Eeeek! Eeek! Eeeeeeek! Eee! Eeeek!_";
	action = INTRO;

begintalknode;
	state = 244;
	nextstate = -1;
	question = "_Boo._";
	text1 = "_Eeeeeeeeeeeeeee!_ It runs away in terror.";
	action = END_TALK;

begintalknode;
	state = 244;
	nextstate = 245;
	question = "_Hello, little one._";
	text1 = "_Eeek! Eeeeek!_";

begintalknode;
	state = 245;
	nextstate = -1;
	question = "_Eeek, eeee._";
	text1 = "_Yeah! Eeeeeeeeeeeeek!_ It jumps up and down in enthusiastic terror. Then it runs away.";
	action = END_TALK;

// Spider

begintalknode;
	tag = 210;
	state = -1;
	nextstate = 271;
	question = "Spider";
	text1 = "A spider paces around dejectedly. It is missing one of its forelegs. _Hi. I'm Spider._ It speaks with the normal spider high-pitched voice, but it's clearly unhappy.";
	text5 = "Spider paces back and forth nervously. Its missing forelegs causes its to walk slowly and awkwardly.";
	action = INTRO;

begintalknode;
	state = 271;
	nextstate = 274;
	question = "_What are you up to?_";
	text1 = "_I was a big warrior spider. Once. Now I just weave webs._";

begintalknode;
	state = 274;
	nextstate = -1;
	condition = 1;
	question = "_Is there something wrong with that?_";
	text1 = "_No. It's just boring. It's rather be out being a hero and awesome._";

begintalknode;
	state = 271;
	nextstate = 273;
	question = "_How did you lose your foreleg?_";
	text1 = "_I was on a raid to get our eggs back from the nasty aranea. We fought a bunch of 'em outside their lair. I bit into one of them, but, before my venom got to it, it zapped my leg off. I have to weave webs until it grows back._";
	text2 = "It slumps slightly. _It's all sad and stuff._";

begintalknode;
	state = 273;
	nextstate = -1;
	question = "_What happened to your eggs?_";
	text1 = "_The aranea stole a bunch of eggs from us. They're mean! Spider is looking for help to get them back. And I can't give it. Humph!_";
	text3 = "_The aranea stole them, but then you brought them back! It's all great! Now no spiders have to get hurt like me. Thanks!_ It kisses you on the leg.";
	action = DEP_ON_SDF 21 7 1;

begintalknode;
	state = 272;
	nextstate = -1;
	question = "_How do you weave webs?_";
	text1 = "_Like all spiders do, silly! And it's boring. I can't wait for my leg to grow back._";

// Spider

begintalknode;
	tag = 230;
	state = -1;
	nextstate = 298;
	question = "Spider";
	text1 = "This spider is practicing its Leap-Chomp Combo Moves. When it sees you, it carries out a perfect high jump and lands right in front of you, hissing all the way. Before you can defend yourself, it withdraws its fangs and chirps, _I'm Spider!_";
	text5 = "Spider continues to execute his exciting and elaborate martial arts moves.";
	action = INTRO;

begintalknode;
	state = 298;
	nextstate = 299;
	question = "_Practicing?_";
	text1 = "_I'm getting ready to attack the aranea!_ It jumps up, executes kicks with three of its legs in succession, and lands with fangs brandished. _Neat, huh!_";

begintalknode;
	state = 299;
	nextstate = 300;
	question = "_When will you attack the aranea?_";
	text1 = "_Soon, they'll let me go to the pool, and then we'll go on a raid._";

begintalknode;
	state = 300;
	nextstate = 301;
	question = "_What pool is that?_";
	text1 = "_We have a pool of white stuff that makes the aranea webs not affect you. All you gotta do is rub it on you! We all put it on before we go on raids. That shows 'em!_";
	text2 = "_Just don't drink it. It's all icky, and if you've rubbed it on you it messes that up too. Blah._";

begintalknode;
	state = 301;
	nextstate = -1;
	question = "_This pool sounds very useful. Where can I find it?_";
	text1 = "_Oh, it's near here somewhere. Not far away._";

// Spider

begintalknode;
	tag = 250;
	state = -1;
	nextstate = 325;
	question = "Spider";
	text1 = "A spider runs around frantically, spinnerets out, apparently trying to get its web in order. _I'm Spider!_ it says breathlessly as it runs by.";
	text5 = "The web-building spider runs quickly back and forth, maintaining its webs.";
	action = INTRO;

begintalknode;
	state = 325;
	nextstate = -1;
	question = "_I wish I could make webs._";
	text1 = "_You should! It's really cool. It's like living in a house, but that house came out of your body!_";

begintalknode;
	state = 325;
	nextstate = 326;
	question = "_Why are you hurrying about?_";
	text1 = "_I can't talk! I got a potential mate coming by! She's cute!_";

begintalknode;
	state = 326;
	nextstate = -1;
	question = "_I guess you can't beat a potential mate._";
	text1 = "_Yeah! She's nice, too! She says she won't try to devour me or anything! Gotta run._ It takes some nicely wrapped gnats and bugs and leaves them on the ground by the web.";
	action = END_TALK;

// Spider

begintalknode;
	tag = 270;
	state = -1;
	nextstate = 352;
	question = "Spider";
	text1 = "This is a giant spider. However, it's smaller than the others and has different markings. It also doesn't seem friendly.";
	text5 = "This spider doesn't say anything. It just looks at you.";
	action = INTRO;

begintalknode;
	state = 352;
	nextstate = -1;
	question = "_Hello?_";
	text1 = "It just stares. You don't think this is one of the smart, friendly spiders. You think it's just one of the dumb spiders who can't talk. At least it's not attacking you.";
	action = END_TALK;

// Spider

begintalknode;
	tag = 290;
	state = -1;
	nextstate = 379;
	question = "Spider";
	text1 = "A spider sits calmly in the center of the cave, perched on a crumbling throne. It has a calm, dignified air of authority absent in the other giant, intelligent, friendly talking spiders. It nods to you as you approach.";
	text2 = "_Welcome to our amazing audience hall!_ The moment it speaks, its aura of quiet dignity fades away. _I am Spider! I am the mayor here!_";
	text5 = "The mayor continues to sit in its sort of throne thing. _I am still Spider! What else can I do for you, human. Or whatever you are._";
	action = INTRO;
	
begintalknode;
	state = 379;
	nextstate = -1;
	question = "_Nice chair._";
	text1 = "_Really? Thanks! It was left by the people who lived here. Then they ran away._";

begintalknode;
	state = 379;
	nextstate = 380;
	question = "_Who are you?_";
	text1 = "_I'm the mayor, the sacred leader of the spiders here, and leader in worship of the Great Spider Goddess! But you could probably tell._ You couldn't.";
	
begintalknode;
	state = 380;
	nextstate = -1;
	question = "_How did you become mayor?_";
	text1 = "_Well, we didn't have a mayor. So, one day, I came in here and started telling spiders to do things. Then they did what I said. So that makes you mayor, right?_";

begintalknode;
	state = 380;
	nextstate = -1;
	question = "_The Great Spider Goddess? What is she like?_";
	text1 = "_She's like a spider, but really, really, really big! And she eats bugs the size of, well, uhh, really, really, really big bugs! And she's cute too._";

begintalknode;
	state = 380;
	nextstate = 381;
	question = "_What does a spider mayor do?_";
	text1 = "_Right now I direct the war against the great, evil aranea. They cast magic spells, but they're wimpy if you get up by them, and you can beat them up. We're silly, but we're tough too, and we have big, big fangs!_";
	text2 = "_We're really mad at them, because they stole our babies._";

begintalknode;
	state = 381;
	nextstate = 382;
	condition = gf(21,7) <= 1;
	question = "_Can I help recover your stolen babies?_";
	text1 = "It jumps up and down with joy. _Would you? Wow! You're the best person ever! The nasty aranea live in a cave to the south. They're mean and dangerous. If you find our eggs and return them, I have something very, very nice for you._";
	text2 = "_Watch out, though. The aranea put up lots of webs and stuff to keep you out._";
	action = SET_SDF 21 7 1;
	code = 
		sf(21,7,1);
		toggle_quest(8,1);
	break;

begintalknode;
	state = 382;
	nextstate = -1;
	condition = 1;
	question = "_What is my reward?_";
	text1 = "_Not telling! It's a big surprise! But it's on a dead Empire soldier, so you can bet it's pretty great!_";

begintalknode;
	state = 382;
	nextstate = -1;
	condition = 1;
	question = "_How can I enter the aranea lair?_";
	text1 = "_Well, you can be a spider. Then the webs won't stick to you._";
	text2 = "_If that doesn't work, we have a pool around here somewhere. Rub its goop on you, and you can slip through their webs._";
	
begintalknode;
	state = 379;
	nextstate = -1;
	condition = gf(21,7) == 1 && has_spec_item(2) > 0;
	question = "_I did it! I recovered your eggs!_ (Give the egg sac to the spider.)";
	code =
	run_hardcode(5);
	break;

begintalknode;
	state = 379;
	nextstate = -1;
	condition = gf(21,7) >= 2;
	question = "_When did the humans you trapped come here?_";
	text1 = "_I don't know. Not long ago. They were stalking some other humans. Maybe the ones who lived in these caves before they ran away. They hid in here. They saw us, and they started attacking. Very, very bad humans._";

begintalknode;
	state = 379;
	nextstate = -1;
	condition = gf(71,7) == 1;
	question = "_What else can you tell us about the aranea?_";
	text1 = "_They protect their lairs with lots of really sticky webs. We have a pool though, full of goo which helps us pass their webs. Rub the goo on yourselves, and you will be able to pass their webs too._";
	text2 = "_Neat, huh?_";

