// TOWN SPECIAL ENCOUNTERS
//    Town 70: Fort Ganrick

beginzonescript;

variables;

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

body;

// used group 10 11 12 13 14

beginstate INIT_STATE;
	last_abil = get_current_tick();

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

	set_level(30010,1);

	set_personality_name(1409,"Captain Vidican");
	set_personality_name(1410,"Gridley");
	set_personality_name(1411,"Ian");

	set_crime_tolerance(max_crime);

	set_level(7001,1);
	set_level(7014,1);
	set_level(7019,1);
	
	set_level(7011,3);
	set_level(7013,3);
	set_name(7011,"Nephil Raider");
	
	if (gf(70,17) > 0) {
		set_terrain(1,6,42,13);
		set_floor(1,6,42,15);
		set_terrain(1,7,42,15);
		set_floor(1,7,42,15);
		erase_char(30010);
		}
	if (gf(70,18) > 0) {
		set_terrain(1,16,30,0);
		set_floor(1,16,30,15);
		erase_char(30011);
		}
	if (gf(70,29) > 0) 
		erase_char(30012);
	if (gf(70,27) > 0) 
		erase_char(30013);

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

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if (gf(70,17) == 1) {
		run_game_hardcode(1);
		set_terrain(1,7,42,0);
		set_floor(1,7,42,15);
		set_attitude(30010,10);
		sf(70,17,2);
		}
	if ((is_combat()) && (gf(70,17) > 1) && (gf(71,21) == 0)) {
		sf(71,21,1);
		begin_talk_mode(17);
		}
		
	if ((get_crime_level() >= max_crime) && (im_hostile == 0)) {
		make_zone_hostile();
		im_hostile = 1;
		sf(70,0,1);
		}

	// item hint stage
	if ((gf(70,15) > 0) && (gf(70,16) == 0))
		assert_hint(0);
	if ((gf(70,16) == 0) && (party_has_item_equip(328)) ) {
		sf(70,16,1);
		ok_dlog(47,1);
		}

	// goblins done
	if ((num_chars_in_group(10) == 0) && (gf(70,26) == 0)) {
		sf(70,26,1);
		revive_party();
		ok_dlog(50,4);
		}

	// post goblin fight
	if ((gf(70,26) > 0) && (gf(70,18) == 0) && (party_dist_to_spot(10,27) <= 3)) {
		sf(70,18,1);
		sf(70,28,1);
		set_terrain(1,16,30,0);
		set_floor(1,16,30,15);
		set_attitude(30011,10);
		set_level(30011,1);
		ok_dlog(55,2);
		
		}
		
	if ((on_which_layer() == 0) && (gf(70,27) == 0) && (num_chars_in_group(13) == 0)) {
		sf(70,27,1);
		toggle_quest(71,3);
		toggle_quest(100,1);
		ok_dlog(62,2);
		}
		
	if (gf(70,28) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"Tink. Tink.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"Good morning!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"I'll just be a minute.");
		}
	if ((gf(70,28) > 0) && (gf(70,29) == 0)) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"What is happening?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"Is it the Empire?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"We're doomed!");
		}
	if (gf(70,29) > 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"Did you hear that?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7031,"They're coming.");
		}
	
	if (gf(70,9) < 2) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7009,"This is an outrage.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7009,"The nephilim must be stopped!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(7009,"Their fort is to the east.");
		}
		else {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(7009,"I release you.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(7009,"You are better used elsewhere.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(7009,"Try visiting Formello.");
			}
			
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7029,"Much was lost.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7029,"Never enough.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7029,"Fort Draco sends nothing.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7008,"Oh, my head.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7008,"What do you want?");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(7008,"Ohhhhhh.");

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

