// .txt

beginzonescript;

variables;

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

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(8316,"Commander Boswell");
	set_name(8317,"Tania Venia");
	set_name(8318,"Neron");
	set_name(8319,"Damita");
	set_name(8320,"Rogelio");
	set_name(8342,"Driver Melisenda");
	set_level(8342,24);
	set_boss_level(8342,1);
	set_new_abil(8342,20);

	add_range_to_group(8321,8328,43);
	set_name(30043,"Avernite Archer");
	add_range_to_group(8329,8334,44);
	set_name(30044,"Avernite Warrior");

	set_name(8337,"Avernite Refugee");
	set_name(8338,"Avernite Refugee");
	set_name(8339,"Avernite Refugee");
	set_name(8340,"Avernite Refugee");
	set_name(8341,"Avernite Refugee");

	set_crime_tolerance(max_crime);

	if (gf(77,4) == 2) {
		sf(77,4,1);
		erase_char(8343);
		erase_char(8344);
		erase_char(8345);
		erase_char(8346);
		erase_char(8347);
		erase_char(8348);
		erase_char(8349);
		begin_talk_mode(203);
		}
		
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((made_ref == 0) && (gf(77,3) == 1)) {
		made_ref = 1;
		activate_hidden_group(44);
		}

	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		//print_str_color("DEBUG ALERT: FORT DRANLON NOW HOSTILE. TAKE SCREENSHOT",3);
		//print_str_color("  AND OR SAVE GAME AND REPORT IT.",3); 
		
		
		make_zone_hostile();
		im_hostile = 1;
		sf(77,9,1);
		}

	if (gf(77,9) == 0) {
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8316,"Are you from the Castle?");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8316,"Can you help us?");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8316,"The roads are lethal.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) >= 4))
			give_char_text_bubble(8316,"The roads are clear.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) >= 4))
			give_char_text_bubble(8316,"You have done well.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8317,"Do you need guidance?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8317,"Explore without and within.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8317,"I can teach you.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8318,"Roll. Roll.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8318,"Curses!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8318,"I won!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8318,"A six.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8318,"A nine!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8319,"Supplies are low.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8319,"Don't ask. We're out.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8319,"I can work leather.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8319,"Snip. Snip.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8320,"Vile stuff, isn't it?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8320,"Agghhh! Repulsive!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8320,"I am foe to chitrachs!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8320,"Kingsley would approve.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"We have to escape.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"This is a deathtrap.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"The roads are lethal.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) < 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"We're doomed!");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) >= 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"We're saved!");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) >= 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"There is hope.");
		if ((get_ran(1,0,100) < 10) && (gf(77,3) >= 4))
			give_char_text_bubble(8337 + get_ran(1,0,4),"Thank you!");
		if ((get_ran(1,0,100) < 10) && (gf(77,4) < 2))
			give_char_text_bubble(8342,"Is it time?");
		if ((get_ran(1,0,100) < 10) && (gf(77,4) < 2))
			give_char_text_bubble(8342,"Best to stay here.");
		if ((get_ran(1,0,100) < 10) && (gf(77,4) < 2))
			give_char_text_bubble(8342,"The marauders are out there.");
		if ((get_ran(1,0,100) < 10) && (gf(77,4) == 2))
			give_char_text_bubble(8342,"Let's go!");
		if ((get_ran(1,0,100) < 10) && (gf(77,4) == 2))
			give_char_text_bubble(8342,"Follow me!");
		if ((get_ran(1,0,100) < 10) && (gf(77,4) == 2))
			give_char_text_bubble(8342,"Move it!");

		}

	//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;

beginstate 15;
	if (get_flag(77,9) == 0) {
		if (revive_party()) {
			print_str_color("Passing through the Fort Dranlon gates heals your wounds",2);
			print_str_color("  and restores your spell energy.",2);
			}
		}
break;

beginstate 16;
	set_terrain_string_range("The sign says - Seekers of the Mysteries.",1);
break;

beginstate 17;
	set_terrain_string_range("The sign says - SMITHY. Closed.",1);
break;

beginstate 18;
	set_terrain_string_range("The sign says - Torril's Traveler's Supplies. Closed.",1);
break;


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