The Dink Network

Problems with two scripts

February 16th 2012, 03:29 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
I've been struggling with these two scripts for a while now, and I just can't seem to get to my head what is wrong with them, I've tried everything. The problems are probably very simple, which I've just fail to notice.

In this first script, when &story is over 31, I go and talk to the character. It works fine, but after the conversation the script either jumps into the part after result 2, or the part which I've marked. Here's the script:

void talk(void)
{
if (&story > 31)
{
//dialog
}
if (&story < 31)
{
//dialog plus options
	}
	if (&result == 1)
	{
         //dialog
	}
	if (&result == 2)
	{
         //dialog, this is where it sometimes jumps
	}
        //dialog, sometimes it jumps here
}


The other problem I have is with a knight enemy script. I've tried everything, but always when the knight dies, instead of showing the death graphic, the sprite just disappears. Here's the whole script:

void main( void )
{
screenlock(1);
int &mcounter;
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 4);
sp_exp(&current_sprite, 0);
sp_distance(&current_sprite, 50);
sp_range(&current_sprite, 35);
sp_defense(&current_sprite, 5);
sp_strength(&current_sprite, 17);
sp_touch_damage(&current_sprite, 15);
sp_hitpoints(&current_sprite, 50);
sp_target(&current_sprite, 1);
sp_base_death(&current_sprite, 295);
sp_base_attack(&current_sprite, 730);
sp_base_walk(&current_sprite, 280);
preload_seq(742);
preload_seq(744);
preload_seq(746);
preload_seq(748);
preload_seq(301);
preload_seq(303);
preload_seq(307);
preload_seq(309);
//preload_seq(349);

playmidi("40.mid");
}

void hit( void )
{
//playsound(29, 22050,0,&current_sprite, 0);

sp_target(&current_sprite, 1);
}

void die( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 1); 

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);

       if (get_sprite_with_this_brain(9, &current_sprite) == 0)
 {
  //no more brain 9 monsters here, lets unlock the screen
  screenlock(0);
  
stopmidi("40.mid");
spawn("s4-afterto");
 }

void attack( void )
{
playsound(8, 5050,0,&current_sprite, 0);
&mcounter = random(4000,0);
sp_attack_wait(&current_sprite, &mcounter);
}


Can anybody help me with these. I'm totally lost.
February 16th 2012, 04:13 PM
wizardg.gif
Paul
Peasant He/Him United States
 
In the first one, it looks like you may have a stray } after "dialog plus options".

In the second one, try removing the sp_base_death line. Sprites should automatically use base_walk+5 for a death graphic if no other is specified. Unfortunately the blue knight is missing a death graphic in some versions of Dink. It looks like you were trying to compensate for that, but a better way would be to add this your d-mods's dink.ini file:
load_sequence graphics\people\knight\silver\death- 285 100 58 84 -27 -11 27 11
February 16th 2012, 04:20 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Thanks Paul. That fixed the first problem. Gonna try that knight thing tomorrow.