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
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