The Dink Network

Reply to Re: Summoning

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:
 
 
March 7th 2006, 04:27 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Experience bug now fixed. I defining the variable after the thing died, that caused the problem. One more...turns out I'm not done with the other script. When you change screens, the summon is created again...in the corner...here's the script:

//create summon and screen follow and crap

void main( void )
{
//for explosion
int &explo;
//to figure out if we need to create him on the new screen
int &mapnum;
//for 'x' coordinate so we can create summon at Dink's spot
int &mholdx;
//for 'y' coordinate so we can create summon at Dink's spot
int &mholdy;

//get dink's coordinates
&mholdx = sp_x(1, -1);
&mholdy = sp_y(1, -1);

//create explosion - set all of this crap so it'll play right (stolen from 'dam-sfb')
//used for effects, so he doesn't just appear from nowhere
&explo = create_sprite(&mholdx , &mholdy, 0 , 167, 1);
sp_seq(&explo, 167);
sp_pseq(&explo, 167);
sp_frame(&explo, 1);
sp_brain(&explo, 7);
sp_nohit(&explo, 1);

//create our summon
&summon = create_sprite(&mholdx, &mholdy, 9, 823, 1);
//give him his script
sp_script(&summon, "summoned");

//he is created on the same screen as dink
&mapnum = &player_map;

//so script will stay active beyond screen transition
script_attach(1000);

//set up a loop so it'll keep checking
loopy:
wait(25);

//if dink changed screens, we need to create summon anew
if (&mapnum != &player_map)
{
//is summon alive?
if (&summon >= 1)
{
//make him again and give him his script
wait(200);
//get Dink's new coordinates
&mholdx = sp_x(1, -1);
&mholdy = sp_y(1, -1);
&summon = create_sprite(&mholdx, mholdy, 9, 823, 1);
sp_script(&summon, "summoned");
//change his map to Dink's
&mapnum = &player_map;
}

}
//whether Dink changed screens or not...if he's dead, kill the script
if (&summon == 0)
{
kill_this_task();
}

//go to the begining of loop to keep checking infinitely,
//until he's dead at least
wait(1);

goto loopy;
}