// .txt

beginzonescript;

variables;

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

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

//	set_name(,"");

	add_range_to_group(7020,7024,19);
	set_aggression(30019,40);
	
	add_range_to_group(7025,7028,20);
	set_name(30020,"Scuttler Egglayer");
	set_boss_level(30020,-1);
	set_level(30020,20);
	set_aggression(30020,70);
	
	set_name(7045,"Fading Golem");
	set_level(7045,2);
	set_name(7046,"Fading Golem");
	set_level(7046,2);
	
	set_name(7047,"Swamp Thing");
	set_level(7047,26);
	set_aggression(7047,75);
	set_name(7048,"Swamp Thing");
	set_level(7048,26);
	set_aggression(7048,75);
	set_name(7049,"Swamp Thing");
	set_level(7049,26);
	set_aggression(7049,75);
	set_name(7050,"Swamp Thing");
	set_level(7050,26);
	set_aggression(7050,75);

	add_range_to_group(7051,7055,21);

	set_aggression(7056,75);
	set_aggression(7057,75);
	set_aggression(7058,75);
	set_aggression(7059,75);

	set_name(7060,"Goodwife Niveau");
	set_level(7060,20);
	set_name(7061,"Armed Farmer");
	set_name(7062,"Armed Farmer");
	set_name(7063,"Armed Farmer");
	set_name(7064,"Armed Farmer");
	set_level(7061,16);
	set_level(7062,16);
	set_level(7063,16);
	set_level(7064,16);
	set_new_abil(7061,20);
	set_new_abil(7062,20);
	set_new_abil(7063,20);
	set_new_abil(7064,20);
	add_range_to_group(7060,7064,22);
	set_attack_bonus(30022,10);
	
	set_crime_tolerance(max_crime);

	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
		
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		sf(65,8,1);
		make_zone_hostile();
		im_hostile = 1;
		}

	// if (gf(,) == 0) {
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7045 + get_ran(1,0,1),"Zzzzt.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7045 + get_ran(1,0,1),"Grind.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7045 + get_ran(1,0,1),"Pffffft.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7060,"We are not going.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7060,"Try some slime?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7060,"Agggghhhh.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7060,"It tastes like sadness.");
	//	}

	if ((gf(65,8) == 0) && (gf(65,7) == 0) && (gf(65,6) > 0) && (party_dist_to_spot(620,287) <= 4)) {
		sf(65,7,1);
		activate_hidden_group(24);
		begin_talk_mode(9);
		}
	if ((gf(65,7) == 1) && (gf(65,10) > 9)) {
		print_str_color("You have defeated the attacking chitrachs.",3);
		if (num_chars_in_group(22) > 0) {
			print_str_color("They didn't manage to kill all of the farmers.",3);
			award_party_xp(num_chars_in_group(22) * 75,22);
			}
		sf(65,7,2);
		}
		
	//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;

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