// TOWN SPECIAL ENCOUNTERS
//    Town 29: Egli

beginzonescript;

variables;

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

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

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

	set_personality_name(580,"Seno");
	set_personality_name(581,"Oratem");
	set_personality_name(582,"Crean");
	set_personality_name(583,"Vahnatai Woman");
	set_personality_name(584,"Clodeca");
	set_personality_name(585,"Oth-Ihrno");
	set_personality_name(586,"Rentar-Ihrno");
	set_personality_name(587,"Lith");
	set_personality_name(588,"Small Demon");

	if (gf(28,9) == 0)
		erase_char(2904);
	
	set_crime_tolerance(max_crime);

	if (gf(29,3) == 1)
		sf(29,3,2);
		
		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(29,3) == 1) && (char_ok(2914) == FALSE) && (get_terrain(0,28,11) != 0)) {
		print_str("You hear stone grinding on stone.");
		set_terrain(0,28,11,0);
		play_sound(20);
		}
		
	if (gf(28,9) > 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2900,"Power is in the prism.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2900,"An odd scroll.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2900,"The visitors are strange.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2900,"Not all humans are alike.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2901,"Grind. Grind.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2901,"I buy goods.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2901,"I make brews.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2902,"Have some soup.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2902,"I need aid.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2902,"Someone has to work.");
		if (get_ran(1,0,100) < 15)
			give_char_text_bubble(2902,"I am no mage.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2911,"I am an apprentice.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2911,"So many scroll.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2911,"Years of learning.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2905,"I am leader here.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2905,"Have you come to learn?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2905,"I am asked to trust you.");
		if ((get_ran(1,0,100) < 20) && (gf(29,9) == 0))
			give_char_text_bubble(2906,"Intruder!");
		if ((get_ran(1,0,100) < 20) && (gf(29,9) == 0))
			give_char_text_bubble(2906,"You must go.");
		if ((get_ran(1,0,100) < 10) && (gf(29,9) > 0))
			give_char_text_bubble(2906,"We have a common foe.");
		if ((get_ran(1,0,100) < 10) && (gf(29,9) > 0))
			give_char_text_bubble(2906,"You have served us.");
		if ((get_ran(1,0,100) < 10) && (gf(29,9) > 0))
			give_char_text_bubble(2906,"I will tolerate you.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2907,"(Tik. Tik.)");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2907,"(Chip. Chip.)");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2907,"(Polish. Polish.)");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2907,"Hrm.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2904,"You're stupid.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2904,"Jerk.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2904,"You are ugly.");
		if (get_ran(1,0,100) < 3)
			give_char_text_bubble(2904,"(Farts.)");

		}
		
break;

beginstate 10;
break;

beginstate 11;
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);

