The Dink Network

Reply to Problems with two scripts

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
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.