📧 Message Board Archive

Problems,problems, problems.. Need help
Hi.. What's wrong with this script? The tree won't burn. Treeburn should do it, and it works 100% sure. So problem must be in this script. Also the tree- globals are allright.

Please help.



//The tree blocking your way



void main( void )

{

sp_hard(&current_sprite, 0);

draw_hard_map();

}



void talk( void )

{

if (&tree == 1)

{

say_stop("i need to do something for this tree!", 1);

return;

}



if (&tree == 4)

{

say_stop("Your days are over, tree..", 1);

return;

}



if (&tree > 4)

{

say_stop("How does it feel to be burned up? Haw haw!", 1);

return;

}



if (&tree == 0)

{

freeze(1);

say_stop("When the hell did this tree pop up in here!?", 1);

wait(500);

say_stop("It's blocking my way to the dock, ", 1);

say_stop("i need to do something!", 1);

&tree = 1;

unfreeze(1);

return;

}



}



void hit( void )

{

int &fireball = compare_magic("item-fb");

if (&fireball == 1)

 {

 sp_script(&current_sprite, "s1-treeburn");

 return;

 }



if (&tree > 4)

{

say_stop("Loser!", 1);

return;

}



if (&tree < 4 )

{

say_stop("Why won't you just DIE!?!", 1);

}



}
Re: Problems,problems, problems.. Need help
: Hi.. What's wrong with this script? The tree won't burn. Treeburn should do it, and it works 100% sure. So problem must be in this script. Also the tree- globals are allright.



I didn't check your script, but I believed that the problem should be in the script of "dam-fire" and "dam-sfb". I did get the similar problem a long time ago. It seems that every time a fireball hits something, it would run "damage" of the dam-fire. If the fireball saw a pinetree, it would try to run run_script_by_number(&scrap, "DIE"). So you should put your burning-control in die() instead of hit().
Re: Problems,problems, problems.. Need help
: : Hi.. What's wrong with this script? The tree won't burn. Treeburn should do it, and it works 100% sure. So problem must be in this script. Also the tree- globals are allright.



: I didn't check your script, but I believed that the problem should be in the script of "dam-fire" and "dam-sfb". I did get the similar problem a long time ago. It seems that every time a fireball hits something, it would run "damage" of the dam-fire. If the fireball saw a pinetree, it would try to run run_script_by_number(&scrap, "DIE"). So you should put your burning-control in die() instead of hit().



Exactly right mimifish.



The dam-fire script checks the seq and frame of what it hits.  But, it also checks if it has a script, and if it has a script it runs the DIE proc.  If not, it just does the little burn animation and stuff.  So what you need is the DIE proc to have whatever you want to happen.  Using compare_magic doesn't work too well because you can hit it with your fist and your magic will still be fireball...so it would burn.  See what i'm saying?





Naa, didn't work, or i understood it wrong.
I modified the script little, to look like below, but it didn't work.. At least correct. The tree Didn't burn and Dink didn't said nothing, but the tree's hardness went off. Odd. Treeburn.c is also below, if it doesn't work right with this script or something.



//The stupid tree



void main( void )

{

sp_hard(&current_sprite, 0);

draw_hard_map();

}



void talk( void )

{

if (&tree == 1)

{

say_stop("i need to do something for this tree!", 1);

return;

}



if (&tree == 4)

{

say_stop("Your days are over, tree..", 1);

return;

}



if (&tree > 4)

{

say_stop("How does it feel to be burned up? Haw haw!", 1);

return;

}



if (&tree == 0)

{

freeze(1);

say_stop("When the hell did this tree pop up in here!?", 1);

wait(500);

say_stop("It's blocking my way to the dock, ", 1);

say_stop("i need to do something!", 1);

&tree = 1;

unfreeze(1);

return;

}



}



void hit( void )

{



if (&tree > 4)

{

say_stop("Loser!", 1);

return;

}



if (&tree < 4 )

{

say_stop("Why won't you just DIE!?!", 1);

}



}



void die( void )

{

int &brub = compare_magic("item-fb");

if (&brub == 1)

 {

 sp_script(&current_sprite, "s1-treeburn");

 return;

 }



}







//Fry tree.. BURNING!!!!

void hit(void)

{

freeze(1);



script_attach(1000);



&save_x = sp_x(&current_sprite, -1);

&save_y = sp_y(&current_sprite, -1);



int &come = create_sprite(&save_x, &save_y, 7, 167, 1);

sp_seq(&come, 167);

playsound(24, 22052, 0, 0, 0);

wait(100);



&save_x -= 10;

&save_y -= 10



sp_seq(&current_sprite, 20);

playsound(6,22050,0,&current_sprite,0);





&come = create_sprite(&save_x, &save_y, 7, 167, 1);

sp_seq(&come, 167);

playsound(24, 22052, 0, &current_sprite, 0);

wait(50);



sp_brain_parm(&current_sprite, 10);

sp_brain(&current_sprite, 12);



&save_y += 20;

&save_x += 20;



&come = create_sprite(&save_x, &save_y, 7, 167, 1);

sp_seq(&come, 167);

playsound(24, 20000, 0, 0, 0);

wait(200);



&save_x -= 10;

&save_y -= 10;



&come = create_sprite(&save_x, &save_y, 7, 167, 1);

sp_seq(&come, 167);

playsound(24, 20000, 0, &current_sprite, 0);



sp_kill(&current_sprite, 200);



int &hold = sp_editor_num(&current_sprite);

 if (&hold != 0)

  editor_type(&hold, 1);



sp_hard(&current_sprite, 1);

draw_hard_map();



wait(500);

say_stop("Yeah! Cleared up the path.", 1);

say_stop("Now i can go to the dock and sail to Terris.", 1);

&tree = 5;

unfreeze(1);

kill_this_task();

return;

  }



}
Re: Naa, didn't work, or i understood it wrong.
: I modified the script little, to look like below, but it didn't work.. At least correct. The tree Didn't burn and Dink didn't said nothing, but the tree's hardness went off. Odd. Treeburn.c is also below, if it doesn't work right with this script or something.



: void die( void )

: {

: int &brub = compare_magic("item-fb");

:  if (&brub == 1)

:  {

:  sp_script(&current_sprite, "s1-treeburn");

:  return;

:  }

: }



I just remembered somthing, I heard compare_magic() doesn't work. I haven't tested it myself, but if that's the problem, I have the sulotion. There's an undocumented command, used in some of the game's scripts. It will allow you to check for the sprite being hit by a fireball, rather than dink having fireball equiped. That's what you really want know anyway, I assume.



int &brub = compare_sprite_script(&missle_source, "dam-fb");

if (&brub == 1)

{

   //do stuff

}
Re: Naa, didn't work, or i understood it wrong.
: I modified the script little, to look like below, but it didn't work.. At least correct. The tree Didn't burn and Dink didn't said nothing, but the tree's hardness went off. Odd. Treeburn.c is also below, if it doesn't work right with this script or something.



The tree loses it's hardness if it has no Die script (dam-stat script does it).

The compare_magic didn't work correctly when I tried to use it.