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

body;
beginstate init_state;
activate_hidden_group(5);
i = 0;
while(char_ok(i) == 0){
	i = i + 1;
}
set_character_facing(i,0);
//Fabian
set_char_dialogue_pic(6,305,0);
set_char_dialogue_pic(29,305,0);
//Jamie
set_char_dialogue_pic(7,306,0);
//Ainsley
set_char_dialogue_pic(11,1907,0);
//Evrey
set_char_dialogue_pic(8,1957,0);
set_char_dialogue_pic(30,1957,0);
//Erasmus
set_char_dialogue_pic(9,300,0);
set_char_dialogue_pic(10,300,0);
set_char_dialogue_pic(24,302,0);
//Orrin
set_char_dialogue_pic(12,304,0);
set_char_dialogue_pic(27,304,0);
//Rowly
set_char_dialogue_pic(13,301,0);
set_char_dialogue_pic(26,302,0);
set_char_dialogue_pic(32,301,0);
//Adrianna
set_char_dialogue_pic(15,1959,0);
set_char_dialogue_pic(28,1959,0);
//Burden
set_char_dialogue_pic(14,303,0);
set_char_dialogue_pic(25,302,0);
set_char_dialogue_pic(31,303,0);

break;

beginstate start_state;
if((get_flag(1,17) == 0) && (get_flag(1,8) >= 10)){
	set_flag(1,17,1);
	message_dialog("It has been a long day. You've spent the whole afternoon marching, and it is now nearly midnight. Your muscles feel like jelly, and you long to lay on your mat by the fire and doze off.","Tomorrow you will have enough problems without exhaustion being added to the list.");
}
if(tick == 0){
	set_character_pose(12,1);
	tick = 1;
}
else{
	set_character_pose(12,0);
	tick = 0;
}
break;

beginstate exit_state;
break;

beginstate 10;
if(get_flag(1,0) == 3){
	block_entry(1);
	end();
}
message_dialog("This bonfire crackles merrily, sending sparks and tongues of flame into the cold mountain air. One of the glowing red logs pops loudly and collapses; all that is left of the wood floats away in the form of ash and smoldering embers.","It's beautiful and a bit hypnotic, but more importantly it is warm. You set another piece of firewood in the fire, so long as this burns the coming night should be bearable.");
break;

beginstate 11;
block_entry(1);
if(get_flag(1,0) == 0){
	reset_dialog();
	add_dialog_str(0,"You carefully step out onto a barely submerged rock. You test your footing at each step, not wishing to slip into the icy cold water rushing around you.",0);
	add_dialog_str(1,"A sharp voice almost ruins it for you, _Captain Ainsley specifically said he was not to be followed. Please, Vincent, be patient. Go warm yourself by the fire; there will be plenty of marching tomorrow._",0);
	add_dialog_str(2,"The voice belongs to Sergeant Burden, she is second in command behind Ainsley. You turn back towards the shore; Ainsley, Jamie, and Ewett can handle scouting across the river.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
}
if(get_flag(1,0) == 1)
	message_dialog("Your orders were to stay nearby and try to rest while Sergeant Burden decides what the plan of action will be. You can't say you have any great desire to hike by yourself in the darkness anyhow.","");
if(get_flag(1,0) == 2)
	message_dialog("You shouldn't wander off alone with a dangerous creature on the loose. Burden's decision was to stay in camp for the night; you should get some sleep in preparation for when you break camp tomorrow morning.","Your sleeping bag by the fire is seeming more and more appealing.");
if(get_flag(1,0) == 3)
	message_dialog("Burden has made her decision, and it doesn't involve hiking across the river. The road to Amon Sul lies to the north; that is where your fellows are headed and where you should follow.","");
break;

beginstate 12;
block_entry(1);
if(get_flag(1,0) == 0)
	message_dialog("This is the trail down to Manibor village. Captain Ainsley ordered the party to pitch camp and for nobody to stray away; with night coming it would be foolhardy to try to hike down the mountain.","You wisely turn back; you have no desire to either disobey a direct order or break your neck stumbling off a cliff.");
else
	message_dialog("You've hiked this route before; you feel confident that you could find your way back to Manibor below, even in the dark. However, that would mean abandoning the mission and your friends.","This mission may be doomed for disaster, but leaving now would leave the party with one less able bodied man. Ainsley and Jamie deserve better than to freeze to death on the Spire.");
break;

beginstate 13;
block_entry(1);
if(get_flag(1,0) <= 1)
	message_dialog("This path leads higher into the mountains, away from the friendly light of the fire and into the darkness.","Your orders were to stay in camp and you didn't need to be told twice; the howling wolves disturb you here, but they are held at bay by the fire and voices of humans. The same mightn't be true out in the darkness.");
if(get_flag(1,0) == 2)
	message_dialog("Burden has made her decision; the troop will stay here for the night. You can hardly argue, one look at Ainsley and Jamie tells you they need to spend several hours warming by a fire before they could even hope to move.","You don't relish the idea of just sitting here and hoping the Beast doesn't strike, but doing the same out in the darkness would be infinitely worse. For some strange reason you feel safe by the fire; you'd be quaking in fear if it were extinguished.");
if(get_flag(1,0) == 3){
	reset_dialog();
	add_dialog_str(0,"You hike up the trail into the mountains, though calling it a trail is really being too generous. It's little more than a deer path, and often you have to leave the 'path' to avoid a boulder or obstacle.",0);
	add_dialog_str(1,"It's a pleasant atmosphere. The wolf cries left with the darkness of night, as did, to some extent, the bitter cold. It's hard to believe a storm is brewing.",0);
	add_dialog_str(2,"Fabian speaks as you hike, _We'll just stick to this path, Burden and the rest can't be far ahead._",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
	move_to_new_town(2,30,61);
}
break;

beginstate 14;
message_dialog("This is a pile of fire wood. It was quite a chore to cut it down, you know because you were one of the ones doing the cutting, but it will be well worth it when night sets in and you have a fire giving you warmth.","");
break;

beginstate 15;
if((get_flag(1,0) == 0) && (get_flag(1,17) > 0)){
	block_entry(1);
	reset_dialog();
	if(get_flag(1,6) == 1)
		add_dialog_str(0,"You sit down on your sleeping mat by the fire. Evrey still plays his flute, and Fabian has closed his eyes and nods his head to the rhythm. He is startled by a sudden wolf cry, but soon shuts his eyes again. You likewise relax.",0);
	else
		add_dialog_str(0,"You sit down on your sleeping mat by the fire. You stare into the fire in silence, across from you Fabian leans back on his hands and stares up at the sky. He almost jumps out of his skin when a wolf cry breaks the quiet.",0);
	add_dialog_str(1,"You are just about to doze off when a shout from the north jolts you upright. It sounded like Erasmus.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
	play_sound(20);
	set_total_visibility(1);
	force_view_center(10,3);
	force_instant_terrain_redraw();
	pause(3);

	text_bubble_on_char(9,".....");
	force_instant_terrain_redraw();
	pause(12);

	activate_hidden_group(2);
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"!!!!");
	force_instant_terrain_redraw();
	pause(12);

	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"Captain Ainsley! How did it go?");
	force_instant_terrain_redraw();
	pause(16);

	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"You don't look so good sir....");
	relocate_character(17,9,1);
	relocate_character(16,10,1);
	force_instant_terrain_redraw();
	pause(16);	

	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"*Gasp*");
	relocate_character(17,9,2);
	relocate_character(16,10,2);
	force_instant_terrain_redraw();
	pause(16);	

	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"EVERYBODY COME QUICK!");
	set_character_pose(17,14);
	set_character_pose(16,14);
	force_instant_terrain_redraw();
	pause(16);

	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"SOMETHING'S WRONG WITH THE CAPTAIN!");
	force_instant_terrain_redraw();
	pause(16);

	erase = 6;
	while(erase <= 15){
		erase_char(erase);
		erase = erase + 1;
	}
	activate_hidden_group(4);
	activate_hidden_group(5);
	set_char_dialogue_pic(24,302,0);
	set_char_dialogue_pic(26,302,0);
	set_char_dialogue_pic(28,1959,0);
	set_char_dialogue_pic(25,302,0);
	relocate_character(i,10,5);
	set_character_facing(i,0);
	force_instant_terrain_redraw();

	pause(2);
	reset_dialog();
	add_dialog_str(0,"That was the shout that roused you and everybody else in the party from your beds. In a flash everybody is by the Captain and Jamie's side, all traces of weariness gone.",0);
	add_dialog_str(1,"It takes only one glance to see that something is very wrong. The two men are soaked, and both have some minor wounds. They have both collapsed from exhaustion and most likely hypothermia.",0);
	add_dialog_str(2,"Even more distrubing, there were three men who went on the scouting trip. Ewett, your companion and the healer of Unit 341, is not among the two that have returned. Those around you have clearly noticed this as well.",0);
	add_dialog_str(3,"Orrin stoops to pick up Captain Ainsley and carry him to the fire, and Burden and Evrey do the same for Jamie. Everybody follows closely, concerned about their friends and what news they bring.",0);
	add_dialog_str(4,"You aren't kept in suspense for long. Ainsley recovers his senses even as Orrin picks him up, and begins stammering out a report. His teeth chatter so violently that he can hardly speak.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"_We-- we f-f-f-found the p-p-prints. He said-- he said-- Ewett said that they w-w-w-were s-s-strange to him-- mmmust have b-b-been at least fi-fi-five hundred pounds to make so d-d-deep a mark._",0);
	add_dialog_str(1,"_But then-- then, a howl-- n-n-no a roar, so t-t-terrible and so close. Our blades were still in our s-s-sc-scabbards when the thing came upon us. T-t-terrible, so dark, nothing so huge. Bulky as a grizzly, but n-n-nimble as a cat._",0);
	add_dialog_str(2,"_We f-f-f-fought it, but-- but nothing could faze it. Fly! Fly! We r-r-r-ran, and it gave ch-ch-chase, but it turned back to-- to-- to-- oh god, oh god. Ewett was down! No don't t-t-turn back, just run. The river, n-n-no time to ford, dive in._",0);
	add_dialog_str(3,"_The thing- the *B-B-B-Beast* gave chase-- when--when it was done. But the river-- we shook it off at the rr-rr-river._",0);
	add_dialog_str(4,"He becomes incoherent at this point. Orrin lays him beside the fire, and Burden and Evrey set down Jamie beside him. Orrin pulls out a vial from his belt and holds it to Ainsley's lips, as Erasmus fetches blankets.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"The next minutes are tense ones. Everybody stands around Ainsley and Jamie, while Erasmus tends to them. After a while, he stands up and adresses you.",0);
	add_dialog_str(1,"_I have done all I can for them. The only thing that remains is to keep them by the fire and give their bodies time to warm. If they survive tonight then they're in the clear._ Not terribly heartening, but it could be worse.",0);
	add_dialog_str(2,"Burden steps forward, _I will consult with Erasmus on what our course of action will be. In the meantime, try your best to get some rest._ She steps away from the campfire, followed closely by Erasmus and with Sir Rowly tagging along.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	erase = 6;
	while(erase <= 23){
		erase_char(erase);
		erase = erase + 1;
	}
	activate_hidden_group(1);
	relocate_character(i,11,10);
	set_character_pose(7,14);
	set_character_pose(11,14);
	set_character_pose(30,14);
	set_character_facing(i,4);
	force_view_center(11,10);
	force_instant_terrain_redraw();
	set_flag(1,0,1);
	set_total_visibility(0);
set_char_dialogue_pic(29,305,0);
set_char_dialogue_pic(7,306,0);
//Ainsley
set_char_dialogue_pic(11,1907,0);
set_char_dialogue_pic(30,1957,0);
set_char_dialogue_pic(10,300,0);
set_char_dialogue_pic(24,302,0);
set_char_dialogue_pic(27,304,0);
set_char_dialogue_pic(26,302,0);
set_char_dialogue_pic(32,301,0);
set_char_dialogue_pic(28,1959,0);
set_char_dialogue_pic(25,302,0);
set_char_dialogue_pic(31,303,0);
	end();
}
if(get_flag(1,0) == 1){
	reset_dialog();
	add_dialog_str(0,"Your earlier rest was far too brief, but your blood is now coursing with adrenaline from the shock of seeing your friends stumble into camp.",0);
	add_dialog_str(1,"Your muscles still feel tired from yesterday's march, but ultimately your anxiety over your friends' condition and dread of what tomorrow holds for you trumps the exhaustion of your body. You couldn't sleep, not now.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);
	end();
}
if(get_flag(1,0) == 2){
	block_entry(1);
	reset_dialog();
	add_dialog_str(0,"The burst of energy you felt when Ainsley and Jamie first staggered into camp slowly fades away as the adrenaline that brought it leaves your body.",0);
	add_dialog_str(1,"You feel bone tired. It's been a long day marching followed by the emotional shock of Ewett's death, you want nothing more than to lay in your mat and forget the day's troubles.",0);
	add_dialog_choice(0,"Go to sleep.");
	add_dialog_choice(1,"Stay awake.");
	choice = run_dialog(1);
	if(choice == 2)
		end();
	message_dialog("At first you lay awake, troubled by thoughts of the day. However, it doesn't take long for exhaustion to drag you to a troubled sleep.","");
	set_terrain(11,16,1);
	set_terrain(11,17,1);
	set_terrain(11,18,1);
	set_terrain(12,16,1);
	set_terrain(12,18,1);
	set_terrain(13,16,1);
	set_terrain(13,17,1);
	set_terrain(13,18,1);
	force_view_center(12,17);
	relocate_character(i,12,17);
	set_character_pose(i,14);
	force_instant_terrain_redraw();
	pause(5);
	play_sound(20);
	
	reset_dialog();
	add_dialog_str(0,"You dream that you stand on the peek of Mount Spire. The view is amazing, to the south extends are several snow capped peaks, but none are tall enough to obstruct your view of the lowlands beyond. You can see for miles.",0);
	add_dialog_str(1,"The view, however; is the last thing you are thinking about. Your hands are bound behind you around a great tree-- an oak so wide your arms don't even wrap halfway around it and so tall that when you look up you can't see its top.",0);
	add_dialog_str(2,"You struggle at your bonds but to no avail. The woods are completely silent, even the wolf howls have ceased. Terror seizes you-- you don't know why but the woods around you seem malevolent and horrible. You struggle even harder.",0);
	add_dialog_str(3,"Out of the corner of your eyes you can see the edge of the forest on either side of you. A scuffling sound comes from the woods, you crane your neck further and further in an attempt to see the source. Your heart races.",0);
	add_dialog_str(4,"A creature approaches.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"The Beast, for that is what you named it in your heart even before you heard the noises from the forest, draws closer. You close your eyes and swallow hard, stealing yourself to confront your foe and meet its eyes before you die.",0);
	add_dialog_str(1,"Nothing could prepare you for the creature that stands before you. It is a huge hulk of rippling muscle, but all you see are its eyes. Fierce, fiery eyes that pierce you like blades.",0);
	add_dialog_str(2,"A mighty roar emits from its cavernous mouth, an echoing wail that rumbles in your stomach. It takes you a moment to realise that your voice is lifted in a blood curdling scream, it is so dwarfed by the creature's howling.",0);
	add_dialog_choice(0,"OK");
	choice = run_dialog(1);

	message_dialog("You are mercifully awoken by a pain in your ribs accompanied by a familiar voice, _Hey, am I going to have to stand here kicking you all day? Burden says to get your lazy ass up, everybody else is already packed and on the road._","");
	erase = 6;
	while(erase < 33){
		erase_char(erase);
		erase = erase + 1;
	}
	set_flag(1,0,3);
	activate_hidden_group(7);
	set_terrain(12,15,137);
	set_char_dialogue_pic(33,305,0);
	set_flag(254,5,0);
	set_ticks_forward(5650 - get_current_tick());
	set_terrain(11,16,0);
	set_terrain(11,17,0);
	set_terrain(11,18,0);
	set_terrain(12,16,0);
	set_terrain(12,18,0);
	set_terrain(13,16,0);
	set_terrain(13,17,0);
	set_terrain(13,18,0);
	set_character_pose(i,0);
	force_instant_terrain_redraw();
	
}
break;

beginstate 16;
if((get_flag(1,21) == 0) && (get_flag(1,0) == 3))
	begin_talk_mode(106);
break;