// TOWN SCRIPT
//    Town 2: Hrefnesholt

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
		set_state_continue(18);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
break;

beginstate 10;
	reset_dialog_preset_options(2);
	choice = run_dialog(0);
	if (choice == 2) {
	flip_terrain(34,11);	
	flip_terrain(35,9);
	}
break;

beginstate 12;
	reset_dialog_preset_options(2);
	choice = run_dialog(0);
	if (choice == 2) {
	message_dialog("The lever clicks forward. Then it slides back. Nothing happens.",
	"");
	flip_terrain(32,11);
	}
break;

beginstate 14;
	set_flag(2,0,1);
break;

beginstate 15;
	reset_dialog();
	add_dialog_str(0,"Scratched on the wall here are some brief words, apparently left by the last inhabitants of this cell:",0);
	add_dialog_str(1,"(Sign of the Wolf) - The message is addressed to whom they thought were their rescuers. Evidently, the prisoners don't know who you are.",0);
	add_dialog_str(2,"_Gone when you arrive: escape under wall. Will head for Hengest._",0);
	add_dialog_str(3,"It seems that the merchants, or at least some large part of them, have made their escape while you distracted the brigands. Castle Hengest lies some distance to the north. Pursuit now might still be in time.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	set_state_continue(14);
break;

beginstate 16;
	if (get_flag(80,1) == 250)
		end();
	message_dialog("As you step out of the door, you notice something. It's a small sign carved on a nearby tree. What's odd is that it's made in the Seawyrm's cryptic system that you studied somewhat on your voyage to this isle.",
	  "It tells you to go southwest.");
	set_flag(80,1,250);
break;

beginstate 18;
	if (get_flag(80,0) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"You are just outside a clearing in the woods. It's clearly not natural: cut-down logs are scattered in various places, and areas show signs of past fires. The details, however, are not your primary concern at the moment. It's what's ahead.",0);
	add_dialog_str(1,"Through the trees, you can see a cloaked green figure, holding a bared sword in his hand. He doesn't yet see you. By the way that he's facing away and taking to someone - or more - beyond, he isn't alone.",0);
	add_dialog_str(2,"This must be the headquarters of the brigands that have recently taken residence and craft in Ravenswood. If so, he's far from alone.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	set_flag(80,0,250);
break;

beginstate 19;
	if (get_flag(80,5) == 250)
		end();
	message_dialog("Another sign is scratched on the tree bark here, prompting you to go a few more paces south.","");
	activate_hidden_group(1);
	set_flag(80,5,250);
break;

