How do I program items?

Farcaster

New member
Where is the code for items to do things? For example, where is the code that tells the potion item to heal the player in the demo scene? Also, in the demo scene, what script is causing an equipped item to change the player stats?
 
In the demo scene the potion item heals the character using an item action. We use Item Actions for any action which can be done from the UI such as equip, drop, etc.
You can learn more about them here: https://opsive.com/support/documentation/ultimate-inventory-system/item-actions/
Make sure to check out the sub page with the built-in item actions, there are also video tutorials on the subject:

Changing stats is something specific to the demo scene since stats are not part of the inventory system. In most cases you will want stats to be affected by external things specific to your game, not just items.
That being said Equipper script comes with some handy function that will get you the sum of a specific attribute which you can use to compute stats for your character. You can learn more here:

I think those pages will also be of interest to you:
 
Top