Jump to content
1 vote
Guests cannot vote

Suggestion - a Lua helper to grant stackable items into the player's bundle

  • Views: 46
  • Submitted:

It would be great to have a clean LuaAPI way to give a stackable item and have it merge into the player's existing stack instead of creating separate items.

Right now, when granting jewels (which are Overlap="50" in ItemList.xml), Inventory.Insert delivers each one as its own 1-count item rather than stacking them into a bundle, and the OVERLAPITEM_INVENTORY_INSERT create path doesn't seem to insert from Lua. So there's no straightforward way to add, say, 5 Jewels of Soul as one bundle of 5.

Idea: a helper like Inventory.AddItem(playerIdx, itemType, level, count) that respects the item's Overlap value — merging into an existing stack and spilling into a new one at the max. This would make jewel/currency rewards from custom Lua systems behave exactly like normal drops.

User Feedback

Recommended Comments

MrJunior

Posted

@Dima

I am confused about your suggestion, as I currently have several systems that handle the stacking of gems, as well as items that stack using durability in the standard way.

Dima

Posted

sorry for the confusing framing. I'm not saying stacking is impossible; I know jewels/gems stack via durability normally. My problem is specifically how to grant them from Lua so they merge into the existing bundle.

What I'm doing now: for each jewel I call Inventory.Insert(playerIdx, item) with a fresh ItemInfo where Type = the jewel and Durability = 1. Each call lands as its own separate 1-count item - they never merge into one bundle.

×
×
  • Create New...

Important Information


We use technologies, such as cookies, to customize content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy.