// .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(8856,"Commander Andros");
	set_name(8858,"Vanderin");
	set_name(8859,"Hapscomb");
	set_name(8860,"Incantor Stuart");
	set_name(8861,"Sergeant Frannie");
	set_name(8862,"Captain Patience");
	set_name(8863,"Private Kerrerr");
	set_name(8864,"Duvno Battle Mage");
	set_name(8865,"Duvno Battle Mage");
	set_name(8866,"Duvno Battle Mage");
	set_name(8867,"Duvno Blacksmith");
	set_name(8868,"Duvno Blacksmith");

	add_range_to_group(8874,8881,37);
	set_name(30037,"Fort Duvno Soldier");
	add_range_to_group(8882,8889,38);
	set_name(30038,"Fort Duvno Soldier");
	set_name(8890,"Fort Duvno Soldier");
	set_name(8891,"Fort Duvno Soldier");

	set_name(8892,"Duvno Battle Mage");

	if (gf(82,4) < 4)
		sf(82,4,0);
	
	if (gf(68,6) > 0) {
		erase_char(8857);
		erase_char(8858);
		}
		
	set_crime_tolerance(max_crime);

	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
		
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		make_zone_hostile();
		im_hostile = 1;
		begin_talk_mode(299);
		}

	// if (gf(,) == 0) {
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8856,"The mage is mad!");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8856,"It can't be done!");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8856,"What a waste.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) > 2) && (gf(170,8) == 0))
		give_char_text_bubble(8856,"Go with Solberg.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) > 2) && (gf(170,8) == 0))
		give_char_text_bubble(8856,"You have no choice now.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) > 2) && (gf(170,8) == 0))
		give_char_text_bubble(8856,"Do what you can.");
	if ((get_ran(1,0,100) < 10) && (gf(170,8) == 0))
		give_char_text_bubble(8856,"I can't believe it.");
	if ((get_ran(1,0,100) < 10) && (gf(170,8) == 0))
		give_char_text_bubble(8856,"You did it.");
	if ((get_ran(1,0,100) < 10) && (gf(170,8) == 0))
		give_char_text_bubble(8856,"There is hope now.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8857,"You are here.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8857,"Little time to lose.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8857,"It will be dangerous.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8857,"You must be brave.");
	if ((get_ran(1,0,100) < 20) && (gf(82,4) >= 2))
		give_char_text_bubble(8857,"Follow.");
	if ((get_ran(1,0,100) < 20) && (gf(82,4) >= 2))
		give_char_text_bubble(8857,"Stay with me.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8858,"I need adventure.");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8858,"What can I do?");
	if ((get_ran(1,0,100) < 10) && (gf(82,4) < 2))
		give_char_text_bubble(8858,"Hello again!");
	if ((get_ran(1,0,100) < 20) && (gf(82,4) >= 2))
		give_char_text_bubble(8858,"Hooray!");
	if ((get_ran(1,0,100) < 20) && (gf(82,4) >= 2))
		give_char_text_bubble(8858,"An adventure!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8859,"Need something made?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8859,"Tink! Tink!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8859,"Be patient.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8860,"Maintain focus.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8860,"Be ready.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8860,"Study more charms.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8860,"Be ready to aid your allies too.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8861,"No handouts.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8861,"My orders are clear.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8861,"I can trade with you.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8862,"Thieves will be punished.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8862,"Deserters are killed.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8862,"Sharpen that blade!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8862,"Be alert!");
	if ((get_ran(1,0,100) < 20) && (gf(82,22) == 0))
		give_char_text_bubble(8863,"Speak with me.");
	if ((get_ran(1,0,100) < 20) && (gf(82,22) == 0))
		give_char_text_bubble(8863,"Need to come in?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8864 + get_ran(1,0,2),"Must concentrate.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8864 + get_ran(1,0,2),"Hmmmmmm.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8864 + get_ran(1,0,2),"Best to study.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8864 + get_ran(1,0,2),"I'll never learn this.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8867 + get_ran(1,0,1),"Tink! Tink!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8867 + get_ran(1,0,1),"Clang! Clang!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(8867 + get_ran(1,0,1),"Next!");

	//	}

	//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;
	set_terrain_string_range("The sign says - FOOD DEPOT. KEEP OUT!",1);
break;

beginstate 11;
	set_terrain_string_range("The sign says - Commander's Office.",1);
break;

beginstate 12;
	set_terrain_string_range("The sign says - Sage's Office. Closed.",1);
break;

beginstate 13;
	set_terrain_string_range("The sign says - MAIN BARRACKS.",1);
break;

beginstate 14;
	set_terrain_string_range("This guard tower is empty. There aren't enough soldiers to spare to watch to the southwest.",1);
break;

beginstate 22;
		if (revive_party()) {
			print_str_color("Entering or leaving the Fort Duvno heals your wounds",2);
			print_str_color("  and restores your spell energy.",2);
			}
break;

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