The Dink Network

That fireball's pretty, but...

September 10th 2004, 12:30 PM
sob_scorpb.gif
LadyValoveer
Peasant He/Him New Zealand
Mildly deranged. 
Okay, I'm an absolute beginner at this, as in three days ago I didn't even know what a sprite is.
Well, I've figured that one out, but now I'm stuck on the stupid fireball.

What script should I attach to it to make it actually do something? I tried copying the one from the actual game, but that just makes it crash when I try to use it.
September 10th 2004, 12:44 PM
milder.gif
Kory
Peasant He/Him Croatia
 
You'd have to copy all the graphics, and scripts from it. Or it is 100% gonna crash!
**EDIT** are you sure that you have copyed it all? See the Dink source code in DinkC, and try copying that.
September 10th 2004, 12:53 PM
goblinm.gif
Actually, Kory... I think you're wrong on this one.

You most certainly do *NOT* have to copy the original game folders into your dmod. How do you mean a fireball? The spell is simple... you just do add_item("item-fb", 437, 1); and when that line is run, the fireball spell will appear in your inventory.

If you mean a static fireball (for a torch or something), just give it brain 6. Hope that helps.
September 10th 2004, 12:54 PM
milder.gif
Kory
Peasant He/Him Croatia
 
Meh! I meant the fireball script!
September 10th 2004, 12:55 PM
goblinm.gif
Don't have to copy that either.

Edit: unless you mean to edit it.
September 10th 2004, 01:01 PM
spike.gif
umm, wait till I memorize.
item-fb.c
dam-fire.c

and possibly there are some others..... browse through those scripts and look for externals, and whenever you find one copy the scipt inside the ""'s to your own dmod.
September 10th 2004, 07:31 PM
sob_scorpb.gif
LadyValoveer
Peasant He/Him New Zealand
Mildly deranged. 
I still can't get it to do anything. It just crashes out whenever I try to use it.
I copied item-fb.d and dam-fire.d into my story directory but it was no use.
Is there something I need in my main.d file to get it to run? Some sort of global variable I might be missing?
September 10th 2004, 08:30 PM
sob_scorpb.gif
LadyValoveer
Peasant He/Him New Zealand
Mildly deranged. 
Oh...I found the problem.
Main.d was missing a variable. How did that happen?
It works fine now.
Thanks.
September 10th 2004, 08:34 PM
goblinm.gif
NM
September 11th 2004, 04:15 AM
spike.gif
lol, I don't know. That's happened to me a few times as well...
September 11th 2004, 12:17 PM
sob_scorpb.gif
LadyValoveer
Peasant He/Him New Zealand
Mildly deranged. 
Okay, new question.
Is it possible to use something like
void hit(void) to give a reaction only when you use the fireball on it?
Alternatively, and even better, how can I use
void main(void) to make Dink automatically use a fireball?
September 11th 2004, 12:31 PM
goblinm.gif
I'm not sure that I want to answer either of those questions, heh.

Anyhow, for your first question, you can add some code like this to you dam-fire.c

int &script_of_target = is_script_attached(&missle_target);
if (&script_of_target != 0)
{
run_script_by_number(&script_of_target, "hit_by_fireball");
}

then when the fireball hits something, it will run whatever is in the void hit_by_fireball( void ) of the thing's script.

I haven't tried this myself, so I have no idea if it will work.
September 11th 2004, 05:45 PM
wizardg.gif
Paul
Peasant He/Him United States
 
Another thing you DO have to copy is a certain block of make_global_int commands in main.c (It says these are required at the top). If some of those are missing, that could well result in a crash.
September 11th 2004, 08:20 PM
sob_scorpb.gif
LadyValoveer
Peasant He/Him New Zealand
Mildly deranged. 
Hmm.
I tried adding it to my dam-fire:

int &script_of_target = is_script_attached(&missle_target);
if (&script_of_target != 0)
{
run_script_by_number(&script_of_target, "hit_by_fireball");
}

Then I wrote added this to my character's script:

void hit_by_fireball(void)
{
if(&story == 5)
{
say_stop("`6Hahaha! You think that puny thing can hurt me?", &current_sprite);
}
}

It appears to do nothing. Any suggestions?
September 11th 2004, 08:44 PM
goblinm.gif
I've no ideas at all. Stair-hiding-pine-trees work in a similar way, but with them dam-fire runs the target's die(). Frankly, I've found run_script_by_number to be annoyingly buggy. My suspicion is that &current_sprite is somehow not reset, although that is blatantly impossible... in other words, I have no idea what's going on.
September 13th 2004, 01:36 AM
sob_scorpy.gif
Yea lol, I had the problem too. Once I tried to get Hellfire in Mystery Island without copying s6-vend.c to the story folder of Mystery Island... and as a result, I got the Hellfire for 1500 gold but when i used it, the game crashed immediately!