// talkobj.txt 

// A very simple and important script. When the object is used, begins a conversation.
// Can set a SDF to turn off talking when a condition is met.

// Cell 0 - The talk ndo eot begin the conversation at.
// Cell 1,2 - A stuff done flag. if non-zero, the converation no longer
//   happens when the object is used. These can both be left at 0 (for no flag).

beginobjectscript; // talking object

variables;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;
	break;

beginstate START_STATE; 
	break;

beginstate USE_STATE;
	if (gf(90,20) > 0) {
		print_str_color("The lever doesn't budge. The lift is currently in use.",2);
		end();
		}
	if ((char_loc_x(get_pc_id(0)) != 431) || (char_loc_y(get_pc_id(0)) != 396))
		relocate_char(get_pc_id(0),431,396,0);
	if ((char_loc_x(get_pc_id(1)) != 432) || (char_loc_y(get_pc_id(1)) != 397))
		relocate_char(get_pc_id(1),432,397,0);
	if ((char_loc_x(get_pc_id(2)) != 431) || (char_loc_y(get_pc_id(2)) != 398))
		relocate_char(get_pc_id(2),431,398,0);
	if ((char_loc_x(get_pc_id(3)) != 430) || (char_loc_y(get_pc_id(3)) != 397))
		relocate_char(get_pc_id(3),430,397,0);

	// safety try
	if ((char_loc_x(get_pc_id(0)) != 431) || (char_loc_y(get_pc_id(0)) != 396))
		relocate_char(get_pc_id(0),431,396,0);
	if ((char_loc_x(get_pc_id(1)) != 432) || (char_loc_y(get_pc_id(1)) != 397))
		relocate_char(get_pc_id(1),432,397,0);
	if ((char_loc_x(get_pc_id(2)) != 431) || (char_loc_y(get_pc_id(2)) != 398))
		relocate_char(get_pc_id(2),431,398,0);
	if ((char_loc_x(get_pc_id(3)) != 430) || (char_loc_y(get_pc_id(3)) != 397))
		relocate_char(get_pc_id(3),430,397,0);

	
	if (get_height(1,431,396) > 48) {
		sf(90,20,2);
		sf(90,21,0);
		sf(90,23,0);
		set_rect_height(395,429,399,433,50);
		set_object_icon(ME,10);
		begin_talk_mode(15);
		}
		else {
			sf(90,20,1);
			sf(90,21,0);
			sf(90,23,0);
			set_rect_height(395,429,399,433,47);
			set_object_icon(ME,11);
			begin_talk_mode(14);
			}

break;
