// TOWN SPECIAL ENCOUNTERS
//    Town 1: Formello

beginzonescript;

variables;

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

body;

//1

beginstate INIT_STATE;
	last_abil = get_current_tick();

//	set_name(,);
//	add_range_to_group(,,groupn);

	set_personality_name(20,"Ken");
	set_personality_name(21,"Jen");
	set_personality_name(22,"Stoppard");
	set_personality_name(23,"Townsend");
	set_personality_name(24,"Caius");
	set_personality_name(25,"Alice");
	set_personality_name(26,"Miles");
	set_personality_name(27,"Amtar");
	set_personality_name(28,"Gibbon");
	set_personality_name(29,"Rose");
	set_personality_name(30,"Graham");
	set_personality_name(31,"Tybalt");
	set_personality_name(32,"Becca");
	set_personality_name(34,"Amber");

	set_level(30001,8);

	set_name(146,"Merchant");
	set_name(147,"Merchant");
	set_name(148,"Merchant");
	
	set_crime_tolerance(max_crime);

		if (revive_party()) {
			print_str_color("Entering a friendly town heals your wounds",2);
			print_str_color("  and restores your spell energy.",2);
			}
	break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if ((gf(1,1) > 0) && (gf(1,19) == 0) && (char_ok(142) == FALSE))
		spawn_creature(142);
		
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 0))) {
		last_abil = get_current_tick();
		
		if (gf(1,1) > 0)
			counter = 0;
		if (counter > 0)
			counter = counter + 1;
		if (counter == 4) {
			counter = 0;
			ok_dlog(20,2);
			}
		}

	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(156,"Stupid lizards.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(156,"Get away!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(156,"Ahh! OW! (Kick.)");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(156,"Curse these reptiles.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(117,"Chop. Chop.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(117,"Stir. Stir.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(117,"Sigh.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(117,"Cough.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(102,"Supplies are tight.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(102,"We need equipment.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(102,"Have any herbs?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(102,"I can make potions.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(101,"I was a sage once.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(101,"The war is hard.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(101,"I can work leather.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(101,"Need new armor?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(103,"Good luck comes.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(103,"Bad luck comes.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(103,"We must prepare.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(103,"We must accept.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(106,"(Mop. Mop.)");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(106,"I am learning the ways of power.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(106,"Stupid scrolls.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(106,"Phew.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(104,"This is our library.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(104,"I can teach you.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(104,"Do you need magic?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(105,"A disaster.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(105,"What a ruin.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(105,"It never ends.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(105,"Despair.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(142,"You.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(142,"Yes.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(142,"Come.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(142,"Now.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(142,"Time.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(142,"Theft.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(131,"Need some ale?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(131,"We have rooms.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(131,"I feel a chill.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(138,"Burp.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(138,"Urp.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(138,"Buuuurp!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(138,"(Drink.)");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(108,"I envy you.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(108,"Wish I could fight.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(108,"Long war.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(108,"What's your clearance?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(143,"Watch out!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(143,"Don't step on my crops.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(143,"We need more food.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(143,"There's a war on!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(111,"Never leave your guard down.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(111,"Raiders could come any day.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(111,"Don't touch the ballistas.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(110,"Keep your guard up!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(110,"Be faster!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(110,"You are all terrible.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(110,"The Empire will slaughter you.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(110,"Why do I bother?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(146 + get_ran(1,0,2),"Mutter.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(146 + get_ran(1,0,2),"Mutter. Mutter.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(146 + get_ran(1,0,2),"Grumble.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(146 + get_ran(1,0,2),"Shhhh.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(146 + get_ran(1,0,2),"More ale!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(114,"Whoosh!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(114,"Block!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(114,"Hah!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(114,"Parry!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(114,"Riposte!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(132,"Ow!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(132,"What!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(132,"Hey!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(132,"Careful!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(132,"Auugh!");
break;

beginstate 10;
	if (gf(1,29) == 0) {
		sf(1,29,1);
		ok_dlog(61,1);
		set_level(109,8);
		set_boss_level(109,1);
		set_new_abil(109,13);
		activate_hidden_group(10);
		}
break;

beginstate 11;
	if (gf(1,27) == 0) {
		run_game_hardcode(1);
		sf(1,27,1);
		counter = 1;
		}
break;

beginstate 12;
break;

beginstate 13;
break;

beginstate 14;
break;

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

