The Dink Network

Immunity to Certain Weapons?

February 6th 2009, 05:55 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
I want an enemy to be immune to Dink's fists, and I've tried putting this in the hit() procedure:

if (&cur_weapon == 1)
{
hurt(&current_sprite, 0);
}

But that didn't work. When I punch the enemy, the game just crashes, not even an error report.

Does anyone have any idea how I can make an enemy immune to Dink's fists?
February 6th 2009, 06:14 PM
fairy.gif
Someone
Peasant He/Him Australia
 
Put this at the top of the hit procedure:

int &t;
&t = sp_pseq(1,-1);
&t / 10;
if (&t = <first 2 digits of fist hit sequences
{
sp_nohit(&current_sprite,1);
wait(1);
sp_nohit(&current_sprite,0);
}

I haven't tested it myself but it should work. This should cause Dink to swipe and miss the enemy. If you want him to hit and do no damage, you can try sp_brain(&current_sprite,0) and back to 9/10 instead of sp_nohit. Or just use nohit and playsound the hit sound yourself.

I described why this works in my advanced dinkc tutorial.
February 6th 2009, 07:09 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
That didn't work, but it's not exactly what I want. I want to be able to see which weapon is armed.

Question: Would creating a global and setting it's value to 1 when the fists are armed do the trick?
February 6th 2009, 07:47 PM
fairy.gif
Someone
Peasant He/Him Australia
 
Oh, I forgot that all weapons use the same seq. &cur_weapon can be used.. but only for the default weapon. This does work:

int &t;
if (&cur_weapon == 1)
{
&t = sp_hitpoints(&current_sprite,-1);
sp_hitpoints(&current_sprite,0);
wait(1);
wait(1);
sp_hitpoints(&current_sprite,&t);
}

February 6th 2009, 09:54 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Through testing this, I've noticed that if you punch the target too fast it can be locked in at 0 hitpoints. To avoid this, spawning another script to wait() and reset the hitpoints should do the trick.

You should also check for &missle_source as well so your projectile spells will be effective even when fists are equipped.


//enemy script
void hit ()
{
if (&cur_weapon == 1)
{
if (&missle_source == 1)
{
&save_x = &current_sprite;
&save_y = sp_hitpoints(&current_sprite,-1);
spawn("script");
}
}
}

//spawned script
void main ()
{
int &en = &save_x;
int &hp = &save_y;
sp_hitpoints(&en,0);
wait(1);
wait(1);
sp_hitpoints(&en,&hp);
}



February 7th 2009, 03:40 AM
fairy.gif
Someone
Peasant He/Him Australia
 
Nice work

btw the spawned script is missing kill_this_task()
February 7th 2009, 09:42 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Thanks, rabidwolf! That's exactly what I needed! Immunity to fists but not magic! Genius!

Thanks to you, too, someone!
February 7th 2009, 09:50 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
I honestly had no clue that you could use the hit procedure in such manner before Someone brought it up. I will, in fact, use a spinoff of this to prevent enemies from damaging each other (this has always bugged me.) I just love learning new tricks to play around with.
February 23rd 2009, 10:38 AM
pq_cthunik.gif
Teej88
Peasant He/Him United Kingdom
No, no that's not right. 
Good Idea for a D-Mod, "The Dink Memory is Lost"
Therefore he forgets to fight
February 23rd 2009, 04:22 PM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
Very interesting, I thought about this before but I didn't think it would work. I might use something like this too!

Great idea and great script