Welcome to the Builder Academy

Question new item type

More
04 Apr 2016 20:21 #5727 by JTP
new item type was created by JTP
Hi

What files is needed to edit to add a new item_type ?

Please Log in or Create an account to join the conversation.

More
05 Apr 2016 20:05 #5728 by thomas
Replied by thomas on topic new item type
structs.h : github.com/tbamud/tbamud/blob/master/src/structs.h#L396 Remember to up the NUM_ITEM_TYPES as well.

constants.c : github.com/tbamud/tbamud/blob/master/src/constants.c#L381 Add the name where it matches the number from structs. Probably right before the "\n".

I think that's it. Making the new item DO anything, though, is slightly more complicated. I'll leave that as an exercise to the reader.

Out of curiosity - what is the item type are you adding?

Please Log in or Create an account to join the conversation.

More
07 Apr 2016 13:34 - 07 Apr 2016 13:35 #5729 by JTP
Replied by JTP on topic new item type
Code:
/* object-related defines */ /* Item types: used by obj_data.obj_flags.type_flag */ #define ITEM_LIGHT 1 /**< Item is a light source */ #define ITEM_SCROLL 2 /**< Item is a scroll */ #define ITEM_WAND 3 /**< Item is a wand */ #define ITEM_STAFF 4 /**< Item is a staff */ #define ITEM_WEAPON 5 /**< Item is a weapon */ #define ITEM_FURNITURE 6 /**< Sittable Furniture */ #define ITEM_FREE 7 /**< Unimplemented */ #define ITEM_TREASURE 8 /**< Item is a treasure, not gold */ #define ITEM_ARMOR 9 /**< Item is armor */ #define ITEM_POTION 10 /**< Item is a potion */ #define ITEM_WORN 11 /**< Unimplemented */ #define ITEM_OTHER 12 /**< Misc object */ #define ITEM_TRASH 13 /**< Trash - shopkeepers won't buy */ #define ITEM_FREE2 14 /**< Unimplemented */ #define ITEM_CONTAINER 15 /**< Item is a container */ #define ITEM_NOTE 16 /**< Item is note */ #define ITEM_DRINKCON 17 /**< Item is a drink container */ #define ITEM_KEY 18 /**< Item is a key */ #define ITEM_FOOD 19 /**< Item is food */ #define ITEM_MONEY 20 /**< Item is money (gold) */ #define ITEM_PEN 21 /**< Item is a pen */ #define ITEM_BOAT 22 /**< Item is a boat */ #define ITEM_FOUNTAIN 23 /**< Item is a fountain */ /** Total number of item types.*/ #define NUM_ITEM_TYPES 24

How can it be 24, when the first one is 1 and last is 23 ?
Last edit: 07 Apr 2016 13:35 by JTP.

Please Log in or Create an account to join the conversation.

More
08 Apr 2016 20:10 #5733 by thomas
Replied by thomas on topic new item type
It must just be "one higher than the highest" - the code is riddled with loops like this:
Code:
for (i = 0; i < NUM_ITEM_TYPES; i++)
You could also just repurpose #7 or #14 - no objects are using those atm.

Please Log in or Create an account to join the conversation.

Time to create page: 0.178 seconds