The Dink Network

Reply to Re: projectile script

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:
 
 
November 5th 2005, 09:31 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Hey, I looked into it, and I just took the flying axe script and modified it. I was suprised how easy it actually is (and how much bugs it gave when I just started it...)

This is the item's script:

void use(void)
{
if (&oldmap != &player_map)
{
&oldmap = &player_map;
goto continue; //This is to make sure Dink can throw his nina star when he enters a screen.
}
if (sp_active(&missl,-1) == 1)
{
int &vari = sp_brain(&missl,-1);
if (&vari != 15)
{
goto end; //If the nina star is still in mid-air ctrl shouldn't do anything...
}
sp_speed(&missl,0);
int &temp = sp_brain_parm(&missl,-1);
sp_brain(&missl,7);
sp_seq(&missl,167);
playsound(6,22050,0,0,0);
sp_hurt(&temp,&strength); //This is the amount of damage done to the enemy, there are other ways to determine the amount of damage too...
goto end;
//The previous part is to blow up the star when ctrl is pressed and the nina star is stuck into a monster.
}
continue:
//Here starts the standard axe throwing procedure: (With 88 being the sequence)
&mydir = sp_dir(1, -1);

if (sp_dir(1, -1) == 1)
sp_dir(1, 4);
if (sp_dir(1, -1) == 3)
sp_dir(1, 6);
if (sp_dir(1, -1) == 7)
sp_dir(1, 4);
if (sp_dir(1, -1) == 9)
sp_dir(1, 6);

playsound(8, 8000,0,0,0);

&basehit = sp_dir(1, -1);
&basehit += 320;

sp_seq(1, &basehit);
sp_frame(1, 1);
sp_kill_wait(1);
sp_nocontrol(1, 1);
&mholdx = sp_x(1, -1);
&mholdy = sp_y(1, -1);
freeze(1);

wait(100);

if (&mydir == 1)
{
&mholdx -= 30;
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_mx(&missl, -6);
sp_my(&missl, +2);
}
if (&mydir == 4)
{
&mholdx -= 30;
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_dir(&missl, 4);
}
if (&mydir == 6)
{
&mholdx += 30;
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_dir(&missl, 6);
}
if (&mydir == 3)
{
&mholdx += 30;
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_mx(&missl, +6);
sp_my(&missl, +2);
}
if (&mydir == 2)
{
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_dir(&missl, 2);
}
if (&mydir == 7)
{
&mholdx -= 30;
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_mx(&missl, -6);
sp_my(&missl, -2);
}
if (&mydir == 8)
{
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_dir(&missl, 8);
}
if (&mydir == 9)
{
&mholdx += 30;
&missl = create_sprite(&mholdx, &mholdy, 11, 88, 1);
sp_seq(&missl, 88);
sp_mx(&missl, +6);
sp_my(&missl, -2);
}

sp_timing(&missl, 0);
sp_speed(&missl, 6);

sp_range(&missl, 10);
sp_flying(&missl, 1);
sp_attack_hit_sound(&missl, 48);
sp_attack_hit_sound_speed(&missl, 13000);
&mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
sp_brain_parm(&mshadow,&missl);
sp_que(&mshadow, -500);

sp_brain_parm(&missl, 1);
sp_brain_parm2(&missl, &mshadow);

//I gave the missile a script called "ninastar":
sp_script(&missl,"ninastar");
unfreeze(1);
end:
}
void disarm(void)
{
&hashoot = 0;
debug("nina star no longer armed");
kill_this_task();
}
void arm(void)
{
init("load_sequence_now graphics\dink\walk\ds-w1- 71 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w2- 72 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w3- 73 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w4- 74 43 38 72 -12 -9 12 9");

init("load_sequence_now graphics\dink\walk\ds-w6- 76 43 38 72 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w7- 77 43 38 72 -12 -10 12 10");
init("load_sequence_now graphics\dink\walk\ds-w8- 78 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w9- 79 43 38 72 -14 -9 14 9");

init("load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9");
init("load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9");

init("load_sequence_now graphics\dink\hit\normal\ds-h2- 102 75 60 72 -19 -9 19 9");
init("load_sequence_now graphics\dink\hit\normal\ds-h4- 104 75 61 73 -19 -10 19 10");
init("load_sequence_now graphics\dink\hit\normal\ds-h6- 106 75 58 71 -18 -10 18 10");
init("load_sequence_now graphics\dink\hit\normal\ds-h8- 108 75 61 71 -19 -10 19 10");
debug("nina star armed");
//The variables needed in the script (No globals necessary )
int &missl
int &basehit;
int &status = 0;
int &oldmap = &player_map;
int &mholdx;
int &mholdy;
int &mydir;
int &mshadow;
}
void pickup(void)
{
debug("nina star now owned by player");
kill_this_task();
}
void drop(void)
{
debug("nina star dropped");
kill_this_task();
}

Then the script ninastar is:

void damage(void)
{
sp_brain(¤t_sprite,15);
sp_brain_parm(¤t_sprite,&missile_target);
}

I really wonder why I put my time into this, but this is the script. (not neccessarily bug-free)