The Dink Network

Reply to 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 6th 2006, 11:27 AM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
I'm working on scripts to summon a monster and have run into some complications, when you switch screens, he (the summoned creature) isn't created anew. Here is the script, I dunno what's wrong with it...

//create summon and screen follow and crap

void main( void )
{
//for explosion
int &explo;
//for summon
int &beast;
//to figure out if we need to creaet 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
&beast = create_sprite(&mholdx, &mholdy, 9, 823, 1);
//give him his script
sp_script(&beast, "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
loop:

//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
int &beast = create_sprite(&mholdx, mholdy, 9, 823, 1);
sp_script(&beast, "summoned");
}

}
//whether Dink changed screens or not...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
goto loop;
}