// basicnpc.txt
// A very simple, naive text. Creature attacks anything it hates nearby.
// Once it has won, it returns to its home.
// NPC that doesn't move or do anything
//   Cell 1,2 - Stuff done flag. If both 0, nothing. Otherwise when this is killed, set to 1.

begincreaturescript;

variables;

short i,target;
short flee = 0;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;
	if ((get_memory_cell(1) != 0) || (get_memory_cell(2) != 0))
		inc_flag(get_memory_cell(1),get_memory_cell(2),1);
break;

beginstate START_STATE; 
	if ((flee == 0) && (get_health(ME) < get_max_health(ME) - 6)) {
		print_str_color("Once he realizes that you can hurt him from here, Trinket",3);
		print_str_color("  backs away a bit.",3);
		flee = 1;
		}
	if (flee > 0) {
		if (dist_to_nav_point(ME,2) > 1)
			approach_nav_point(ME,2,1);
			else erase_char(ME);
		}
	if (am_i_doing_action() == FALSE)
		end_combat_turn();		
break;

beginstate TALKING_STATE;
	print_str("Talking: It doesn't respond.");
break;