// TOWN SPECIAL ENCOUNTERS
//    Town 64: Kothtar

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 200;
short last_abil;
short counter = 0;
short set_ter = 0;
short i,j;

//1234 567 8

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

//	set_name(,);
//	add_range_to_group(,,groupn);

	make_field(0,52,45,2);
	make_field(0,52,51,2);

	set_aggression(6435,60);
	set_aggression(6436,60);

	set_aggression(30005,60);
	set_attack_bonus(30005,20);
	set_aggression(30006,60);
	set_attack_bonus(30006,20);
	set_aggression(30007,60);
	set_level(30007,24);
	set_attack_bonus(30007,20);

	set_aggression(30008,40);
	set_level(30008,30);
	
	set_crime_tolerance(max_crime);

	break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	
break;

beginstate 10;
	if (set_ter == 0) {
		set_ter = 1;
		kill_object(25636,1);
		kill_object(25642,1);
		ok_dlog(24,1);
		}
break;

beginstate 11;
	if (gf(64,5) > 0)
		end();
	if (gf(64,20) == 0) {
		play_sound(174);
		sf(64,20,1);
		
		activate_hidden_group(1);
		set_resistance(30001,6,100);
		set_boss_level(30001,1);
		set_attack_bonus(30001,5 + difficulty() * 5);
		place_particle_num(30001,1,1,8);
		if (difficulty() > 1)
			set_char_status(30001,2,10);
		
		i = 45;
		while (i < 54) {
			j = 7;
			while (j < 19) {
				make_field(0,i,j,1);
				
				j = j + 1;
				}
				
			i = i + 1;
			}
		
		ok_dlog(26,1);
		}
break;

beginstate 12;
	if (gf(64,5) > 0)
		end();
	if (gf(64,21) == 0) {
		play_sound(174);
		sf(64,21,1);
		
		activate_hidden_group(2);
		set_resistance(30002,6,100);
		set_boss_level(30002,1);
		set_attack_bonus(30002,5 + difficulty() * 5);
		place_particle_num(30002,1,1,8);
		if (difficulty() > 1)
			set_char_status(30002,2,10);
		
		i = 45;
		while (i < 54) {
			j = 7;
			while (j < 19) {
				make_field(0,i,j,1);
				
				j = j + 1;
				}
				
			i = i + 1;
			}
		
		ok_dlog(26,1);
		}
break;

beginstate 13;
	if (gf(64,5) > 0)
		end();
	if (gf(64,22) == 0) {
		play_sound(174);
		sf(64,22,1);
		
		activate_hidden_group(3);
		set_resistance(30003,6,100);
		set_level(30003,24);
		set_boss_level(30003,1);
		set_attack_bonus(30003,5 + difficulty() * 5);
		place_particle_num(30003,1,1,8);
		if (difficulty() > 1)
			set_char_status(30003,2,10);
		
		i = 45;
		while (i < 54) {
			j = 7;
			while (j < 19) {
				make_field(0,i,j,1);
				
				j = j + 1;
				}
				
			i = i + 1;
			}
		
		ok_dlog(26,1);
		}
break;

beginstate 14;
	if (gf(64,5) > 0)
		end();
	if (gf(64,23) == 0) {
		play_sound(174);
		sf(64,23,1);
		
		activate_hidden_group(4);
		set_resistance(30004,6,100);
		set_level(30004,24);
		set_boss_level(30004,1);
		set_attack_bonus(30004,5 + difficulty() * 5);
		place_particle_num(30004,1,1,8);
		if (difficulty() > 1)
			set_char_status(30004,2,10);
		
		i = 45;
		while (i < 54) {
			j = 7;
			while (j < 19) {
				make_field(0,i,j,1);
				
				j = j + 1;
				}
				
			i = i + 1;
			}
		
		ok_dlog(26,1);
		}
break;

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

