// .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_name(,"");

	add_range_to_group(14804,14806,13);
	set_name(30013,"Tunnel Hunter");
	set_coloradj(30013,256);
	//set_boss_level(30013,1);

	add_range_to_group(14807,14809,14);
	set_name(30014,"Tunnel Hunter");
	set_coloradj(30014,512);
	//change_max_health(30014,100);
	//set_resistance(30014,7,70);
	set_new_abil(30014,12);
	
	add_range_to_group(14843,14848,15);
	
	set_crime_tolerance(max_crime);

	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
		
	//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(123,4) > 0) && (gf(123,4) < 20)) {
			inc_flag(123,4,1);
			
			if (gf(123,4) == 1) {
				print_str_color("The roaring from the pit gets louder.",3);
				}
			if (gf(123,4) == 2) {
				print_str_color("The roaring from the pit gets louder still.",3);
				print_str_color("  The creatures are getting closer.",3);
				}
			if (gf(123,4) == 3) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13323);
				change_max_health(13323,100);
				}
			if (gf(123,4) == 4) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13324);
				change_max_health(13324,100);
				}
			if (gf(123,4) == 5) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13325);
				change_max_health(13325,100);
				}
			if (gf(123,4) == 6) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13326);
				change_max_health(13326,100);
				}
			if (gf(123,4) == 7) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13327);
				change_max_health(13327,100);
				set_new_abil(13327,1);
				}
			if (gf(123,4) == 8) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13328);
				change_max_health(13328,100);
				set_new_abil(13328,2);
				}
			if (gf(123,4) == 9) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13329);
				change_max_health(13329,100);
				set_new_abil(13329,1);
				}
			if (gf(123,4) == 10) {
				print_str_color("A hideous worm slithers out of the pit!",3);
				spawn_creature(13330);
				change_max_health(13330,100);
				set_new_abil(13330,2);
				}
			if (gf(123,4) == 11) {
				print_str_color("A gigantic, bulbous, smoking worm slithers out of the pit!",3);
				spawn_creature(13331);
				set_boss_level(13331,2);
				}
			}
		}
break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

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