// 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 0: 0 - nw 1 - sw 2 - se 3 - ne 4 - center

begincreaturescript;

variables;

short i,target;
short pylon_range = 6;

body;

beginstate INIT_STATE;
	set_name(ME,"Gazer Pylon");
	
	set_resistance(ME,0,100);
	set_resistance(ME,1,100);
	set_resistance(ME,2,100);
	set_resistance(ME,3,100);
	set_resistance(ME,4,100);
	set_resistance(ME,5,100);
	set_resistance(ME,6,100);
	set_resistance(ME,7,100);
	
	set_walk_speed(ME,0);
	
	if (get_memory_cell(0) == 4)
		pylon_range = 4;
		
	if (gf(32,5) > 1)
		erase_char(ME);
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; 
	set_act_at_dist(ME,1);
	if (get_attitude(ME) >= 10)
		set_attitude(ME,4);
	if (gf(32,11 + get_memory_cell(0)) == 1) {
		sf(32,11 + get_memory_cell(0),2);
		place_particle_num(ME,22,12,6);		
		}
	
	if (gf(32,11 + get_memory_cell(0)) > 2) {
		sf(32,11 + get_memory_cell(0),0);
		clean_off_particles(ME);
		  	place_particle_num(ME,1,4,8);
			damage_nearby(300 + 200 * gf(32,16),pylon_range,1,0);
			pc_heard_sound_delay(179,100);						
	  		create_missile_spiral(155,25,pylon_range,2);
	  	if (gf(32,16) > 1)
			status_nearby(30 + 4 * gf(32,16),6,19,0);
		
		}
		
break;

beginstate TALKING_STATE;
	print_named_str(ME,"does not respond. It can't talk.");
break;