begintownscript;

variables;
short bmessage;

body;
beginstate INIT_STATE;

reset_dialog();
add_dialog_str(0,"The bedrooms are in the upper floors here. Your room is the first one on the right.",0);
add_dialog_str(1,"The inn is rather run down. The carpet is worn, The walls could use replastering. But it's a palace compared to how cold it is outside, and the price isn't terrible.",0);
add_dialog_choice(0,"Okay.");
bmessage = run_dialog(1);
break;

beginstate START_STATE;
break;

beginstate EXIT_STATE;
break;

beginstate 10;
	if(get_flag(2,1) == 0){
		reset_dialog();
		add_dialog_str(0,"This is your room for the night. It isn't much.",0);
		add_dialog_str(1,"A large, threadbare rug covers the floor. There are four small beds, and a chest of drawers. One set of moth-eaten curtains flaps lazily in the cold breeze. The other window is uncovered.",0);
		bmessage = run_dialog(1);
		set_flag(2,1,1);
	}
break;

beginstate 11;
	if(get_flag(2,2) == 0){
		reset_dialog();
		add_dialog_str(0,"This isn't your room. Your room is the other one.",0);
		bmessage = run_dialog(1);
		block_entry(1);
	}
	else{
		if(get_flag(2,4) == 0){
		reset_dialog();
		add_dialog_str(0,"You enter this room hoping to find some people who can help, but there's no one inside.",0);
		add_dialog_str(1,"In fact, further investigation reveals that there was quite a struggle in here. The occupants seem to have been dragged out of the room by something large. With claws. You can't tell if the blood is fresh or not.",0);
		add_dialog_str(2,"Problematic.",0);
		bmessage = run_dialog(1);
		set_flag(2,4,1);
		}
	}
		
break;

beginstate 12;
	if(get_flag(2,3) == 0){
		reset_dialog();
		add_dialog_str(0,"You climb into bed and fall asleep in minutes.",0);
		add_dialog_str(1,"Some time later you are woken up by horrible noises emenating from somewhere downstairs. These aren't your run of the mill horrible noises, either. You all sit bolt upright and grab the nearest weapons you can reach.",0);
		add_dialog_str(2,"You're no experts but it sounds like things are being ripped in half while horrible monsters scream. You glance out the window and see the full moon in the middle of the night sky.",0);
		add_dialog_str(3,"Another night without sleep...",0);
		bmessage = run_dialog(1);
		relocate_character(0,8,13);
		relocate_character(1,9,13);
		relocate_character(2,10,13);
		relocate_character(3,11,13);
		set_flag(2,3,1);
		set_flag(2,2,1);
		set_terrain(12,18,17);
	}
break;

beginstate 13;
	move_to_new_town(1,15,30);
break;

beginstate 14;
	if(get_flag(2,3) == 1){
		reset_dialog();
		add_dialog_str(0,"You're about to go down the stairs when you hear a door below you open downstairs and several... things... step into the room. They sure aren't human.",0);
		add_dialog_str(1,"Needless to say, you really don't want to go down this way. A thought occurs to you: You still have all the climbing equipment, and you could just as easily go out the window in your room.",0);
		bmessage = run_dialog(1);
		block_entry(1);
		set_flag(2,6,1);
	}
break;

beginstate 15;
	if(get_flag(2,3) == 1){
		if(get_flag(2,6) == 1){
		reset_dialog();
		add_dialog_str(0,"As you reach the window you hear things coming up the stairs quickly You practically dive out the window to get out.",0);
		add_dialog_str(1,"You land on the roof of the stable. Or you would have if the roof were built better. You crash through it and land on some hay bales below..",0);
		add_dialog_str(2,"At least you're out.",0);
		bmessage = run_dialog(1);
		move_to_new_town(3,8,36);
		damage_char(1000,4,1);
		}
	}
break;

beginstate 16;
	if(get_flag(2,3) == 1){
		if(get_flag(2,5) == 0){
			reset_dialog();
			add_dialog_str(0,"It's pretty dark out, so you grab the torch on the wall. If nothing else, you can hit things with it pretty hard.",0);
			bmessage = run_dialog(1);
			reward_give(447);
			set_terrain(13,16,0);
			set_flag(2,5,1);
		}
	}
break;