A question
I want to make a certain sword able to burn trees when I hit them with it. How can I make this happen?
First thing that comes to mind is to check ehich is equipped In the tree-scrpts void hit and then make sure it's the sword. Then check if dink is the source of the damage ( not some kind of spell that shouldn't burn trees)
IPD's method is probably the easiest, but it would suck to have to attach a script to every tree, especially going back and making sure *every* tree has the script. However, all the methods of figuring out if you hit a tree without the tree's script are overly complicated (at least all the ones I can think of). My best suggestion would probably be to go with IPD's idea, or to add a little explosion effect that has a similar script to dam-fire.c, as it sounds cool and you wouldn't have to script all the trees.
I'd go with the mini-explosion myself. I assume this is a flaming sword or something, so perhaps you can even turn it into a suitable special effect. Otherwise an invisible sprite would do fine.
Hmmm... it seems there isn't an actual script for tree burning. That really sucks.
What do you mean? The part where the tree actually burns and stays burned can be found in dam-fire.c, if that's what you mean.
Wait... nevermind. That fails, anyway.
EDIT: It's weird, cause I'm trying to find the reason why a fireball, for example, burns a tree. But I can't find the reason. I thought maybe there's something in the fireball script, which I could copy to my sword script, but apparently the whole burning process is controlled from the dam-fire.c script.
EDIT: It's weird, cause I'm trying to find the reason why a fireball, for example, burns a tree. But I can't find the reason. I thought maybe there's something in the fireball script, which I could copy to my sword script, but apparently the whole burning process is controlled from the dam-fire.c script.
The tree burning happens within dam-fire, specifically the damage procedure. The script checks to see if the hit object has the sequence and frame of the proper tree. If the target is in fact the correct tree sprite, then it causes the tree to burn and sets the editor info of the tree to stay burned.
I think Pillbug has the right idea. Within your weapon script use procedure, create a stationary missile in front of Dink with a modified version of the dam-fire script to burn the tree.
I think Pillbug has the right idea. Within your weapon script use procedure, create a stationary missile in front of Dink with a modified version of the dam-fire script to burn the tree.
Since Dink v1.08 the variable &missile_target also works for swords. So really you could do exactly the same thing as dam_fire.c does: Check if the thing you're hitting is a tree by checking its frame and sequence number and then burning it down. You could do that in the void_use(){} procedure of your sword's script. I think putting the check after a wait() command would be best as the sword only hits something after a number of frames...
Um... sorry to ask, Meta, but can you bother to create the script for me? I don't really get what you're saying, cause I'm an idiot, so perhaps showing me would be the best way.

Sorry, but I'm really busy today, and probably tomorrow too. Maybe on wednesday, not before that.
If you can wait, I would like the challenge I think...
If you can wait, I would like the challenge I think...

Sounds kind of unreliable. Waits =
. If there is a good method to get the right &missile_target, though, that would be ideal.

No, I believe the only viable ways to do this are to either make the sword create a small "missile" like an explosion and check for the tree in that explosion script (same way as the fireball works) or attach a script to all the trees that checks for being hit by that specific sword. If you choose for the second option, then you can easily use the Sprite Replacer tool to attach the same script to every instance of the tree. I would personally go for the first method if you want cool looks and maybe some extra gameplay to go with it or the second method if it needs to be quick and easy

Didn't Dinkdude95 have a sword that burns the trees? I remember somebody had one anyway, shown in a sword showcase file somewhere (coulda been a beta of some sort though).
April 10th 2012, 03:40 PM

shevek


Didn't Dinkdude95 have a sword that burns the trees?
Yes, there's one in Trials of a Boy: Enter the Iceland. I'm pretty sure this works with an explosion. And it's not invisible.
Yes, there's one in Trials of a Boy: Enter the Iceland. I'm pretty sure this works with an explosion. And it's not invisible.

Thanks to Kyle, I now have an excellent sword which burns trees.
Although I am facing another problem. I'm trying to make it so when I punch a pillar (¤t_sprite), a rock (&temp6hold) falls and hurts the enemy (&temphold). Well, to a certain point, it works perfectly, but after the rock has moved down, the script just completely stops working. Weird thing is, if I remove the move_stop -line, it works perfectly again. Here's the script:
void main( void )
{
freeze(¤t_sprite);
sp_hitpoints(¤t_sprite, 300);
sp_brain(¤t_sprite, 9);
}
void talk(void)
{
say("This pillar looks weak.", 1);
}
void hit(void)
{
playmidi("45.mid");
}
void die(void)
{
sp_hard(¤t_sprite, 1);
sp_nohit(¤t_sprite, 1);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
&pillars += 1;
sp_speed(&temp6hold, 6);
freeze(&temp6hold);
sp_que(&temp6hold, 800);
sp_nodraw(&temp6hold, 0);
move_stop(&temp6hold, 2, 268, 1);
hurt(&temphold, 300);
wait(300);
sp_nodraw(&temp6hold, 1);
move_stop(&temp6hold, 8, 12, 1);
}

Although I am facing another problem. I'm trying to make it so when I punch a pillar (¤t_sprite), a rock (&temp6hold) falls and hurts the enemy (&temphold). Well, to a certain point, it works perfectly, but after the rock has moved down, the script just completely stops working. Weird thing is, if I remove the move_stop -line, it works perfectly again. Here's the script:
void main( void )
{
freeze(¤t_sprite);
sp_hitpoints(¤t_sprite, 300);
sp_brain(¤t_sprite, 9);
}
void talk(void)
{
say("This pillar looks weak.", 1);
}
void hit(void)
{
playmidi("45.mid");
}
void die(void)
{
sp_hard(¤t_sprite, 1);
sp_nohit(¤t_sprite, 1);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
&pillars += 1;
sp_speed(&temp6hold, 6);
freeze(&temp6hold);
sp_que(&temp6hold, 800);
sp_nodraw(&temp6hold, 0);
move_stop(&temp6hold, 2, 268, 1);
hurt(&temphold, 300);
wait(300);
sp_nodraw(&temp6hold, 1);
move_stop(&temp6hold, 8, 12, 1);
}
You're doing that stuff in void die(), which means it won't completely run. Move_stop will pause that script, but it will die in the meanwhile. You can solve this easily by changing the sprite's brain to 0 at the start of the die() procedure
And if that's not enough, put all that stuff in an external().

And if that's not enough, put all that stuff in an external().