The Dink Network

My Script Crashing!!

July 9th 2003, 05:10 AM
stonegiant.gif
I need help ive got a boss script but it crashes
can you see whats wrong with it?

//zhyu brain

void main( void )
{

int &fsave_x;
int &kcrap;
int &dam;
int &fsave_y;
int &spark;
int &speed = 1;
int &resist;
int &mcounter;
int &mtarget;
sp_brain(&current_sprite, 10);
sp_timing(&current_sprite, 33);
sp_speed(&current_sprite, 1);
sp_nohit(&current_sprite, 0);
sp_exp(&current_sprite, 0);
sp_base_walk(&current_sprite, 580);
sp_touch_damage(&current_sprite, 15);
sp_hitpoints(&current_sprite, 300);
sp_defense(&current_sprite, 15);

sp_target(&current_sprite, 1);

}

void attack( void )
{
unfreeze(&current_sprite);
&mcounter = random(4000,2000);
sp_attack_wait(&current_sprite, &mcounter);

&kcrap = sp_target(&current_sprite, -1);
&fsave_x = sp_x(&kcrap, -1);
&fsave_y = sp_y(&kcrap, -1);

&resist = random(2, 1);
if (&resist == 1)
{
//cast some kind of bomb
freeze(&current_sprite);
sp_speed(&current_sprite, 0);
// sp_dir(&current_sprite, 0);
sp_seq(&current_sprite, 0);
sp_frame(&current_sprite, 0);
sp_pseq(&current_sprite, 580);
sp_pframe(&current_sprite, 1);
wait(500);
&save_x = sp_x(1, -1);
&save_y = sp_y(1, -1);
sp_pseq(&current_sprite, 580);
sp_pframe(&current_sprite, 2);
wait(200);
sp_pseq(&current_sprite, 580);
sp_pframe(&current_sprite, 1);
wait(200);
sp_pseq(&current_sprite, 580);
sp_pframe(&current_sprite, 2);
wait(200);
sp_pseq(&current_sprite, 580);
sp_pframe(&current_sprite, 1);
wait(200);
say("`4<Casts HellBlast>", &current_sprite);
playsound(31, 12050,0,0, 0);
spawn("dam-bom2");
sp_brain(&current_sprite, 10);
sp_speed(&current_sprite, &speed);
unfreeze(&current_sprite);

return;
}
&resist = random(40, 1);

//if NPC, turn off resist option
if (&kcrap != 1)
&resist = 100000;

if (&resist > &magic)
{
say("`4<Casts Mega Blast>", &current_sprite);

playsound(31, 12050,0,0, 0);
hurt(&kcrap, 30);

&fsave_y -= 29;
&spark = create_sprite(&fsave_x, &fsave_y, 7, 70, 1);
sp_seq(&spark, 70);
sp_que(&spark, -70);
sp_speed(&spark, 5);
return;
}

playsound(31, 44050,0,0, 0);
&fsave_y -= 29;
int &spark = create_sprite(&fsave_x, &fsave_y, 7, 166, 1);
sp_seq(&spark, 166);
sp_que(&spark, -70);
say("Magic resisted.", &kcrap);
}

void hit( void )
{
playsound(46, 3050, 4000, &current_sprite, 0);
sp_speed(&current_sprite, &speed);

sp_brain(&current_sprite, 10);
unfreeze(&current_sprite);

&dam = sp_hitpoints(&current_sprite, -1);

if (&dam < 270)
{
sp_timing(&current_sprite, 0);
sp_speed(&current_sprite, 2);
&speed = 2;
sp_frame_delay(&current_sprite, 60);
}

if (&dam < 200)
{
&speed = 3;
sp_speed(&current_sprite, 3);
sp_frame_delay(&current_sprite, 50);

}

if (&dam < 100)
{
&speed = 4;
sp_speed(&current_sprite, 4);
sp_frame_delay(&current_sprite, 40);

}

if (&dam < 15)
{
&speed = 5;
sp_speed(&current_sprite, 5);
sp_frame_delay(&current_sprite, 30);

}

&dam = random(2,1);

if (&dam == 1)
return;

&dam = sp_hitpoints(&current_sprite, -1);

if (&dam < 6)
{
say("`%Smallwood You Fool!", &currenT_SPRITE);
return;
}

if (&dam < 15)
{
say("`%Your Just Like A Bug Smallwood", &currenT_SPRITE);
return;
}

if (&dam < 50)
{
say("`% I Will Miss You Smallwood", &currenT_SPRITE);
return;
}

if (&dam < 100)
{
say("`%This Is Your Last Fight Smallwood!", &currenT_SPRITE);
return;
}

if (&dam < 140)
{
say("`%Your Going To Hell Smallwood", &currenT_SPRITE);
playsound(49, 22050, 0, &current_sprite, 0);
return;
}

if (&dam < 160)
{
say("`%You'll Be Dead Soon.", &currenT_SPRITE);
return;
}

if (&dam < 180)
{
say("`%Your Doing Well Smallwood", &currenT_SPRITE);
return;
}

if (&dam < 200)
{
say("`%Time To Die Smallwood!", &currenT_SPRITE);
return;
}

if (&dam < 240)
{
say("`%This Is So Fun!", &currenT_SPRITE);
return;
}

if (&dam < 260)
{
say("`%Dink You Shall Die", &currenT_SPRITE);
return;
}

if (&dam < 280)
{
say("`%Ouch! You Will Pay For That", &currenT_SPRITE);
return;
}

say("`%Dink Why Bother? Ill Destroy You!", &currenT_SPRITE);

//lock on to the guy who just hit us
//playsound

}

void die( void )
{
&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);
say("EAT IT!", 1);
add_exp(10000, &current_sprite);

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

playsound(24, 22052, 0, 0, 0);
int &mcrap = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&mcrap, 167);
wait(100);

playsound(24, 22052, 0, 0, 0);
int &mcrap = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&mcrap, 167);
wait(100);
&save_x -= 40;
&save_y -= 30;
playsound(24, 22052, 0, 0, 0);
int &mcrap = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&mcrap, 167);
wait(100);

&save_x += 80;
&save_y += 60;

playsound(24, 22052, 0, 0, 0);
int &mcrap = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&mcrap, 167);
wait(100);
&save_x += 10;
&save_y += 20;

playsound(24, 22052, 0, 0, 0);
int &mcrap = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&mcrap, 167);
wait(100);
&save_x -= 30;
&save_y -= 60;

playsound(24, 22052, 0, 0, 0);
int &mcrap = create_sprite(&save_x, &save_y, 7, 167, 1);
sp_seq(&mcrap, 167);
wait(100);
sp_brain_parm(&current_sprite, 5);
sp_brain(&current_sprite, 12);
script_attach(1000);
wait(500);
wait(2000);

say_stop("Ha No One Can Kill Me", 1);
wait(500);
say_stop("<Smile>", 1);
&life = &lifemax;
wait(500);
say_stop("Heheheh", 1);
unfreeze(1);
&story = 15;

kill_this_task();
}
July 9th 2003, 06:10 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
It crashes HOW? Be more specific what the problem is.
July 9th 2003, 06:21 AM
stonegiant.gif
The Game Freezes Up After I Kill The Boss It Freezes I Cant Walk Or Do Anything
July 9th 2003, 06:36 AM
old.gif
When a sprite dies, only 2~5 lines are run from the die procedure...

solution:

copy paste the commands in void die(void)
and paste them in a new file:

void main(void)
{
//paste code here

kill_this_task();
}

in the boss script put spawn("newscriptfilenamewithout.c"); in the void die(void) procedure...

it should fix it.
July 9th 2003, 06:38 AM
old.gif
also:

1. remove the script_attach(1000);

2. change &current_sprite into &mcrap ( in the commands before script_attach(1000);
July 9th 2003, 06:45 AM
stonegiant.gif
YOU ARE THE BEST!!
IT WORKED WOHOOO!
opps caps :S i was to happy
July 9th 2003, 06:49 AM
stonegiant.gif
uhh i didnt do that bit and it also works anyway lol