A scripting problem
Somewhere in my DMOD, there is a bonca.
The "die" procedure is the following:
void die( void )
{
if (get_sprite_with_this_brain(9, ¤t_sprite) == 0)
{
//no more brain 9 monsters here, lets unlock the screen
screenlock(0);
playsound(43, 22050,0,0,0);
}
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 6);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
&kill_bonca = 1;
//The problem starts from here
freeze(1);
say_stop("Something odd happened", 1);
say_stop("I feel so strange...", 1);
unfreeze(1);
}
When I play the game, after I kill the bonca, the &kill_bonca variable becomes 1, Dink freezes, than says: "Something odd happened", and than nothing else happends. He never says "I feel so strange...", and never get unfreezed. I have no ideea why. Can anybody help me?
The "die" procedure is the following:
void die( void )
{
if (get_sprite_with_this_brain(9, ¤t_sprite) == 0)
{
//no more brain 9 monsters here, lets unlock the screen
screenlock(0);
playsound(43, 22050,0,0,0);
}
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 6);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
&kill_bonca = 1;
//The problem starts from here
freeze(1);
say_stop("Something odd happened", 1);
say_stop("I feel so strange...", 1);
unfreeze(1);
}
When I play the game, after I kill the bonca, the &kill_bonca variable becomes 1, Dink freezes, than says: "Something odd happened", and than nothing else happends. He never says "I feel so strange...", and never get unfreezed. I have no ideea why. Can anybody help me?
There are various ways to fix this. One way is to use sp_brain(¤t_sprite, 0); like done in en-gmog.c (like scratcher said in this thread) and then the code or you can do:
int &temp = create_sprite(-50, -50, 0, 71, 1);
sp_script(&temp, "en-tr22d");
in void die(void) which creates a random sprite outside the screen with a script attached, then you can place the cutscene/code in that script (in void main(void)) - where en-tr22d is the name of the script, in this case.
Edit: but as it's a short piece of code, the first solution would suit fine I guess (adding sp_brain(¤t_sprite, 0); )
int &temp = create_sprite(-50, -50, 0, 71, 1);
sp_script(&temp, "en-tr22d");
in void die(void) which creates a random sprite outside the screen with a script attached, then you can place the cutscene/code in that script (in void main(void)) - where en-tr22d is the name of the script, in this case.
Edit: but as it's a short piece of code, the first solution would suit fine I guess (adding sp_brain(¤t_sprite, 0); )