// .txt

beginzonescript;

variables;

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

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

//	set_name(,"");

	add_range_to_group(7344,7348,19);
	set_name(30019,"Carrion Rat");
	set_level(30019,25);
	set_attack_bonus(30019,20);
	set_aggression(30019,40);
	
		add_range_to_group(7349,7356,20);
	set_name(30020,"Horde Blademaster");
		add_range_to_group(7357,7363,21);
	set_name(7357,"Horde Spearmaster");
	set_name(7358,"Horde Spearmaster");
	set_name(7359,"Horde Spearmaster");
	set_name(7360,"Horde Spearmaster");
	set_name(7361,"Horde Javelineer");
	set_name(7362,"Horde Javelineer");
	set_name(7363,"Horde Javelineer");
	
	set_crime_tolerance(max_crime);

	set_obj_act_at_dist(12251,1);
	set_obj_act_at_dist(12252,1);

	add_range_to_group(7399,7405,23);
	set_name(30023,"Horde Champion");
	set_level(30023,30);
	set_boss_level(30023,1);
	alter_stat(30023,30,20);
	if (gf(170,8) > 0)
		set_attitude(30023,10);

	add_range_to_group(7406,7411,24);
	set_name(30024,"Horde Scourger");
	set_level(30024,30);
	set_boss_level(30024,1);
	set_attack_bonus(30024,10);
	if (gf(170,8) == 0) {
		erase_char(30024);
		}
		
	sf(68,9,0);
	
	sf(68,20,0);
	sf(68,21,0);
	sf(68,22,0);
	
	// reset flags if needed
	if (gf(68,6) == 2) {
		sf(68,6,1);
		sf(68,14,0);
		}
	if ((gf(68,6) >= 3) && (gf(68,6) <= 7)) {
		spawn_creature(7364);
		if (gf(68,10) == 0)
			spawn_creature(7365);		
		
		sf(68,6,3);
		sf(68,14,1);
		relocate_char(7364,799,276,0);
		if (char_ok(7365))
			relocate_char(7365,801,278,0);
		}
	if (gf(68,6) == 8) {
		sf(68,14,1);
		}
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((spawned == 0) && (gf(68,6) == 1) && (on_which_layer() == 0)) {
		spawn_creature(7364);
		if (gf(68,10) == 0)
			spawn_creature(7365);		
		}
	
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		make_zone_hostile();
		im_hostile = 1;
		if (char_ok(7364))
			begin_talk_mode(13);
		}

	// 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();
	//	}
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);
