// Town 2: West Riverbank
begintownscript;

variables;

short choice,i,j,k;
string dlgstr;

body;

beginstate INIT_STATE;
	set_crime_tolerance(2);
	
	set_name(6,"Legare"); // ID 200
	set_name(7,"Kass"); // ID 201
	
if (get_flag(2,0) == 0) {
	set_flag(2,0,1);
	force_instant_terrain_redraw();
	message_dialog("You approach the edge of the river. Nearby, there is a camp; Legare and Kass have been staying here for a short time. You hear voices to the southeast. If you want to talk with Legare or Kass, they are there.","Judging by past experience, they're likely to have a mission for you immediately, so if you want to do any more looking around in Vasskolis, you should probably get that done before you talk to them.");
	}
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
if (get_flag(2,1) != 0)
	end();
	
	block_entry(1);
	
	reset_dialog();
	add_dialog_str(0,"Are you ready to speak with Legare and Kass, receiving your first assignment?",0);
	add_dialog_choice(0,"No. (Turn back.)");
	add_dialog_choice(1,"Yes. (Proceed).");
	if (run_dialog(1) == 1)
		end();
	
	set_flag(2,1,1);
	
	text_bubble_on_char(7,"... a Darkling! He can't be trusted!");
	march_party(18,18);
	force_view_center(18,18);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(19,19);
	force_view_center(19,19);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(20,20);
	force_view_center(20,20);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(21,21);
	force_view_center(21,21);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(22,22);
	force_view_center(22,22);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 3);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"Oh.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	if (party_size() > 1)
		text_bubble_on_char(7,"Hello, adventurers.");
	else
		text_bubble_on_char(7,"Hello, adventurer.");
	set_character_facing(7,2);
	march_party(23,22);
	force_view_center(23,22);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(24,22);
	force_view_center(24,22);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 4);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"It's good to see you.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"We have work to do.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	force_instant_terrain_redraw();
	
	message_dialog("_It turns out,_ he continues, _that passing through the steel gates was just a preliminary. We have a long river journey ahead of us before we can reach the homeland that our ancestors knew. We are almost ready to begin that journey._","");
	
	text_bubble_on_char(7,"Before we go, we need you to...");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 4);
	
	activate_hidden_group(2);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	text_bubble_on_char(7,"");
	relocate_character(8,16,16);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	text_bubble_on_char(8,"Kass!");
	relocate_character(8,17,17);
	set_character_facing(8,5);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	relocate_character(8,18,18);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	relocate_character(8,19,19);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"Prophet!");
	relocate_character(8,20,20);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	relocate_character(8,21,20);
	set_character_facing(8,6);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	relocate_character(8,22,20);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	relocate_character(8,23,20);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(7,"What is it, Talas?");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	force_instant_terrain_redraw();
	
	reset_dialog();
	add_dialog_str(0,"The story comes tumbling out of his mouth. _Watchers in the west have spotted an army! We think it's Gnass! They've found the alternate tunnel down!_",0);
	add_dialog_str(1,"A hurried discussion follows. Apparently the sliths of Gnass, who think that Legare's quest is blasphemy, found the tunnel that leads directly from Avernum to Vasskolis. They must have followed someone coming down that way.",0);
	add_dialog_str(2,"Presumably you.",0);
	run_dialog(1);
	
	text_bubble_on_char(8,"They are coming to wipe us out!");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(7,"What shall we do, Prophet?");
	set_character_facing(7,4);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(7,"The boats are not ready yet!");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(7,"");
	text_bubble_on_char(6,"Gather everyone here.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"I will consult with the Goddess.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"All will be well.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	erase_char(8);
	text_bubble_on_char(6,"");
	force_instant_terrain_redraw();
	
	reset_dialog();
	add_dialog_str(0,"Talas runs back to Vasskolis to tell everyone to leave the city in a hurry. Kass stares at Legare, watching and waiting, as do you. Legare, meanwhile, closes his eyes and begins to pray.",0);
	add_dialog_str(1,"Minutes pass as hours. Legare communes with his goddess. You and Kass can only wait.",0);
	add_dialog_str(2,"Suddenly Legare opens his eyes. You hear the commotion of dozens of sliths coming this way carrying all of their worldly possessions, and you hear the shouts of an army not too far behind them.",0);
	add_dialog_str(3,"As they arrive, Legare turns to the river, his hands outstretched over the river towards the sky.",0);
	run_dialog(1);
	
	activate_hidden_group(1);
	set_character_facing(6,6);
	text_bubble_on_char(6,"O Goddess,");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"let what you have ordained");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"BE!");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	set_character_pose(6,1);
	set_height(28,21,4);
	set_height(28,22,4);
	set_height(28,23,4);
	set_height(28,24,4);
	set_height(28,25,4);
	set_height(29,21,4);
	set_height(29,22,4);
	set_height(29,23,4);
	set_height(29,24,4);
	set_height(29,25,4);
	set_height(30,21,4);
	set_height(30,22,4);
	set_height(30,23,4);
	set_height(30,24,4);
	set_height(30,25,4);
	set_height(31,21,4);
	set_height(31,22,4);
	set_height(31,23,4);
	set_height(31,24,4);
	set_height(31,25,4);
	set_floor(28,21,0);
	set_floor(28,22,0);
	set_floor(28,23,0);
	set_floor(28,24,0);
	set_floor(28,25,0);
	set_terrain(28,21,106);
	set_terrain(28,22,106);
	set_terrain(28,23,106);
	set_terrain(28,24,106);
	set_terrain(28,25,106);
	run_animation_sound(65);
	
	set_character_pose(6,0);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	set_character_pose(6,1);
	set_height(29,21,3);
	set_height(29,22,3);
	set_height(29,23,3);
	set_height(29,24,3);
	set_height(29,25,3);
	set_height(30,21,3);
	set_height(30,22,3);
	set_height(30,23,3);
	set_height(30,24,3);
	set_height(30,25,3);
	set_height(31,21,3);
	set_height(31,22,3);
	set_height(31,23,3);
	set_height(31,24,3);
	set_height(31,25,3);
	set_floor(29,21,0);
	set_floor(29,22,0);
	set_floor(29,23,0);
	set_floor(29,24,0);
	set_floor(29,25,0);
	set_terrain(29,21,106);
	set_terrain(29,22,106);
	set_terrain(29,23,106);
	set_terrain(29,24,106);
	set_terrain(29,25,106);
	run_animation_sound(65);
	
	set_character_pose(6,0);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	set_character_pose(6,1);
	set_height(30,21,2);
	set_height(30,22,2);
	set_height(30,23,2);
	set_height(30,24,2);
	set_height(30,25,2);
	set_height(31,21,2);
	set_height(31,22,2);
	set_height(31,23,2);
	set_height(31,24,2);
	set_height(31,25,2);
	set_floor(30,21,0);
	set_floor(30,22,0);
	set_floor(30,23,0);
	set_floor(30,24,0);
	set_floor(30,25,0);
	set_terrain(30,21,106);
	set_terrain(30,22,106);
	set_terrain(30,23,106);
	set_terrain(30,24,106);
	set_terrain(30,25,106);
	run_animation_sound(65);
	
	set_character_pose(6,0);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	set_character_pose(6,1);
	set_height(31,21,1);
	set_height(31,22,1);
	set_height(31,23,1);
	set_height(31,24,1);
	set_height(31,25,1);
	set_floor(31,21,0);
	set_floor(31,22,0);
	set_floor(31,23,0);
	set_floor(31,24,0);
	set_floor(31,25,0);
	set_terrain(31,21,106);
	set_terrain(31,22,106);
	set_terrain(31,23,106);
	set_terrain(31,24,106);
	set_terrain(31,25,106);
	
	set_floor(27,26,27);
	set_floor(28,26,27);
	set_floor(29,26,27);
	set_floor(30,26,27);
	set_floor(31,26,27);
	set_floor(28,20,23);
	
	set_character_pose(6,0);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	message_dialog("As you stare on in amazement, the river itself parts! The approaching sliths stop for a moment, daunted by the prospect of descending into the now-dry land between the walls of water.","Legare turns.");
	
	set_character_facing(6,2);
	text_bubble_on_char(6,"DO NOT FEAR.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"THE GODDESS IS WITH US.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"WALK UNHARMED ON DRY LAND");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	text_bubble_on_char(6,"IN THE MIDST OF THE WATERS.");
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 5);
	
	text_bubble_on_char(6,"");
	force_instant_terrain_redraw();
	
	reset_dialog();
	add_dialog_str(0,"As the sliths begin to walk down into the parted river, Kass speaks to you aside.",0);
	add_dialog_str(1,"_The Prophet has chosen a few warriors to guard our rear as we cross the river,_ he says. _He wants you to be the main ones. We expect the sliths of Gnass to arrive within minutes._",0);
	add_dialog_str(2,"He sighs. _Kill as few as you can. They are blinded by their desire to maintain power, to keep their hegemony, but they are not evil._",0);
	add_dialog_str(3,"He adds, _Just give us enough time to cross the river._",0);
	add_dialog_str(4,"You trail behind as the last of the sliths descend into the river.",0);
	run_dialog(1);
	
	i = 6;
	while (i < 40) {
		erase_char(i);
		i = i + 1;
		}
	
	march_party(25,23);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(26,24);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(27,24);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(28,24);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(29,24);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	march_party(30,24);
	force_instant_terrain_redraw();
	pause(get_flag(290,0) * 1);
	
	move_to_new_town(0,14,23);
	
break;