Reply to Re: Spawning a Monster From a Barrel
If you don't have an account, just leave the password field blank.
Maybe it would be easier to modify the make.c script and spawn the monster the same way normal barrels spawn hearts and such. All you would have to do is make a new procedure in it.
Instead of copying from the empty barrel script, you probably should've looked at a barrel script that actually spawns an item. I've made some sample script for what you're trying to accomplish. BTW in the barrel hit script I only modified the procedure name of the external script and cut out the comments.
//hit procedure for barrel script
void hit ( void )
{
playsound(37, 22050, 0,0,0);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
{
editor_type(&hold, 3);
editor_seq(&hold, 173);
editor_frame(&hold, 6);
}
sp_seq(¤t_sprite, 173);
sp_brain(¤t_sprite, 5);
sp_notouch(¤t_sprite, 1);
sp_nohit(¤t_sprite, 1);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
external("make", "wbonc");
sp_hard(¤t_sprite, 1);
draw_hard_sprite(¤t_sprite);
kill_this_task();
}
//new procedure for make.c
void wbonc( void )
{
int &mcrap = random(1,5);
if (&mcrap == 1)
{
int &bonc = create_sprite(&save_x,&&save_y,9,533,1);
sp_script(&bonc,"en-bonc");
}
}
Instead of copying from the empty barrel script, you probably should've looked at a barrel script that actually spawns an item. I've made some sample script for what you're trying to accomplish. BTW in the barrel hit script I only modified the procedure name of the external script and cut out the comments.
//hit procedure for barrel script
void hit ( void )
{
playsound(37, 22050, 0,0,0);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
{
editor_type(&hold, 3);
editor_seq(&hold, 173);
editor_frame(&hold, 6);
}
sp_seq(¤t_sprite, 173);
sp_brain(¤t_sprite, 5);
sp_notouch(¤t_sprite, 1);
sp_nohit(¤t_sprite, 1);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
external("make", "wbonc");
sp_hard(¤t_sprite, 1);
draw_hard_sprite(¤t_sprite);
kill_this_task();
}
//new procedure for make.c
void wbonc( void )
{
int &mcrap = random(1,5);
if (&mcrap == 1)
{
int &bonc = create_sprite(&save_x,&&save_y,9,533,1);
sp_script(&bonc,"en-bonc");
}
}