// eggsac.txt - When character gets close, starts to wriggle. Then a critter bursts out

// Cell 0 - id of critter to spawn
// Cell 1 - degree with which to buff it

beginobjectscript;

variables;

short last_abil;
short timer = 0;
short active = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; 
	if ((tick_difference(last_abil,get_current_tick()) > 0) && (active > 0)) {
		timer = timer + 1;
		last_abil = get_current_tick();
		}
	if (timer == 3) {
		spawn_creature(get_memory_cell(0));
		set_attack_bonus(get_memory_cell(0),get_memory_cell(1));
		if (get_memory_cell(1) >= 10)
			force_char_status(get_memory_cell(0),24,8);
		place_particle_num(get_memory_cell(0),7,1,6);
		play_sound(148);
		kill_object(ME,0);
		end();
		}
	if ((dist_to_party() <= 2) && (active == 0)) {
		print_str_color("An egg sac is disturbed by your movements. It starts to wiggle.",2);
		active = 1;
		place_particle_num(ME,7,1,6);
		play_sound(152);
		}
break;

beginstate 3;
	
break;

beginstate USE_STATE;
	print_str_color("Use: You poke at the egg sac. It's gross.",2);
break;