The Dink Network

Reply to Re: inventory items

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:
 
 
April 14th 2012, 11:23 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
Well, to add the item to his inventory, you use:

add_item("scriptname",sequence, frame);


For example, if you wanted to give Dink a sword, you would use:

add_item("item-sw1", 438, 7);


All that does is add the item. To make the item do things, you would need to edit its script. Say the item script for your scroll is called "item-scroll.c", this is what it could look like.

void use(void)
{
//This is what happens when you press 'Ctrl' when the item is equipped. If you used it, Dink would say "I'm using a scroll!"
say("I'm using a scroll!",1);
}

void arm(void)
{
//This is what happens when you select the item in your inventory. If you equipped it, Dink would say "I'm now equipping the scroll!"
say("I'm now equipping the scroll!",1);
}

void disarm(void)
{
//Same as arm(), but it's when the item is unequipped. Dink would say "I'm putting the scroll away!"
say("I'm putting the scroll away!",1);
}



Those are the main functions. The rest are:
pickup - When the item is added to Dink's inventory
drop - When the item is removed from Dink's inventory.
holdingdrop - When the item is removed from the player's inventory while it is armed.

So yeah, that's pretty much it. The graphic slots for the default magic and weapons are 437 and 438, respectively. Scroll graphics can be found in sequence 438, frames 14, 15, 16, and 17. Once again, if you named your scroll's script "item-scroll", the line to add it would look like:
add_item("item-scroll",438,14);


Hope that helps!