The Dink Network

Script Troubles

March 12th 2008, 04:49 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
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(&current_sprite);
say("`2NO! NO!! NOOOooo...", &current_sprite);

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_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*", &current_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-", &current_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...", &current_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...",, &current_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(&current_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?
March 12th 2008, 07:20 AM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
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 &current_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.
March 12th 2008, 07:52 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
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 (&current_sprite, -1);
if (&klife < 250)
{
freeze(1);
freeze(&current_sprite
say("`%Put the talking here!", &current_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(&current_sprite, 0);

sp_nodraw(&current_sprite, 1);
sp_brain(&current_sprite, 0);

spawn("your-script");
}
else
{
playsound(your_play_sound);

sp_target(&current_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.
March 13th 2008, 04:36 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Thanks, Skull. But I don't quite think that's what I want.

you are using &current_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.