The Dink Network

Missiles an' stuff

December 22nd 2007, 08:48 PM
dinkdead.gif
Does "missile" refer to any kind of attack or is it only what I'd think of as a missile, ie. fireballs and arrows etc. (probably bombs as well)?

Also, regarding the required variables &enemy_sprite and &missle_source the DinkC Reference is a tad confusing:
&enemy_sprite - The last known active sprite to attack something. In the case of missiles, will store the player sprite (1).
&missle_source - The last known active sprite to attack something. In the case of missiles, will store the missile's sprite.


Looking at this it seems to mean that both do exactly the same thing in the case of a sprite directly attacking something (eg. punching it) but in the case of a missile then &enemy_sprite will store 1, even if the missile was fired by another sprite, and &missle_source will store the missile's number but not the sprite which fired it, so why is it called &missle_source??
If I am wrong, then what do they store?
December 23rd 2007, 04:21 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
this doesn't make much sense. they should both return the sprite of the missile. unless the dink engine sees the brain and knows it's a missile THEN it might hav to return another number.

i don't think it is possible to trace missiles scources. unless there is only one type of missile. you could have the if statement to see wether a sprite was touched by a missile.

but that isn't the best approach, since many dmods use fireballs and other missiles as normal objects. arrows in shops, fireballs for campfires/torches. it would then think that if an enemy ran into one of these... it would think it got shot.

oh and missile can be both an attack and fireballs/arrows etc.
December 23rd 2007, 07:46 PM
dinkdead.gif
You're saying they're both the same?
If a missile is both a melee and range attack then why say "In the case of missiles..."?

How this started was I thought it didn't make much sense for Dink to say something like "Ow I got splinters" when hitting a signpost if he hit it from across the screen or if a monster hit it, so I did this (which I found in some script):

void hit (void)
{
if (&enemy_sprite != 1) return;
if (&missle_source != 1) return;
//blabla
}

which works, but I don't know exactly how it works, and it's bugging me

I've been doing some testing...

(script attached to a signpost)
Dink will say "ouch" if sign is punched, "burn" if sign is shot, and nothing if a monster hits it.
void hit (void)
{
if (&enemy_sprite != 1) return;
if (&missle_source == 1)
{
say("Ouch, now I have splinters.", 1);
return;
}
say("Burn, signpost!", 1);
}

Now Dink says nothing if the sign is shot, otherwise the same.
void hit (void)
{
if (&missle_source != 1) return;
if (&missle_source == 1)
{
say("Ouch, now I have splinters.", 1);
return;
}
say("Burn, signpost!", 1);
}

So they can't be the same, but I'm still not sure what they are.
Sorry for rambling on a bit, I'm not much good at concise explanations
December 24th 2007, 01:36 AM
knights.gif
Why not just use a local variable to store what key is pressed and then in the sign have a command like this:

)if (&hitkey == 2)
){
)say_stop etc etc
December 24th 2007, 02:38 AM
fairy.gif
Someone
Peasant He/Him Australia
 
I'm pretty sure:
&missle_source will store the sprite that last hit something.

and this code
if (sp_brain(&missle_source,-1) == 11)
&missle_source = 1;
if (sp_brain(&missle_source,-1) == 17)
&missle_source = 1;

sets &missle_source to what &enemy_sprite is.

So missile source doesn't mean the source of the missile, but the source of hit including missiles. &enemy_sprite is just a "poorer" version of &missle_source as you can get &enemy_sprite from &missle_source but not the other way around.
December 24th 2007, 06:58 AM
dinkdead.gif
Ok, thanks Someone. So DinkC ref. says what it means, and it seems I was (more or less) right in the first place.

Blackguard: How? Using wait_for_button() would be a bit tricky I think.
I did this, which is what I wanted to do before getting caught up in semantics:
void hit (void)
{
if (&missle_source == 1)
{
//hit directly by Dink
say("Ouch, now I have splinters.", 1);
return;
}

if (&enemy_sprite != 1)
{
//hit by monster
say("`2Ow!", &enemy_sprite);
return;
}

//hit by missile
//further checks needed to see if hit with fball, arrow, acid rain etc.
say("Burn, signpost!", 1);
}
December 24th 2007, 05:31 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
ok well i am on holidays at the moment so i don't really rely on my scripting talent because i aint using it.

my idea of 'holiday' is kinda weird 'cose im resting after playing dink and now i start scripting in BASIC trying to make a network-play game (The Games Factory for gameplay, BASIC apps for server communication)
December 25th 2007, 05:22 PM
knights.gif
Sweetness!
Ahh well, its hard to tell if my brain thinks to much or to little.