0
Answered

Durability of items

markusrgb 6 months ago in Inventory updated by Timothee Dumarais 5 months ago 6

Hello everyone, 


it is possible to give an item (for example an "axe") a durability.

I want it to be usable only 100 times and then break.

I also want to be able to repair it with a grindstone to set the durability back to 100.

Since it is not possible to create multiple slots in the inventory for the same item, I want to make sure that the item with the worst condition is always used first.

I've thought about working with list variables (but I'm not sure if this works)

If the player then puts 2 of 10 axes into a container, the worst one should always be moved first. (The container would have to store this information - if an axe is taken from there, this should be the worst of the 2 axes)

Unfortunately, I have not yet found a practicable solution for this.

Does anyone happen to have an idea how I could implement this?

Thank you.

:)

Unity version:
2019.2.18f1
Game Creator version:
1.1.3

Answer

Answer
Answered

Unfortunately this is not possible due to the code architecture of the inventory system. When saving one or more items, we store the ID of the item and the amount of items. Items can't have individual properties that are not shared across the same items.

However, I'm taking note of this and I'll add this to the features to have for a major iteration of the Inventory module.

Answer
Answered

Unfortunately this is not possible due to the code architecture of the inventory system. When saving one or more items, we store the ID of the item and the amount of items. Items can't have individual properties that are not shared across the same items.

However, I'm taking note of this and I'll add this to the features to have for a major iteration of the Inventory module.

ok, thanks for the answer.

then i hope there's an improved version soon.

;)

+1

It is possible to create a durability, but you must use the stats (addon) and assign a durability stat to the items when they are equipped only. I managed to do it using gamecreator, without creating any script. You can see a weapon equipped with its durability at the top right.

+1

Great idea! The only issue is that the durability is shared between multiple instances of the same item. For example, if you have 2 Steel Swords, both will share the same durability. If you plan on just allowing to have one of each weapon, then you'll be fine.

Thanks for sharing this Tim!

It's exactly sa.mais but it is not annoying because we can not hold 2 sword in one hand, we can create a different stats for each hand. Your system is well designed, thinking a little have come to casiment everything make . But it is true that for a person who has little experience in scripting this can be a real headache. In any case, good work once again.