📧 Message Board Archive

The official new items thread
For everyone who wants to create new items/weapons/magic...



Any item, weapon or magic runs of it's own script.



To give dink the item, put this type of line in some other script add_item("script name", sequence to choose the "inventory graphic" from, frame number of the "inventory graphic")  This will place the selected graphic of the item in your inventory along with attached script.



I honestly don't understand melee weapons scripting, but here is how magic works.



A spell item script might look like this:

void use( void )

{

int holder;//initialize holder



&magic_level = 0; //now you have to power up again

draw_status(); //since the last command changed what would

//be on the status bar, we have to update it.

//here is the meat of the spell, what it does

say("I am strong like bull", 1);//you'll see...

&strength += 500;//he really is strong like bull now.



&holder = 20

place:

if (&holder > 0)

{

wait(400);

&life +=5;

&holder -=1;

goto place;

}

/*this is similar to a "while" statement. basically it works like this.  As soon as the spell is cast, or close to it, &holder is set to 20. "place:" is the line we are sent to by "goto place" in in the if statement.  The if statement will heal dink 5 life, but it also waits .4 seconds to heal him, decreases holder by one, and loops back to before it was initialized.  This would cause an infinite loop but &holder gets smaller every time, and when it reaches zero it ceases to loop.*/

&strength -= 500;//the fun is over, dink is no

//longer strong like bull

}//end of use() function



void arm( void )

{

&magic_cost = 10000;//this sets how long the

//reload takes for the spell. fireball is 100

}



void disarm( void )

{

&magic_cost = 0//don't leave the giant reload

//time, set it to zero

}



/*You also need void pickup( void ) and void drop(void), but you can copy these from the fireball spell*/



More stuff later
Re: The official new items thread


A simpler spell item script might look like this:



void use( void )

//use defines what happens when you cast the spell

{



&magic_level = 0; //now you have to power up again



draw_status(); //since the last command changed what would

//be on the status bar, we have to update it.



//here is the meat of the spell, what it does



say("I am strong like bull", 1);//you'll see...



&strength += 500;//he really is strong like bull now.



wait(10000);// let them have ten seconds of super stregth

&strength -= 500;//the fun is over, dink is no

//longer strong like bull



}//end of use() function



void arm( void )

//arm sets what happens when you arm the spell

{

&magic_cost = 10000;//this sets how long the

//reload takes for the spell. fireball is 100

}



void disarm( void )



{

&magic_cost = 0//don't leave the giant reload

//time, set it to zero

}



: /*You also need void pickup( void ) and void drop(void), but you can copy these from the fireball spell*/



A standard bow item would be this:

void use( void )

{

       activate_bow();//neccessary scripting stuff

       &mypower = get_last_bow_power();//tells how long you

//drew back the bow



        &mholdx = sp_x(1, -1);//these variables store dink's

        &mholdy = sp_y(1, -1);//position so that the arrow

        &mydir = sp_dir(1, -1);//initializes at the correct place



if (&mypower < 100)

{

return;//if you haven't pulled back the bow enough

//I think this keeps you from shooting

}



/*this next part is the important one it creates the arrows.  create_sprite(&mholdx, &mholdy, 11, 25, 6) creates a sprite and gives it's number, the &mholdx and &mholdy give the new sprite it's position, the 11 sets it's brain to brain 11(missile).  The 25, 6 part would set it's sequence to 25 which contains the current arrow sprites and it's frame to 6.  The frame is the same as dink's direction because arrows aren't animated and they can squeeze all eight possible directions into one sequence.  Unless you're planning on using custom arrow sprites, you might as well just leave the next section alone*/

 if (&mydir == 6)

 {

 &mholdx += 30;

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 6);

//844 is my custom ice arrows sequence

 sp_dir(&junk, 6);

 }



 if (&mydir == 4)

 {

 &mholdx -= 30;

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 4);

 sp_dir(&junk, 4);

 }



 if (&mydir == 2)

 {

 &mholdy += 50;

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 2);

 sp_dir(&junk, 2);

 }



 if (&mydir == 8)

 {

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 8);

 sp_dir(&junk, 8);

 }



 if (&mydir == 9)

 {

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 5);

 sp_dir(&junk, 9);

 }

 if (&mydir == 1)

 {

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 1);

 sp_dir(&junk, 1);

 }

 if (&mydir == 7)

 {

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 7);

 sp_dir(&junk, 7);

 }



 if (&mydir == 3)

 {

 &junk = create_sprite(&mholdx, &mholdy, 11, 844, 3);

 sp_dir(&junk, 3);

 }



 &mypower / 100; //this part determines

//the pullback component of the arrows power...

//I think

 &temp = &strength;

 &temp / 5;





 if (&temp == 0)

   {

    &temp = 1;

   }

 &mypower * &temp;//puts the strength component into

// the arrows power

 sp_timing(&junk, 0);//I think this has something

//to do with keeping the arrows from being

//amimated, but I'm not sure



 if (&bowlore == 1)

{

 &temp = random(1, 1);



    //critical hit

 &mypower * 3;

// playsound(44, 14050,0,0,0);

}

playsound(17, 8000,0,0,0);



 sp_speed(&junk, 8);//sets the arrows speed

 

 sp_strength(&junk, &mypower);//sets the arrows power

 sp_range(&junk, 10);

 /*this makes it easier to hit stuff, if it were 20, the arrow would hit a bigger radius, 600 and it would hit everything on the screen.*/

 sp_flying(&junk, 1);//lets the arrow fly

 sp_script(&junk, "dam-ax");//sets the arrow script. "dam-a1" is a standard arrow

//if you want the arrow to do anything on impact

//or in flight, modify the script "dam-a1" or create

//your own like me.

&mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);//shadow created



 sp_brain_parm(&mshadow, &junk);//sets shadow to follow arrow

 sp_que(&mshadow, -500);//sets shadow hard box below arrow...

//I think

 sp_brain_parm(&junk, 1);//keeps arrow from hurting dink

 sp_brain_parm2(&junk, &mshadow);//keeps arrow from hitting shadow

 sp_nohit(&mshadow, 1);





return;

}



void disarm(void)

{

&strength -= 25;



kill_this_task();

}



void arm(void)

{

&strength += 25;

int &junk;

int &mydir;

int &mholdx;

int &mholdy;

int &mshadow;

int &mypower;

int &temp;

//preload bowsprites

init("load_sequence_now graphics\dink\bow\walk\d-bw1- 71 43 30 84 -14 -10 14 10");

init("load_sequence_now graphics\dink\bow\walk\d-bw2- 72 43 29 86 -21 -10 19 10");

init("load_sequence_now graphics\dink\bow\walk\d-bw3- 73 43 35 79 -13 -9 13 9");

init("load_sequence_now graphics\dink\bow\walk\d-bw4- 74 43 41 79 -18 -12 20 12");



init("load_sequence_now graphics\dink\bow\walk\d-bw6- 76 43 47 78 -23 -10 23 10");

init("load_sequence_now graphics\dink\bow\walk\d-bw7- 77 43 46 71 -20 -10 20 10");

init("load_sequence_now graphics\dink\bow\walk\d-bw8- 78 43 35 76 -15 -12 15 12");

init("load_sequence_now graphics\dink\bow\walk\d-bw9- 79 43 46 78 -13 -9 13 9");



init("load_sequence_now graphics\dink\bow\idle\d-bi2- 12 250 35 87 -17 -12 16 9");

init("load_sequence_now graphics\dink\bow\idle\d-bi4- 14 250 37 77 -11 -12 16 10");

init("load_sequence_now graphics\dink\bow\idle\d-bi6- 16 250 35 83 -15 -9 11 9");

init("load_sequence_now graphics\dink\bow\idle\d-bi8- 18 250 33 70 -15 -12 15 9");



init("load_sequence_now graphics\dink\bow\hit\d-ba2- 102 75 27 89 -23 -12 24 11");

init("load_sequence_now graphics\dink\bow\hit\d-ba4- 104 75 76 79 -23 -13 23 14");

init("load_sequence_now graphics\dink\bow\hit\d-ba6- 106 75 37 81 -14 -10 14 10");

init("load_sequence_now graphics\dink\bow\hit\d-ba8- 108 75 31 89 -17 -16 17 10");



//bow weapon diags



init("load_sequence_now graphics\dink\bow\hit\d-ba1- 101 75 57 84 -20 -12 20 12");

init("load_sequence_now graphics\dink\bow\hit\d-ba3- 103 75 33 86 -19 -13 19 13");

init("load_sequence_now graphics\dink\bow\hit\d-ba7- 107 75 54 82 -19 -11 19 11");

init("load_sequence_now graphics\dink\bow\hit\d-ba9- 109 75 37 78 -21 -10 21 10");

preload_seq(25);

}



void pickup(void)

{

Debug("Player now owns this item.");

kill_this_task();

}



void drop(void)

{

Debug("Item dropped.");

kill_this_task();

}



I'll describe the "dam-a1" script later.
Re: The official new items thread
LOL, How does one disable smiles, I also made an error in my first spell...



Here is "dam-a1"

//script for individual arrow

void main( void )

{

       int &mcrap;

       int &scrap;



}



void damage( void )

{

   int &hold = sp_editor_num(&missile_target);

//put any FX you want HERE

//To create an explosion, you can steal some code

//from "item-fb.c"...

if (&missile_target == 0)

 {

    sp_speed(&current_sprite, 0);

    sp_brain(&current_sprite, 0);

   sp_nohit(&current_sprite, 1);

   playsound(41, 22050,0,0,0);

//    sp_script(&current_sprite, "");

   kill_this_task();

 }



 if (&hold != 0)

   {

     &scrap = sp_brain(&missile_target, -1);

     if (&scrap != 0)

     {

  //looks like we should not make the arrow stick

   kill_shadow(&current_sprite);

   sp_active(&current_sprite, 0);

   playsound(41, 22050,0,0,0);

    return;

     }

    sp_speed(&current_sprite, 0);

    sp_brain(&current_sprite, 0);

   playsound(41, 22050,0,0,0);

 //  sp_script(&current_sprite, "");

   return;

   }

   kill_shadow(&current_sprite);

  sp_active(&current_sprite, 0);

   playsound(41, 22050,0,0,0);

 //  sp_script(&current_sprite, "");



   kill_this_task();



 



}



  void hit( void )

  {

  playsound(37, 28050, 0,0,0);

  sp_active(&current_sprite, 0);

   sp_nohit(&current_sprite, 1);

  }