The Dink Network

scripts dosen't work

May 9th 2005, 03:11 AM
pq_skull.gif
dinkme
Peasant He/Him India
 
I am going nuts, this part is not working. Its the final battle with the boss

Here goes the script

//the final fight at Marrowbeans
void main(void)
{
freeze(1);
screenlock(1);
if (&first == 9);
{
int &boss = create_sprite(311,126,16,801,1);
sp_base_walk(&boss,800);
sp_speed(&boss,1);
sp_dir(&boss,2);
freeze(&boss);

wait(400);
move_stop(1,6,310,1);
sp_dir(1,8);

say_stop("`#So you are the new secretary I called for?",&boss);
say_stop("I am no secretary, I have come here to destroy you",1);
say_stop("I should have guessed, a goblin.",1);
say_stop("Your time is over",1);
say_stop("`#What?",&boss);
say_stop("Yes, the time of this organization is over",1);
say_stop("`#That is what you think",&boss);
say_stop("`#Jack, Hance,Molly, come and kill this mad-man",&boss);
playmidi("42.mid");

//lets create the first chum Jack
int &jack = create_sprite(-70,159,9,383,1);
sp_dir(&jack, 6);
sp_script(&jack,"m2-jack");
freeze(&jack);

//the second one
int &hance = create_sprite(-80,160,9,413,1);
sp_script(&hance,"m2-hance");
sp_dir(&hance,6);
freeze(&hance);

//the third one
int &molly = create_sprite(-90,161,9,259,1);
sp_script(&molly,"m2-molly");
sp_dir(molly,6);
freeze(&molly);

move_stop(&jack,6,102,1);
move_stop(&jack,8,113,1);
move_stop(&hance,6,102,1);
move_stop(&hance,2,256,1);
move_stop(&molly,6,102,1);

say_stop("`5What is it boss, why did you call us",&jack);
say_stop("`#He is a spy, kill him you lot",&boss)l
say_stop("`6What cheek this guy has",&molly);
say_stop("`7Trying to threaten the boss",&hance);

//they have their scripts to attack Dink
//so lets unfreeze them
unfreeze(1);
unfreeze(&jack);
unfreeze(&hance);
unfreeze(&molly);

if (get_sprite_with_this_brain(9, &current_sprite) == 0)
{
spawn("m2-boss");
&first = 10;
}

}
}
scrpt for the boss:

void main( void )
{
if (&first = 10)
{
unfreeze(&current_sprite);
int &mcounter;
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 1);
sp_distance(&current_sprite, 50);
sp_range(&current_sprite, 35);
sp_timing(&current_sprite, 0);
sp_frame_delay(&current_sprite, 55);
sp_exp(&current_sprite, 150);
sp_base_walk(&current_sprite, 800);
sp_base_attack(&current_sprite, 790);
sp_defense(&current_sprite, 10);
sp_strength(&current_sprite, 20);
sp_touch_damage(&current_sprite, 8);
sp_hitpoints(&current_sprite, 350);
preload_seq(792);
preload_seq(794);
preload_seq(796);
preload_seq(798);
preload_seq(805);

preload_seq(801);
preload_seq(803);
preload_seq(807);
preload_seq(809);
}
}

void hit( void )
{
sp_target(&current_sprite, &enemy_sprite);
//lock on to the guy who just hit us
//playsound
playsound(28, 22050,0,&current_sprite, 0);

}

void talk( void )
{
int &randy = random(4, 1);
if (&randy == 1)
say("`#Bye, Dink!", &current_sprite);
if (&randy == 2)
say("`#Its your end!", &current_sprite);
if (&randy == 3)
say("`#You dare chaalenge me", &current_sprite);
if (&randy == 4)
say("`#Hah ha ha!", &current_sprite);

}

void die( void )
{
&first = 10;

}
void attack( void )
{
playsound(27, 22050,0,&current_sprite, 0);
&mcounter = random(4000,0);
sp_attack_wait(&current_sprite, &mcounter);
}

When I test it out and kill the first three guys. Thescript for the boss should activate, but he remains frozen and the game does not proceeds. Anybody help out.

Whats the problem in it?
May 9th 2005, 03:24 AM
spike.gif
you either need to make a loop or put the get_sprite_with_this_brain lines in the assistants' die procedures. (that's the best way) you need to put &first = 10; before spawning the boss too

void die( void )
{
if (get_sprite_with_this_brain(9, &current_sprite) == 0)
{
&first = 10;
sp_script(&boss, "m2-boss");
}
}

EDIT: you'll need to make boss a global or use &first for him (because I can't see the use of that when you only activate the boss's script after the assistants are dead?) btw your if (&first = 10) line only has one =

EDIT2: dammit I guess I should think before posting. use sp_script(&boss, "m2-boss"); instead of spawn();
May 10th 2005, 02:25 AM
pq_skull.gif
dinkme
Peasant He/Him India
 
I tried both the things, but it still does'nt work, the boss remains fozen.I tried the spawn boss function in one of the aprrentices die function. After all the brins o 9 were killed, t should have spawned "the -boss" but it doesen't work.

Any help

Scincerely
Dinkme
May 10th 2005, 09:18 AM
pq_skull.gif
dinkme
Peasant He/Him India
 
Someone please help out?
May 10th 2005, 09:37 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
He could also remain frozen because his void main(void) code never runs.. you've got &first = 10; in the boss his own die procedure but his main procedure needs to be 10 before he'll work.. as scratcher pointed out. Or in other words, what does the variable control? When does it need to be 10? When the boss is dead? Or when he just spawned/activated? That could be something to check.

tried the spawn boss function in one of the aprrentices die function.

That will only work when the last killed foe is that specific enemy. The check needs to be in the three scripts because you don't know in what order the monsters will die, every monster could be the last one to remove the presence of brain 9 creatures. Then you should use sp_script(); to give the boss the properties he needs.