new item type

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 7 months ago #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
2 years 7 months ago #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.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 7 months ago - 2 years 7 months ago #5729 by JTP
Replied by JTP on topic new item type
/* 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: 2 years 7 months ago by JTP.

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

More
2 years 7 months ago #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:
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: 1.108 seconds