Script Troubles
So, I've got this problem, you see. I've got a boss, and when he dies (HP = 0) in the die() procedure I've spawned the script, and it spawns. This is the spawned script:
// Spawned when boss (cave - level 1) dies.
void main ( void )
{
freeze(1);
freeze(¤t_sprite);
say("`2NO! NO!! NOOOooo...", ¤t_sprite);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
int &boom = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2*Snap* *Pop* *Bang*", ¤t_sprite);
int &boom2 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom2, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2It seems I under-", ¤t_sprite);
int &boom3 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom3, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2I underestimated you, Smallwood...", ¤t_sprite);
int &boom4 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom4, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2NOOOooo...",, ¤t_sprite);
int &boom5 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom5, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
sp_active(¤t_sprite, 0);
}
The loads of magic rings blow up, but the boss instantly plays the die seq, and doesn't say anything.
I think what's wrong is, when an enemy reaches 0 HP, as well as the die() procedure running, the enemy plays the die seq and deactivates, or something. So, since it deactivates, it can't say anything, therefore, well, it doesn't say anything. Any help?
// Spawned when boss (cave - level 1) dies.
void main ( void )
{
freeze(1);
freeze(¤t_sprite);
say("`2NO! NO!! NOOOooo...", ¤t_sprite);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
int &boom = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2*Snap* *Pop* *Bang*", ¤t_sprite);
int &boom2 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom2, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2It seems I under-", ¤t_sprite);
int &boom3 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom3, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2I underestimated you, Smallwood...", ¤t_sprite);
int &boom4 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom4, 167);
playsound(24, 22050, 0, 0, 0);
wait(1000);
say("`2NOOOooo...",, ¤t_sprite);
int &boom5 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom5, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
sp_active(¤t_sprite, 0);
}
The loads of magic rings blow up, but the boss instantly plays the die seq, and doesn't say anything.
I think what's wrong is, when an enemy reaches 0 HP, as well as the die() procedure running, the enemy plays the die seq and deactivates, or something. So, since it deactivates, it can't say anything, therefore, well, it doesn't say anything. Any help?
Try setting his brain to 0 at the beginning of his death procedure and using that code in his die procedure. He isn't saying anything because (1)you are using ¤t_sprite in a spawned script and (2)any wait, say_stop, etc will result in him being killed off.
Edit: Check out Mog's script from the original game for a reference.
Edit: Check out Mog's script from the original game for a reference.
First, mark your enemy's hitpoints pretty high. Then,
where you see if (&klife < ) mark the hitpoints that you want it to REALLY have. For example
try this:
void hit( void )
{
oneloop:
int &klife = sp_hitpoints (¤t_sprite, -1);
if (&klife < 250)
{
freeze(1);
freeze(¤t_sprite
say("`%Put the talking here!", ¤t_sprite);
int &boom5 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom5, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
sp_active(¤t_sprite, 0);
sp_nodraw(¤t_sprite, 1);
sp_brain(¤t_sprite, 0);
spawn("your-script");
}
else
{
playsound(your_play_sound);
sp_target(¤t_sprite, 1);
}
NOTE: Your enemy's hitpoints must ALWAYS be higher than the hitpoints you actually want for it.
Hope that helps.
Please, inform, if I forgot something.
where you see if (&klife < ) mark the hitpoints that you want it to REALLY have. For example
try this:
void hit( void )
{
oneloop:
int &klife = sp_hitpoints (¤t_sprite, -1);
if (&klife < 250)
{
freeze(1);
freeze(¤t_sprite
say("`%Put the talking here!", ¤t_sprite);
int &boom5 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom5, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
int &boom6 = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&boom6, 167);
playsound(24, 22050, 0, 0, 0);
wait(200);
sp_active(¤t_sprite, 0);
sp_nodraw(¤t_sprite, 1);
sp_brain(¤t_sprite, 0);
spawn("your-script");
}
else
{
playsound(your_play_sound);
sp_target(¤t_sprite, 1);
}
NOTE: Your enemy's hitpoints must ALWAYS be higher than the hitpoints you actually want for it.
Hope that helps.

Thanks, Skull. But I don't quite think that's what I want.
you are using ¤t_sprite in a spawned script
Yeah, I made a mistake. Sorry. In the die() procedure, I used sp_script();. I didn't spawn it. But, thanks, I'll check out Mog's script.
you are using ¤t_sprite in a spawned script
Yeah, I made a mistake. Sorry. In the die() procedure, I used sp_script();. I didn't spawn it. But, thanks, I'll check out Mog's script.