Immunity to Certain Weapons?
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(¤t_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?
if (&cur_weapon == 1)
{
hurt(¤t_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?
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(¤t_sprite,1);
wait(1);
sp_nohit(¤t_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(¤t_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.
int &t;
&t = sp_pseq(1,-1);
&t / 10;
if (&t = <first 2 digits of fist hit sequences
{
sp_nohit(¤t_sprite,1);
wait(1);
sp_nohit(¤t_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(¤t_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.
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?
Question: Would creating a global and setting it's value to 1 when the fists are armed do the trick?
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(¤t_sprite,-1);
sp_hitpoints(¤t_sprite,0);
wait(1);
wait(1);
sp_hitpoints(¤t_sprite,&t);
}
int &t;
if (&cur_weapon == 1)
{
&t = sp_hitpoints(¤t_sprite,-1);
sp_hitpoints(¤t_sprite,0);
wait(1);
wait(1);
sp_hitpoints(¤t_sprite,&t);
}
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 = ¤t_sprite;
&save_y = sp_hitpoints(¤t_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);
}
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 = ¤t_sprite;
&save_y = sp_hitpoints(¤t_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);
}
Nice work
btw the spawned script is missing kill_this_task()
btw the spawned script is missing kill_this_task()
Thanks, rabidwolf! That's exactly what I needed! Immunity to fists but not magic! Genius!
Thanks to you, too, someone!
Thanks to you, too, someone!
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.
Good Idea for a D-Mod, "The Dink Memory is Lost"
Therefore he forgets to fight
Therefore he forgets to fight