begintownscript;
variables;
short choice;
short i,erase;
short tick;

body;
beginstate init_state;
i = 0;
while(char_ok(i) == 0){
	i = i + 1;
	}
tick = 0;
turn_off_training(1);
if(get_flag(5,1) > 0){
	reward_give(13);
	reward_give(19);
	message_dialog("When you come to, you are lying in pitch darkness in a pit of filth. You have a splitting headache, and your stomach is growling. Your weapons are gone, and you wear only the clothes you had beneath your armor.","But that isn't a huge concern. Who your captors are, why you're here, and where your friends are seems more pressing. All you know for sure is that your cell reaks of decay and no sunlight reaches you here, but that doesn't offer many hints.");
	force_view_center(58,3);
}
if(get_flag(5,2) > 0)
	activate_hidden_group(1);
break;

beginstate start_state;
if(get_flag(5,1) == 1){
	if(tick >= 15){
		message_dialog("Suddenly you hear a noise that is not the squishing of your footsteps through the trash, nor the squeaking of rats or the dripping of the ceiling.","It sounds for all the world like a human voice. And it seems to be coming from the north wall.");
		set_terrain(58,1,407);
		set_flag(5,1,2);
	}
	tick = tick + 1;
}

if((num_chars_in_group(1) == 0) && (get_flag(5,3) > 0) && (get_flag(5,4) == 0)){
	set_flag(5,4,1);
	if(get_flag(2,20) > 0)
		set_flag(4,25,1);
}
if((num_chars_in_group(2) == 0) && (get_flag(5,5) > 0) && (get_flag(5,6) == 0)){
	set_flag(5,6,1);
	message_dialog("As the last banshee departs for the netherworld, wailing all the while, and the last enchanted bone ceases to rattle, you and Fabian are left panting alone in the cold.","_V-V-Vincent, I- can't go on much longer like this._ His teeth chatter as he speaks. The cold is getting to you as well, you feel as though you will colapse. You look up at the imposing peaks ahead and quail.");
	if(get_flag(2,20) > 0)
		set_flag(4,25,1);
}
if((get_flag(4,25) > 0) && (is_combat() == 0)){
	activate_hidden_group(11);
	add_char_to_party(39);
	set_flag(4,25,0);
}

break;

beginstate exit_state;
break;

beginstate 10;
if(get_flag(5,0) > 0){
	block_entry(1);
	reset_dialog();
	add_dialog_str(0,"You pick out a relatively filth-free spot on the floor and curl up to sleep. You are awakened rudely by a kick in the ribs. You rub sleep out of your eyes while trying to estimate how long it's been, it feels as though you just dozed off a minute ago.",0);
	add_dialog_str(1,"Another kick focuses your attention on your captor, a blue humanoid around four feet tall and dressed in hideous rags and furs. A hobgoblin, no surprise here.",0);
	add_dialog_str(2,"_Up, up! Chief says you be getting up now! Big extra big feast today, Gobga won't be missing it for a human, not missing the chance do fighting and drink grog-drink because human is too lazy. Get up quick!_",0);
	add_dialog_str(3,"This last is accompanied by another kick, which finally gets you to your feet. Your captor, as well as another jailer leading Fabian, lead you through dark twisting corridors. You try talking to your friend, but a spear jab discourages you.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	relocate_character(i,53,17);
	set_character_facing(i,4);
	force_view_center(char_loc_x(i),char_loc_y(i));
	force_instant_terrain_redraw();
	pause(10);

	play_sound(69);
	pause(1);
	play_sound(19);
	pause(1);
	play_sound(56);
	pause(1);
	play_sound(70);
	pause(1);
	play_sound(19);
	pause(1);

	reset_dialog();
	add_dialog_str(0,"Stink and noise, that's all you can think about as you step into this room. The chaos around you is mind blowing, a mob of rowdy hobgoblins fight, drink, shout, and expel various bodily odors.",0);
	add_dialog_str(1,"Apparenlty not all the odor is coming from the hobgoblins themselves, next to you boil several large vats of-- liquid. You can't identify it as anything edible, but you do see a piece of strange meat float to the surface.",0);
	add_dialog_str(2,"You are led to a dais in the middle of the room, and tied to a large wooden pole. Fabian stands on the opposite side, with his back to you. You manage to trade some words, as the guards are too busy brawling to notice.",0);
	add_dialog_str(3,"_Looks like it's just me and you, two versus mob. My bonds aren't tight, perhaps if I can work them off and untie yours without them noticing-- they're pretty drunk........_",0);
	add_dialog_str(4,"He doesn't have time to finish his plan. A small hobgoblin, decorated in various trophies and painted with glyphs and runes, steps onto the dais. The mob falls relatively silent, and a blow from the butt of a guard's spear quiets you as well.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	play_sound(27);
	pause(1);
	play_sound(19);
	pause(1);
	play_sound(2);
	pause(1);
	play_sound(72);
	pause(1);
	play_sound(56);
	pause(1);
	play_sound(92);
	pause(1);
	play_sound(72);
	pause(1);
	play_sound(27);
	pause(1);

	relocate_character(14,54,17);
	force_instant_terrain_redraw();
	pause(8);

	reset_dialog();
	add_dialog_str(0,"The hobgoblin shaman, for that must be what it is, begins to speak, _My friendly fellow goblins! Tonight we celebrate with much fighting and drinking, the Big One would be most pleased at our devoutations!_",0);
	add_dialog_str(1,"The other hobgoblins shout and stomp the ground with approbation, but the shaman holds out his hand to quiet them. _This particularly particular Feast of Feeding is a special one, most special indeed!_",0);
	add_dialog_str(2,"_Six tall ones-- strong, proud humans-- have been captured by Rider Gopka, much thanks for this daring feat that is most benevolently helpish to our clan._",0);
	add_dialog_str(3,"More stomping and chearing, this time for the large goblin warrior who stands and bows. One of the smaller goblins even good naturedly punches the Warrior, who spits out one of his teeth and then floors his neighbor with a crack to the head.",0);
	add_dialog_str(4,"The shaman continues, _Yes, six humans, of which the two before you are the strongest and proudest. I thinks the Big One won't be hungering for goblin meat flesh for a while now, eh Ubga?_ A one armed goblin belches in approval.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"_But there are multiple hours before we sound the trumpet, and there is something that isn't to be left undone._ The shaman gives the crowd a toothy smile and reaches into his robe, pulling out a clump of an unidentifiable royal blue herb.",0);
	add_dialog_str(1,"The crowd roars, and each goblin gleefully pulls out and consumes a similar herb. A great brawl ensues, which the shaman watches with approval.",0);
	add_dialog_str(2,"He slowly raises the leaves to his mouth. He chomps them viciously, and blue-black ichor drips down his face. He throws back his head and emits a terrible cry, then leaps onto the back of a nearby goblin to join the fray.",0);
	add_dialog_str(3,"Fabian looks over at you and shakes his head, _Sounds like they have Burden and the others, this is not--_ a grey semisolid glob strikes him in the face, cutting off is words.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	relocate_character(14,58,15);
	play_sound(92);
	pause(1);
	play_sound(72);
	pause(1);
	play_sound(27);
	pause(1);
	play_sound(72);
	pause(1);
	play_sound(56);
	pause(1);
	play_sound(27);
	pause(1);
	play_sound(19);
	pause(1);
	play_sound(2);
	pause(1);	

	reset_dialog();
	add_dialog_str(0,"The herb the hobgoblins ate, whatever it was, has lended a new ferocity to their fighting. Goblins throw themselves at one another with reckless abandon for their own safety or that of their fellows. They get increasingly violent as time passes.",0);
	add_dialog_str(1,"Just as the fighting reaches a feverpitch, and you're sure the goblins will rip themselves limb from limb, the shaman leaps onto the dais and cries, _TO THE FEASTING GROUNDS!_",0);
	add_dialog_str(2,"The other goblins all swivel their heads at the cry, and soon pick it up, _TO THE FEAST! THE FEAST! TO THE FEASTING GROUNDS!_ You and Fabian are untied, and roughly hauled away by the mob of goblins as they follow their shaman.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	relocate_character(i,49,52);
	set_character_pose(i,14);
	force_view_center(49,52);
	force_instant_terrain_redraw();

	reset_dialog();
	add_dialog_str(0,"The goblins carry you out of the twisting maze and into the cold mountain air. The cold is a welcome relief because it means you're out of the stench of the goblin lair. However, that's the least of your concerns.",0);
	add_dialog_str(1,"You and Fabian are laid out on stone slabs and bound fast with cords by several burly warriors. Meanwhile the rest of the rabble dance around the clearing, the flickering fires casting an eerie light on their crazed faces.",0);
	add_dialog_str(2,"The shaman steps onto a raised platform where a massive, grim statue stands. He pulls out a oddly formed horn, carved no doubt from some kind of mountain ram. The crowd falls silent.",0);
	add_dialog_str(3,"The shaman raises the horn to his lips and sounds three successive blasts, low, wailing sounds that must carry for miles. The goblins wait with held breath, for what you don't know.",0);
	add_dialog_str(4,"After about half a minute of anticipation, an answering wail comes to your ears. A familiar noise, one that you've heard twice before, once in your dreams and once that night Erasmus and Rowly were slain.",0);
	add_dialog_str(5,"The goblins shout gleefully at the call, and take their revelry down through the trap door to their lair. Your heart races, and you can't take your eyes off the grim statue in the middle of the clearing-- you know now what it's in the image of.",0);
	add_dialog_str(6,"The Beast of the Rim.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	force_view_center(50,51);
	force_instant_terrain_redraw();
	pause(5);

	force_view_center(51,50);
	force_instant_terrain_redraw();
	pause(5);

	force_view_center(52,50);
	force_instant_terrain_redraw();
	pause(25);


	reset_dialog();
	add_dialog_str(0,"The forest has fallen completely silent, all you can hear is the beating of your own heart, and the noise of Fabian's fast, heavy panting. You both cringe simultaneously as another howl splits the air, this one closer than the last.",0);
	add_dialog_str(1,"Fabian turns to speak to you, and you tear your eyes from the gruesome visage of the statue. _Some way to go, eh friend? I can think of a lot of better ways to die, more noble, more enjoyable-- the type they sing songs about._",0);
	add_dialog_str(2,"His voice shakes, _But I suppose it had to happen sometime, and at least I'm in good company._ He smiles wrly, and you return it.",0);
	add_dialog_str(3,"He leans his head back on the cold marble slab, _I was looking at the sky while we were marching the other day, was it only yesterday? Anyway, I was-- was thinking how much closer to the stars we must be way up here._",0);
	add_dialog_str(4,"_Not often you're this close the heavens, eh Vincent?_ You stare up at the stars with him, indeed they do seem brighter, larger, closer-- as if all your life you'd been seeing them through a shroud, and only now so near to death is it cast off.....",0);
	add_dialog_str(5,"Wait, what was that?",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	text_bubble_on_char(i,"!!!");
	text_bubble_on_char(11,"!!!");
	force_view_center(47,49);
	activate_hidden_group(10);
	force_instant_terrain_redraw();
	play_sound(49);
	pause(6);

	relocate_character(6,45,50);
	relocate_character(7,45,53);
	set_character_facing(6,4);
	force_instant_terrain_redraw();
	play_sound(49);
	pause(5);

	relocate_character(6,45,51);
	set_character_facing(6,4);
	relocate_character(7,46,52);
	set_character_facing(7,4);
	force_instant_terrain_redraw();
	play_sound(50);
	pause(5);

	relocate_character(6,46,51);
	set_character_facing(6,6);
	relocate_character(7,46,53);
	set_character_facing(6,4);
	text_bubble_on_char(i,"");
	text_bubble_on_char(11,"");
	force_instant_terrain_redraw();
	play_sound(49);
	pause(5);

	relocate_character(6,47,50);
	set_character_facing(6,6);
	relocate_character(7,47,53);
	set_character_facing(7,6);
	force_instant_terrain_redraw();
	play_sound(50);
	pause(5);

	set_character_pose(6,2);
	set_character_pose(7,2);
	force_instant_terrain_redraw();
	play_sound(49);
	pause(5);

	reset_dialog();
	add_dialog_str(0,"Orrin and Private Evrey scramble down the cliff face at break neck speeds. The moment they hit the ground their blades are in their hands.",0);
	add_dialog_str(1,"*Swish!* And Orrin's broadsword knifes through Fabian's bonds like butter. *Hack!* and Evrey's halberd saws through the ropes binding you just as quickly. You spring to your feet, just as another roar comes from the woods to the east.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	relocate_character(6,48,48);
	relocate_character(7,48,52);
	force_view_center(49,50);
	force_instant_terrain_redraw();
	play_sound(49);
	pause(5);

	set_character_pose(6,1);
	force_instant_terrain_redraw();
	play_sound(69);
	pause(3);

	set_character_pose(6,2);
	set_character_pose(7,1);	
	play_sound(71);
	force_instant_terrain_redraw();
	pause(3);

	relocate_character(i,49,51);
	relocate_character(11,49,49);
	set_character_pose(i,0);
	set_character_pose(7,2);
	set_character_pose(11,0);
	set_character_facing(i,2);
	set_character_facing(11,2);
	force_instant_terrain_redraw();
	pause(5);

	text_bubble_on_char(11,"What took you so long?");
	force_instant_terrain_redraw();
	pause(12);

	text_bubble_on_char(11,"");
	text_bubble_on_char(7,"Save it Fabian!");
	force_instant_terrain_redraw();
	pause(12);

	text_bubble_on_char(7,"");
	text_bubble_on_char(6,"THE TRAPDOOR!");
	force_instant_terrain_redraw();
	pause(12);

	set_character_facing(i,6);
	set_character_facing(11,6);
	text_bubble_on_char(6,"");
	relocate_character(6,49,49);
	relocate_character(7,49,51);
	relocate_character(i,50,51);
	relocate_character(11,50,49);
	force_instant_terrain_redraw();
	play_sound(49);
	pause(5);

	relocate_character(6,50,50);
	relocate_character(7,50,51);
	relocate_character(i,51,51);
	relocate_character(11,51,49);
	force_instant_terrain_redraw();
	play_sound(50);
	pause(5);

	text_bubble_on_char(i,"It's locked from the inside.");
	force_instant_terrain_redraw();
	pause(12);

	text_bubble_on_char(i,"");
	text_bubble_on_char(11,"SHIT!");
	force_instant_terrain_redraw();
	pause(12);

	text_bubble_on_char(11,"");
	text_bubble_on_char(6,"Stand back.");
	force_instant_terrain_redraw();
	pause(12);

	text_bubble_on_char(6,"");
	force_instant_terrain_redraw();
	play_sound(48);

	set_character_pose(6,1);
	force_instant_terrain_redraw();
	play_sound(2);
	play_sound(108);
	pause(2);

	reset_dialog();
	add_dialog_str(0,"Another roar echoes off the cliff walls as the Beast draws nearer, and this time you can hear the crackling of snapped foliage as it charges through the dense forest. You have seconds before it is upon you, and you and Fabian aren't even armed.",0);
	add_dialog_str(1,"All eyes are on Orrin as he pulls out his second broadsword and steps back. He lunges at the trapdoor, throwing all his wait into his swing. The force of the blow splinters the solid pine door, and knocks it from it's hinges.",0);
	add_dialog_str(2,"As the others scramble down through the hole, you stare back into the woods. A terrible black, hulking form is rapidly approaching. The Beast is larger, more horrible than you imagined, the statue did it no justice. It's eyes.....",0);
	add_dialog_str(3,"And now those eyes are only a stone's throw away from you.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	relocate_character(i,51,62);
	force_view_center(51,62);
	force_instant_terrain_redraw();
	play_sound(48);

	reset_dialog();
	add_dialog_str(0,"Darkness. Darkness and a great weight pressing down on you. The sound of slavering jaws and gnashing teeth comes from above, and the feeling of slime and muck from beneath you.",0);
	add_dialog_str(1,"The weight shifts, then whispers, _What the hell were you doing out there, Vincent? This mountain will be my grave site, but not yet. Keep your wits together._",0);
	add_dialog_str(2,"Orrin rolls off of you, then slithers away, further into the goblin lair. A miracle that you were saved, and another miracle that your friend managed to drag you to safety. What WERE you thinking back there?",0);
	add_dialog_str(3,"The eyes, yellow hate filled eyes.... You shake the image away, then cautiously stand up. The shaft above you leads nearly ten feet up, and you fell the whole way down. The fall knocked the wind right out of you.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
	move_to_new_town(6,61,58);
}
break;

beginstate 11;
	move_to_new_town(6,36,58);
break;

beginstate 12;
block_entry(1);
if(get_flag(5,2) == 0){
	activate_hidden_group(1);
	set_flag(5,2,1);
	message_dialog("This path leads further into the mountains, but the ground slopes sharply, turning into jagged, nearly vertical rock faces at some points. As you look up at the trail your heart drops-- how are you going to get past this?","Apparently the same thing occurs to Fabian. _I-- I don't think I can climb that thing, Vincent. I'm just too tired, and I don't think the others could make it either. We'll have to turn back, find the others, and tell them what we found._");
}
else
	message_dialog("The ground slopes sharply here, turning into jagged, nearly vertical rock faces at some points. Fabian was right, even if you somehow mustered the strength to scale it there is no way the rest of the group could. You turn back.","");
break;


beginstate 13;
if((get_flag(5,2) > 0) && (get_flag(5,7) == 0)){
	set_flag(5,7,1);
	reset_dialog();
	add_dialog_str(0,"Sergeant Burden and the others have caught up with you. Burden stands in front awaiting your report, and the others take the time to catch their breaths.",0);
	add_dialog_str(1,"_Vincent! Fabian! You look awful, what the hell happened to you? Did you find anything?_ You tell her about your encounters with the spirits of the mountain, as well as the steep trail ahead.",0);
	add_dialog_str(2,"She listens thoughtfully as you speak, and nods when you finish. _You did well to return, you are in no condition to climb a mountain and neither are we._",0);
	add_dialog_str(3,"_Orrin, Evrey!_ The two approach and ask what is demanded of them. _Are you feeling alright? Can you scout ahead while the rest of us get a fire going and thaw out?_",0);
	add_dialog_str(4,"_Always at your disposal, Sarge,_ the highlander responds. He surveys the land nearby, _I'd advise you get out of the cold, this cave seems uninhabited._",0);
	add_dialog_str(5,"Burden nods, _Sound advice. Move out!_ The two men march off towards the steep trail that turned you away earlier, Orrin plowing through the snow effortlessly and Evrey following closely in the wake he clears.",0);
	add_dialog_str(6,"The rest move towards the cave, you are all too eager to follow.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
	erase = 12;
	while(erase <= 37){
		if(char_ok(erase) > 0)
			erase_char(erase);
		erase = erase + 1;
	}
	erase_char(4);
	set_flag(2,20,0);
}
break;

beginstate 14;
message_dialog("This trail leads down from the mountains-- backtracking will get you no closer to your destination. Sergeant Burden and the others will catch up soon enough, for now you need to scout ahead.","");
block_entry(1);
break;

beginstate 15;
if(get_flag(5,3) == 0){
	set_flag(5,3,1);
	activate_hidden_group(2);
	play_sound(40);
	if(get_flag(2,20) > 0)
		erase_char(4);
}
break;

beginstate 16;
if(get_flag(5,5) == 0){
	set_flag(5,5,1);
	activate_hidden_group(3);
	message_dialog("You and Fabian are no longer alone. Spectral warriors rise out of the ground before and behind you, and banshees fly screeching from the dizzying cliff nearby.","You and Fabian draw your weapons and stand back to back, slowly turning to survey the situation. _Looks like we're surrounded. I'd by lying if I said I weren't damn tired, but if we go down we'll go down together._ You nod, and then the spirits rush you.");
	if(get_flag(2,20) > 0)
		erase_char(4);
}
break;

beginstate 17;
if(get_flag(5,7) > 0){
	block_entry(1);
	message_dialog("The others have already gone inside the cave, and likely have a warm fire already started. You turn back, preferring the warmth and rest to a pointless trip down the mountain.","");
}
break;

beginstate 101;
	set_flag(2,20,1);
	message_dialog("Fabian falls to the ground, worn down by exhaustion, the cold, and his many wounds. He quickly scrambles up and leaves the battle, saying _Sorry Vincent, you'll have to handle the rest of them on your own, I'm done for now._","");
break;