The Dink Network

Damage Spell

April 1st 2003, 07:05 PM
custom_odd.gif
Alright, I have this spell, it's really pretty simple, but I can't perfect it. It searches for things with the propper brain, then on them creates a sprite, a giant earth spike. Now, this all works fine, the problem is the damage. Right now, the script of the spike is as follows:

void main(void )
{
sp_range(&current_sprite, 30);
sp_brain(&current_sprite, 17);
playsound(6, 22050, 0,0,0);
sp_seq(&current_sprite, 37);
int &str = 5;
&str * &spell_level-earth;
sp_strength(&current_sprite, &str);
}

&spell_level-earth is a global, obviously it is the level of the spell, used to determine the damage.

Now, it'll do the propper damage, only problem, it does the propper damage EVERY FRAME. In Dink.ini I used the set_frame_special command to set the correct frame to damage. This works.. sorta.. Now it plays the hitting sound on that frame.. but all frames still damage. Now, is this just the brain of it? Because I like the brain, it makes it just loop then kills it. I don't want to just manually hurt the sprite with a hurt command line, because it's a radius thing, so I'd like it to also hit nearby things.

Does anyone see a reasonable solution to this? It is absolutely driving me insane...
April 1st 2003, 07:14 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Um... try Brain 7.
April 1st 2003, 07:23 PM
custom_odd.gif
Odd.. now when the spike hit's something that is hard (a rock or something) it plays the sound at the right time, but does nothing to the sprites...
April 1st 2003, 08:01 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Hrm, odd.

You're better off doing something like this:

Give it a brain of 9 (which you know will work with sp_strength), freeze it, figure out the exact time it will take for the animation to play (frame delay * number of frames), and then kill it. So like:

void main(void )
{
int &str = 5;
&str * &spell_level-earth;

freeze(&current_sprite);
sp_brain(&current_sprite, 9);
sp_seq(&current_sprite, 37);
sp_range(&current_sprite, 30);
sp_strength(&current_sprite, &str);

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

wait(1500); //or whatever
sp_kill(&current_sprite,1);
kill_this_task();
}

Sorry for re-organizing the script... bad habit
April 1st 2003, 08:07 PM
custom_odd.gif
Ok, nevermind, it works perfectly, thanks.

I had removed something that set the global, so the strength was 0.

Question though, does it use the sp_range for this, or just the hardbox size?
April 1st 2003, 08:21 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I dunno... I always forget whether sp_range or sp_distance effects the range of the attack. Try one, go into Debug mode in the game, then try the other one, and see which makes a difference. You can see the area in which the sprite can damage something while in debug mode.
April 1st 2003, 08:30 PM
custom_odd.gif
Sweet, I'll try that.

One problem with the script right now tho, an enemy that attacks it's attacker, using sp_target(&current_sprite, &enemy_sprite); will attack where the spike was..

This doesn't happen for missiles.. so I was wondering if there's an easy way to have the enemy attack dink if it knows it was the spell, other than tedius ways like checking the seq of &enemy_sprite, because i'd have to do that on all my enemy scripts...
April 2nd 2003, 04:29 AM
pillbug.gif
IvanMZ
Peasant They/Them
 
I saw this line:

&str * &spell_level-earth;
It is incorrect or not? (No variable receives the result)
April 2nd 2003, 04:32 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Its correct... "&str * &spell_level-earth;" in DinkC works like "&str *= &spell_level-earth;"

"&str *= &spell_level-earth" doesn't work in DinkC.
April 2nd 2003, 12:21 PM
wizardg.gif
Paul
Peasant He/Him United States
 
Yes it does, actually.
Addition and subraction have to be += and -= respecively and devision must be / but for multiplication, you can use either *= or just *. It's just one of those quirks.
April 2nd 2003, 12:36 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Ah... cool.