Adding items help
Hey guys can any1 tel me how i can create a new usable item, a pumpkin 4 example, and make it disappear from the screen and appear in dink's item menu and let dink say smthng like i picked up a pumpkin? Also can u tel me how i can use this item? I mean what is the code in C 4 all the previous?
Use a script like this: (It's a bit basic, you can add all the fancy stuff you like to it.)
void main(void)
{
sp_touch_damage(¤t_sprite,-1);
}
void touch(void)
{
add_item("<script>",seq,frame);
say("Hey! I picked up a pumkin!",1);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
}
In this script the seq and frame are the sequence and the frame of the sprite you whish to see in the inventory. (For example 438,7 for a sword) <script> is the name of the script of the pumpkin.
And how do you mean use it? What's it supposed to do?
void main(void)
{
sp_touch_damage(¤t_sprite,-1);
}
void touch(void)
{
add_item("<script>",seq,frame);
say("Hey! I picked up a pumkin!",1);
int &hold = sp_editor_num(¤t_sprite);
if (&hold != 0)
editor_type(&hold, 1);
}
In this script the seq and frame are the sequence and the frame of the sprite you whish to see in the inventory. (For example 438,7 for a sword) <script> is the name of the script of the pumpkin.
And how do you mean use it? What's it supposed to do?
Take a look in the DinkC Reference (find it in the develop folder) under Techniques > Items.
Thanks a lot but what do u mean by the script of the pumpkin? What's that file supposed 2 contain? By using the pumpkin i mean selecting it from the item menu and pressing ctrl just as we equip the fists and use them
July 7th 2008, 06:02 AM

Robj
"what do u mean by the script of the pumpkin? What's that file supposed 2 contain?"
If your talking about the script in the add_item command, that is the script that is loaded and executed. Example, the script you want to run is names item-pk.c, the add_item command would be - add_item("Item-pk", seq, frame);
and your item-pk.c would be something similar to this(with whatever you want added or changed, of course):
-----------------------------------------------
//item-pk.c
void use(void)
{
//This is what happens when the player uses the item
say("I have a pumpkin..
but I wanted cake. ", 1);
}
void disarm(void)
{
kill_this_task();
}
void arm(void)
{
//Load the normal dink walk sequence
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");
}
void pickup(void)
{
kill_this_task();
}
void drop(void)
{
draw_status();
kill_this_task();
}
---------------------------------------------
Sorry if this is unclear, I suck at explaining things.
If your talking about the script in the add_item command, that is the script that is loaded and executed. Example, the script you want to run is names item-pk.c, the add_item command would be - add_item("Item-pk", seq, frame);
and your item-pk.c would be something similar to this(with whatever you want added or changed, of course):
-----------------------------------------------
//item-pk.c
void use(void)
{
//This is what happens when the player uses the item
say("I have a pumpkin..
}
void disarm(void)
{
kill_this_task();
}
void arm(void)
{
//Load the normal dink walk sequence
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");
}
void pickup(void)
{
kill_this_task();
}
void drop(void)
{
draw_status();
kill_this_task();
}
---------------------------------------------
Sorry if this is unclear, I suck at explaining things.
Stupid password field... can't modify my post now.
where I said: "Example, the script you want to run is names item-pk.c"
I meant 'named' not 'names'.
Also when I said cake I meant chocolate cake
where I said: "Example, the script you want to run is names item-pk.c"
I meant 'named' not 'names'.
Also when I said cake I meant chocolate cake
Thanks a lot 4 ur help. I'm having another problem now with my windinkedit or so i believe. the sprites that i add, say an enemy knight that is supposed to say something, screenlock, and start attacking me only plays the walking sequence and stays in his place! this goes for any other sprite i try to put, they look like they're walking but they're not moving from their place. do u know what seems to be the problem?
Did you unfreeze them after they speak?











