// .txt

beginzonescript;

variables;

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

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_obj_act_at_dist(29090,1);

	add_range_to_group(17390,17394,43);
	set_name(17390,"Nephil Sentry");
	set_name(17391,"Nephil Sentry");
	change_max_health(17390,40);
	change_max_health(17391,40);

	add_range_to_group(17395,17400,44);
	set_name(17395,"Nephil Sentry");
	set_name(17396,"Nephil Sentry");
	change_max_health(17395,40);
	change_max_health(17396,40);

	set_name(17418,"Hellhound Guardian");
	set_boss_level(17418,1);
	set_aggression(17418,50);
	
	set_name(17421,"Shaman Baorla");
	change_max_health(17421,40);

	set_name(17432,"Slith Cultist");
	set_level(17432,8);
	set_name(17433,"Slith Cultist");
	set_level(17433,8);

	set_name(17436,"Small Fire Lizard");
	set_level(17436,6);
	set_name(17437,"Small Fire Lizard");
	set_level(17437,6);
	set_name(17438,"Small Fire Lizard");
	set_level(17438,6);
	set_name(17439,"Small Fire Lizard");
	set_level(17439,6);
	set_name(17440,"Small Fire Lizard");
	set_level(17440,6);

	set_name(17441,"Slith Cultist");
	set_level(17441,8);
	set_name(17442,"Slith Cultist");
	set_level(17442,8);
	set_name(17443,"Smith Grrargh");
	set_level(17443,8);
	change_max_health(17443,40);

	add_range_to_group(17451,17455,45);
	set_aggression(30045,20);
	add_range_to_group(17456,17460,46);
	set_aggression(30046,20);

	set_crime_tolerance(max_crime);

	if (gf(161,10) > 0)
		set_terrain(0,482,757,0);

	if (gf(161,12) > 0) {
		sf(161,13,1);
		sf(161,14,1);
		}
		else {
			sf(161,13,1);
			sf(161,14,0);
			}
			
	sf(161,23,1);
	sf(161,24,0);
	sf(161,25,0);
	sf(161,26,0);
	sf(161,27,0);
	sf(161,28,0);
	sf(161,29,0);
	
	if (gf(161,3) > 0)
		erase_char(17467);
	
	if (gf(161,19) > 0) {
		kill_object(29016,0);
		kill_object(29017,0);
		}	
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	// open exit games once boss dead
	if (gf(161,1) > 0) {
		sf(161,13,1);
		sf(161,14,1);
		}
		
	if ((on_which_layer() == 1) && (gf(161,12) == 0) && (party_within_dist(486,761,6))) {
		sf(161,12,1);
		sf(161,13,0);
		sf(161,14,1);
		begin_talk_mode(14);
		}

	//if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
	//	make_zone_hostile();
	//	im_hostile = 1;
	//	}

	// if (gf(,) == 0) {
	//if (get_ran(1,0,100) < 10)
	//	give_char_text_bubble(,"");
	//	}

	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();
		
		if ((gf(161,22) > 0) && (gf(161,22) < 100)) {
			inc_flag(161,22,1);
			if (gf(161,22) == 3) {
				print_str_color("One of the calderas starts to glow brightly.",2);
				sf(161,24,1);
				}
			if (gf(161,22) == 5) {
				print_str_color("One of the calderas starts to glow brightly.",2);
				sf(161,25,1);
				}
			if (gf(161,22) == 7) {
				print_str_color("One of the calderas starts to glow brightly.",2);
				sf(161,26,1);
				}
			if (gf(161,22) == 9) {
				print_str_color("One of the calderas starts to glow brightly.",2);
				sf(161,27,1);
				}
			if (gf(161,22) == 11) {
				print_str_color("One of the calderas starts to glow brightly.",2);
				sf(161,28,1);
				}
			if (gf(161,22) == 13) {
				print_str_color("One of the calderas starts to glow brightly.",2);
				sf(161,29,1);
				}

			if (gf(161,22) == 4) {
				print_str_color("One of the calderas starts to vent searing steam.",2);
				sf(161,24,2);
				}
			if (gf(161,22) == 6) {
				print_str_color("One of the calderas starts to vent searing steam.",2);
				sf(161,25,2);
				}
			if (gf(161,22) == 8) {
				print_str_color("One of the calderas starts to vent searing steam.",2);
				sf(161,26,2);
				}
			if (gf(161,22) == 10) {
				print_str_color("One of the calderas starts to vent searing steam.",2);
				sf(161,27,2);
				}
			if (gf(161,22) == 12) {
				print_str_color("One of the calderas starts to vent searing steam.",2);
				sf(161,28,2);
				}
			if (gf(161,22) == 14) {
				print_str_color("One of the calderas starts to vent searing steam.",2);
				sf(161,29,2);
				}
				
			}
		}
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(472,751,4);
	// direction - 0,1 - north 2,3 - west 4,5 - south 6,7 - east
break;

beginstate 21;
	if (is_combat() == FALSE)
		print_str_color("You climb the stairs.",2);
	change_level(481,752,4);
	// 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);
