// .txt

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 200;
short last_abil;
short counter = 0;
short attwest = 0;
short atteast = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(10584,"Sergeant Belos");
	set_name(10585,"Excavation Guard");
	set_name(10586,"Excavation Guard");
	set_name(10591,"Incantor Timmons");
	set_name(10594,"Healer Isla");
	set_name(10595,"Excavation Guard");
	set_name(10596,"Excavation Guard");
	set_name(10597,"Excavation Guard");
	set_name(10598,"Excavation Guard");
	set_name(10600,"Excavation Worker");
	set_name(10601,"Excavation Worker");
	set_name(10602,"Excavation Worker");
	set_name(10599,"Commander Rana");


	add_range_to_group(10603,10608,19);
	set_name(30019,"Cave Worg");
	set_level(30019,13);
	set_name(10609,"Cave Worg");
	set_level(10609,13);
	set_name(10610,"Cave Worg");
	set_level(10610,13);
	set_name(10611,"Cave Worg");
	set_level(10611,13);

	add_range_to_group(10612,10619,20);

	add_range_to_group(10622,10628,21);
	set_name(30021,"Rebel Ogre");
	set_name(10627,"Cave Worg");
	set_level(10627,13);
	set_name(10628,"Cave Worg");
	set_level(10628,13);

	set_crime_tolerance(max_crime);

	set_obj_act_at_dist(17707,1);
	set_obj_act_at_dist(17769,1);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((gf(98,4) > 1) && (gf(98,9) == 0)) {
		if (char_ok(10592) == FALSE) {
			spawn_creature(10592);
			set_name(10592,"Excavation Mage");
			}
		if (char_ok(10593) == FALSE) {
			spawn_creature(10593);
			set_name(10593,"Excavation Mage");
			}
		}
	
	if ((attwest == 0) && (gf(98,19) > 0)) {
		attwest = 1;
		
		set_attitude(30019,10);
		set_attitude(10609,10);
		set_attitude(10610,10);
		set_attitude(10611,10);
		set_attitude(30020,10);
		set_attitude(10620,10);
		set_attitude(10621,10);
		set_attitude(10629,10);
		}
	if ((atteast == 0) && (gf(98,20) > 0)) {
		atteast = 1;
		set_attitude(30021,10);
		set_attitude(10630,10);
		}
		
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		make_zone_hostile(); 
		im_hostile = 1;
		sf(98,9,1);
		if (gf(170,1) < 16) {
			//erase_char(30000);
			begin_talk_mode(299);
			}
		}

	if (gf(98,9) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10584,"Never quite enough.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10584,"Hail, soldier.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10584,"When's the next wagon coming?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10591,"Slow, constant fire?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10591,"Perhaps brief intense blasts.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10591,"Curse those ogres.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10591,"This is a fool's errand.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10594,"Welcome.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10594,"I can tend to your wounds.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10594,"You can rest here.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10600 + get_ran(1,0,2),"Shhh. The inspector.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10600 + get_ran(1,0,2),"I hate ogres.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10600 + get_ran(1,0,2),"Broke my foot today.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10600 + get_ran(1,0,2),"Curse those wizards!");
		}
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10603 + get_ran(1,0,5),"Grrrr!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10603 + get_ran(1,0,5),"Rawrrr!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10603 + get_ran(1,0,5),"Rrrr.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10609 + get_ran(1,0,2),"Grrrr!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10609 + get_ran(1,0,2),"Rawrrr!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10609 + get_ran(1,0,2),"Rrrr.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10627 + get_ran(1,0,1),"Grrrr!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10627 + get_ran(1,0,1),"Rawrrr!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(10627 + get_ran(1,0,1),"Rrrr.");
	if (gf(98,21) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10612 + get_ran(1,0,7),"All hail Gunza!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10612 + get_ran(1,0,7),"Gunza is mighty!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10612 + get_ran(1,0,7),"Rah rah for Gunza!");
		}
		else {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(10612 + get_ran(1,0,7),"All hail Hydera!");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(10612 + get_ran(1,0,7),"Hydera is mighty!");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(10612 + get_ran(1,0,7),"Rah rah for Hydera!");
			}
	if (gf(98,4) < 5) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10629,"I am Gunza!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10629,"I am master here!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10629,"We help humans!");
		}
	if (gf(98,21) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10630,"We rebel!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10630,"Gunza is thief!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10630,"Gunza is old, weak coward.");
		}
	if (gf(98,21) > 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10630,"I will be chief!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10630,"You fight for me!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10630,"Gunza falls.");
		}
		
	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

beginstate 20;
	if (is_combat() == FALSE)
		print_str_color("You climb the stairs.",2);
	change_level(18,473,0);
	// direction - 0,1 - north 2,3 - west 4,5 - south 6,7 - east
break;


//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
