// TOWN SCRIPT
//    

// 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, species;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered.
// Only enter when you come from the inn the previous night.
play_sound(18);
message_dialog("In the middle of the night, you suddenly wake up.  What was that sound?", "Something is wrong.");
flip_terrain(8,7);
play_sound(58);
relocate_character(6,8,7);
relocate_character(7,9,7);
if (party_size() > 1) {
	text_bubble_on_char(6,"These ones are awake");
} else {
	text_bubble_on_char(6,"This one's awake");
}
play_sound(49);
force_instant_terrain_redraw();
pause(10);
relocate_character(6,8,6);
relocate_character(7,8,8);
if (party_size() > 1) {
	text_bubble_on_char(7,"Kill them");
} else {
	text_bubble_on_char(7,"Kill him");
}
force_instant_terrain_redraw();
play_sound(50);
pause(10);
text_bubble_on_char(6,"");
text_bubble_on_char(random_party_member(), "Bandits!");
force_instant_terrain_redraw();
pause(10);
erase_text_bubbles();
force_instant_terrain_redraw();

break;

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

beginstate START_STATE;

set_ticks_forward(-1); // Always night


break;

beginstate 10;
if ((get_flag(2,3) == 0)  && (get_flag(1,7) == 0)){
set_flag(2,3,1);
message_dialog("You step out into the main room of the inn.  It is filled with bandits, who start shouting when they see you.  Chief among them is a heavily built captain and a powerful-looking mage.","The captain shouts to you _You shall be honoured to die at the hands of Duzaki and Kjellka!_  The others laugh and attack.");
}
break;

beginstate 11;
if (get_flag(2,4) == 0) {
set_flag(2,4,1);
message_dialog("Your sister's room is empty!","You hope she is still okay.  There are no bloodstains, at least.");
}
break;
beginstate 12;
force_view_center(35,35);
force_instant_terrain_redraw();
play_sound(-13);
message_dialog("As you step out of the inn, you feel a hard blow to the head.","Your last thought before you lose conciousness is that there must have been bandits outside waiting for you.");
move_to_new_town(2,4,6);
break;
