// .txt

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 3;
short last_abil;
short counter = 0;
short att = 0;
body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(16416,"Sergeant Farnell");
	set_name(16417,"Avernite Soldier");
	set_name(16418,"Avernite Soldier");


	add_range_to_group(16419,16424,19);
	set_name(16421,"Ogre Skinner");
	set_name(16422,"Ogre Skinner");
	set_name(16423,"Ogre Skinner");
	set_name(16424,"Ogre Skinner");

	add_range_to_group(16425,16429,20);
	set_name(30020,"Swamp Ogre");
	set_name(16429,"Ogre Mage Hrrlak");
	set_boss_level(16429,1);

	add_range_to_group(16430,16435,21);

	set_name(16435,"Chief Torpek");
	set_boss_level(16435,2);
	set_new_abil(16435,7);
	alter_stat(16435,19,8);
	
	set_aggression(16437,50);
	set_aggression(16438,50);
	set_aggression(16439,50);
	set_aggression(16440,50);

	set_name(16441,"Mutant Ogre");
	set_aggression(16441,70);
	set_coloradj(16441,512);
	set_resistance(16441,5,80);
	set_name(16442,"Mutant Ogre");
	set_aggression(16442,70);
	set_coloradj(16442,512);
	set_resistance(16442,5,80);
	set_name(16443,"Mutant Ogre");
	set_aggression(16443,70);
	set_coloradj(16443,512);
	set_resistance(16443,5,80);
	set_name(16444,"Mutant Ogre");
	set_aggression(16444,70);
	set_coloradj(16444,512);
	set_resistance(16444,5,80);
	set_name(16445,"Mutant Ogre");
	set_aggression(16445,70);
	set_coloradj(16445,512);
	set_name(16454,"Mutant Ogre");
	set_aggression(16454,70);
	set_coloradj(16454,512);
	set_name(16455,"Mutant Ogre");
	set_aggression(16455,70);
	set_coloradj(16455,512);
	change_max_health(16455,150);
	set_resistance(16455,0,75);
	set_name(16456,"Mutant Ogre");
	set_aggression(16456,70);
	set_coloradj(16456,512);
	change_max_health(16456,150);
	set_resistance(16456,0,75);

	add_range_to_group(16457,16461,22);
	set_aggression(30022,70);
	set_new_abil(30022,2);

	add_range_to_group(16462,16464,23);
	set_name(30023,"Screecher Bat");
	set_level(30023,15);
	set_new_abil(30023,12);
	add_range_to_group(16465,16467,24);
	set_name(30024,"Screecher Bat");
	set_level(30024,15);
	set_new_abil(30024,12);
	
	set_crime_tolerance(max_crime);

	if ((gf(152,15) > 0) && ((gf(177,14) > 0) || (gf(177,4) == 1)))
		sf(152,10,1);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((on_which_layer() == 1) && (gf(152,9) == 0) && (gf(152,13) == 1) && (gf(152,3) == 0) && (party_dist_to_spot(776,643) <= 5)) {
		sf(152,13,2);
		sf(152,14,1);
		sf(152,9,1);
		begin_talk_mode(13);
		}
	
	if ((char_ok(16429)) && (get_attitude(16429) >= 10))
		sf(152,9,1);
		
	if ((att == 0) && (gf(152,9) > 0)) {
		att = 1;
		set_attitude(16429,10);

		set_attitude(30019,10);
		set_attitude(30020,10);
		set_attitude(30021,10);
		}
		
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		make_zone_hostile();
		im_hostile = 1;
		sf(152,15,1);
		}

	if (gf(152,10) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16416,"I can open the gate.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16416,"You need orders to pass.");
		}
	if (gf(152,9) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16435,"Hrrrm.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16435,"An intruder.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16435,"You not welcome.");
		}
		
	//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);
