The Dink Network

Problem with hitting

October 6th 2011, 12:35 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
I borrowed the Dink boss script from Cloud Castle 2 and changed it into Dark Dink. I also changed the sword into plain fist. After some fiddling, it's working almost perfectly. However, whenever Dark Dink tries to punch me, he always misses. He might punch around a hundred times and should definitely hit me, but however, he never does, and I can't figure out why. No sound, no blood, no damage, absolutely nothing happens when he punches around. Can anybody help me with this, cause I can't see what's wrong with it. Here's the script:

// Dark Dink

void main( void )
{
screenlock(1);
playmidi("4.mid");
  int &mcounter;
  int &junk;
  sp_base_walk(&current_sprite, 940);
  sp_brain(&current_sprite, 9);
  sp_timing(&current_sprite, 1);
  sp_speed(&current_sprite, 2);
  sp_hitpoints(&current_sprite, 2000);
  sp_touch_damage(&current_sprite, 10);
  sp_strength(&current_sprite, 15);
SP_DEFENSE(&current_sprite, 5);
  sp_base_attack(&current_sprite, 950);
  sp_distance(&current_sprite, 70);
  sp_range(&current_sprite, 60);
  sp_target(&current_sprite, 1);
sp_exp(&current_sprite, 0);
  int &dinkx;
  int &dinky;
  int &knitx;
  int &knity;
  int &diff;
int &delay = 8000;
loop:
  wait(100);  
  &delay -= 100;
  if (&delay > 0)
    goto loop;
  &delay = 8000;

  &junk = random(500, 500);
  wait(&junk);
  if (&life < 1)
    goto loop;

  &dinkx = sp_x(&current_sprite, -1);
  &dinky = sp_y(&current_sprite, -1);
  &knitx = sp_x(1, -1);
  &knity = sp_y(1, -1);

  &junk = 0;

  &diff = &dinky;
  &diff -= &knity;
  if (&diff < 0)
    &diff *= -1; 
  if (&diff < 50)
  {
    if (&knitx > &dinkx>
    {
freeze(&current_sprite);
      sp_seq(&current_sprite, 966);
      sp_frame(&current_sprite, 1);
      sp_kill_wait(&current_sprite);
      sp_nocontrol(&current_sprite, 1);
      wait(100);
unfreeze(&current_sprite);
      &dinkx += 30;
      &junk = create_sprite(&dinkx, &dinky, 11, 516, 1);
      sp_seq(&junk, 506); 
      sp_dir(&junk, 6);
    } else
    {
freeze(&current_sprite);
      sp_seq(&current_sprite, 964);
      sp_frame(&current_sprite, 1);
      sp_kill_wait(&current_sprite);
      sp_nocontrol(&current_sprite, 1);
      wait(100);
unfreeze(&current_sprite);
      &dinkx -= 30;
      &junk = create_sprite(&dinkx, &dinky, 11, 514, 1);
      sp_seq(&junk, 504); 
      sp_dir(&junk, 4);
    }
  }
  
  if (&junk < 1)
  {
    &diff = &dinkx;
    &diff -= &knitx;
    if (&diff < 0)
      &diff *= -1; 
    if (&diff < 50)
    {
      if (&knity > &dinky>
      {
freeze(&current_sprite);
        sp_seq(&current_sprite, 962);
        sp_frame(&current_sprite, 1);
        sp_kill_wait(&current_sprite);
        sp_nocontrol(&current_sprite, 1);
        wait(100);
unfreeze(&current_sprite);
        &junk = create_sprite(&dinkx, &dinky, 11, 512, 1);
        sp_seq(&junk, 502); 
        sp_dir(&junk, 2);
      } else
      {
freeze(&current_sprite);
        sp_seq(&current_sprite, 968);
        sp_frame(&current_sprite, 1);
        sp_kill_wait(&current_sprite);
        sp_nocontrol(&current_sprite, 1);
        wait(100);
unfreeze(&current_sprite);
        &junk = create_sprite(&dinkx, &dinky, 11, 518, 1);
        sp_seq(&junk, 508); 
        sp_dir(&junk, 8);
      }
    }
  }

  if (&junk > 0)
  {
    playsound(17, 8000, 0, &junk ,0);
    sp_timing(&junk, 0);
    sp_speed(&junk, 6);
    sp_strength(&junk, 20);
    sp_flying(&junk, 1);
    sp_range(&junk, 20);
    sp_script(&junk, "dam-sfb");
    &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
    sp_brain_parm(&mshadow, &junk);
    sp_que(&mshadow, -500);
    sp_nohit(&mshadow, 1);
    sp_brain_parm(&junk, &current_sprite);
    wait(500);
  }

  goto loop;
}

void hit( void )
{
oneloop:
int &klife = sp_hitpoints (&current_sprite, -1);
if (&klife < 1401)
{
freeze(1);
freeze(&current_sprite);
sp_touch_damage(&current_sprite, -1);
move_stop(&current_sprite, 8, 150, 1);
move_stop(&current_sprite, 2, 150, 1);
move_stop(&current_sprite, 4, 170, 1);
move_stop(&current_sprite, 6, 170, 1);
sp_dir(&current_sprite, 6);
say_stop("`%This isn't over!", &current_sprite);
wait(500);
	 int &flame = create_sprite(170, 150, 7, 167, 1);
	 sp_seq(&flame, 167);
	 playsound(24, 22052, 0, 0, 0);
	 int &flame = create_sprite(170, 150, 7, 167, 1);
	 sp_seq(&flame, 167);
	 playsound(24, 22052, 0, 0, 0);
  //remove rocks hardness and sprite
  sp_hard(&current_sprite, 1);
  draw_hard_map(&current_sprite);
  sp_active(&current_sprite, 0);
int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
    {
     //this was placed by the editor, lets make it not come back
     editor_type(&hold, 1); 
     //kill food forever
    }
  //remove the cracks as well, as they would look silly now
sp_dir(1, 2);
say_stop("You can bet it ain't!", 1);
wait(1500);
say_stop("What was that all about?", 1);
wait(1500);
say_stop("Anyway, I gotta get to those blue knights and rescue Libby!", 1);
wait(500);
say_stop("I hope the word has spread about me rescuing the girls", 1);
say_stop("so that the guard will let me see the king.", 1);
&events = 4;
&exp += 200;
say("`%200 EXP GAINED", 1);
screenlock(0);
unfreeze(1);
}
else
{
playmidi("4.mid");
goto mainloop;
}
}

void attack( void )
{
  playsound(8, 8000, 0, 0, 0);
&mcounter = random(4000,0);
sp_attack_wait(&current_sprite, &mcounter);
  goto loop;
}
October 6th 2011, 12:42 PM
peasantmg.gif
raven
Peasant He/Him Sweden
 
You need to add some lines in the dink.ini file otherwise it will not work.

set_frame_special x y z

I think it is
October 6th 2011, 12:43 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Sounds like you didn't specify an attack frame in the Dink.ini file

EDIT: I was beaten to it
October 6th 2011, 12:45 PM
peasantmg.gif
raven
Peasant He/Him Sweden
 
Haha
October 6th 2011, 12:45 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
I've added all the lines that needed in dink.ini. Well, all that I can think of that are needed. It would help me if you told me what exact lines were you thinking of.
October 6th 2011, 12:47 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
set_frame_special 542 5 1
set_frame_special 544 5 1
set_frame_special 546 5 1
set_frame_special 548 5 1


These are the lines for the bonca attack frames. They specify that frame 5 is the frame that deals damage.
October 6th 2011, 12:51 PM
peasantmg.gif
raven
Peasant He/Him Sweden
 
Another strange thing is that:

goto mainloop;

and there is no label mainloop, but a oneloop label.
October 6th 2011, 12:58 PM
milder.gif
duckhater
Peasant He/Him India
From The Depths Of Tartarus Itself 
I wish I could've helped
October 6th 2011, 01:10 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
One more thing. You have a loop in your main procedure with a wait in it, which will be terminated once the sprite is hit by Dink. To circumvent this, use the code inside another script and reference it with external().
October 6th 2011, 01:14 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Great, it works now. Thanks guys.

Kyle, that was part of the script that I borrowed from CC2, so I didn't bother to change it. Plus, it works perectly, so I'm not gonna screw with the script any more cause, quite frankly, I had helluva lot of problems with it.
October 6th 2011, 01:18 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Is this sprite supposed to shoot stuff? Try hitting the sprite and see if it stops shooting.
October 6th 2011, 01:56 PM
spike.gif
The last part in void hit() should probably be goto loop, instead of goto mainloop... The dude will indeed stop shooting as soon as Dink hits him otherwise. (However, he starts shooting again after void attack() runs, because that procedure correctly has it as goto loop. )
October 6th 2011, 02:10 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Yeah, now that you mentioned it, I can see it too. However, I think it balances it nicely, cause now he can't shoot fireballs as much which makes it seem like his magic has to load too, just like the player's.