// .txt

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 200;
short last_abil;
short counter = 0;
short mess1 = 0;
short mess2 = 0;
short mess3 = 0;
short mess4 = 0;
short mess5 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_aggression(5631,50);
	set_aggression(5632,50);
	set_aggression(5633,50);
	set_aggression(5634,50);
	
//	set_name(,"");

	add_range_to_group(5635,5640,7);
	add_range_to_group(5641,5646,8);
	set_aggression(30007,50);
	set_aggression(30008,50);

	add_range_to_group(5658,5662,9);
	set_aggression(30009,50);
	
	set_name(5651,"Mummified Priest");
	set_boss_level(5651,1);
	
	set_name(5663,"Scavenger Ghast");
	set_level(5663,25);
	set_boss_level(5663,1);
	set_name(5664,"Scavenger Ghast");
	set_level(5664,25);
	set_boss_level(5664,1);
	set_name(5665,"Scavenger Ghast");
	set_level(5665,25);
	set_boss_level(5665,1);
	set_name(5666,"Scavenger Ghast");
	set_level(5666,25);
	set_boss_level(5666,1);
	
	set_crime_tolerance(max_crime);

	set_obj_act_at_dist(9489,1);
	set_obj_act_at_dist(9432,1);
	set_obj_act_at_dist(9433,1);
	
	sf(52,14,1);
	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 ((char_ok(5681)) && (get_attitude(5681) >= 10) && (gf(52,14) == 0)) {
			inc_flag(52,8,1);
			set_terrain(1,651,202,229);
			if (gf(52,8) == 2) {
				print_str_color("The crystal pylon to the north turns blue and begins to pulse intensely."3);
				if (mess1 == 0) {
					mess1 = 1;
					begin_talk_mode(11);
					}
				}
			if (gf(52,8) == 3) 
				print_str_color("The crystal pylon to the north is about to release its energy."3);
			
			if (gf(52,8) == 4) {
				print_str_color("The crystal pylon to the north lets out a devastating wave of cold."3);
				set_terrain(1,651,202,230);
				loc_damage_party(651,202,11,300 + 100 * gf(52,9),6);
				inc_flag(52,9,1);
				play_sound(144);
				if (mess1 == 1) {
					mess1 = 2;
					begin_talk_mode(12);
					}
				}
			if (gf(52,8) == 5) {
				set_terrain(1,649,219,229);
				print_str_color("The crystal pylon to the south turns blue and begins to pulse intensely."3);
				if (mess2 == 0) {
					mess2 = 1;
					begin_talk_mode(13);
					}
				}
			if (gf(52,8) == 6) 
				print_str_color("The crystal pylon to the south is about to release its energy."3);
			if (gf(52,8) == 7) {
				print_str_color("The crystal pylon to the south lets out a devastating wave of cold."3);
				set_terrain(1,649,219,230);
				loc_damage_party(649,219,11,300 + 100 * gf(52,9),6);
				inc_flag(52,9,1);
				play_sound(144);

				}
			if (gf(52,8) == 8) {
				print_str_color("The lich's eyes turn black. It is surrounded by a life-draining field."3);
				if (mess3 == 0) {
					mess3 = 1;
					begin_talk_mode(14);
					}
				}
			if (gf(52,8) == 9) 
				print_str_color("The lich is looking around for a target."3);
			if (gf(52,8) == 11) 
				sf(52,8,1);
			}
			
		}
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);
