The Dink Network

Adding items help

July 5th 2008, 08:26 AM
maiden.gif
nawal
Peasant She/Her Egypt
 
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?
July 5th 2008, 08:51 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
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(&current_sprite,-1);
}
void touch(void)
{
add_item("<script>",seq,frame);
say("Hey! I picked up a pumkin!",1);
int &hold = sp_editor_num(&current_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?
July 5th 2008, 09:55 PM
dinkdead.gif
Take a look in the DinkC Reference (find it in the develop folder) under Techniques > Items.
July 7th 2008, 04:56 AM
maiden.gif
nawal
Peasant She/Her Egypt
 
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
anon.gif
Robj
Ghost They/Them
 
"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.
July 7th 2008, 06:06 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
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
July 11th 2008, 03:05 PM
maiden.gif
nawal
Peasant She/Her Egypt
 
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?
July 11th 2008, 11:50 PM
wizardb.gif
dinknround
Peasant He/Him United States
It looked good on paper... 
Did you unfreeze them after they speak?
July 12th 2008, 11:30 AM
maiden.gif
nawal
Peasant She/Her Egypt
 
yes i did thats y they're playing their base wlak sequence without moving from their places!!