Deduct the item(s) from the user’s inventory and run the consume reward for each one, if defined.
Items can be consumed by using their:
Item ID, so that any instance of the item will be consumed.
Instance ID, so that a specific instance of the item will be consumed.
For example, if the player has 2 potions in the inventory, one with instance ID x and one with yif they consume items potion: 1 either x or y might be consumed,
if they consume x: 1 and that will specifically consume x and not touch y.
You can put nil on which parameter you don’t wanna use.
Set a custom reward function which will run after an inventory item’s consume reward is rolled.
1
2
3
4
5
6
systems.GetInventorySystem().SetOnConsumeReward(OnConsumeReward)funcOnConsumeReward(ctxcontext.Context,loggerruntime.Logger,nkruntime.NakamaModule,userID,sourceIDstring,source*hiro.InventoryConfigItem,rewardConfig*hiro.EconomyConfigReward,reward*hiro.Reward)(*hiro.Reward,error){// Modify reward or take additional actions.
returnreward,nil}