Game Mechanics Splitting Stacks of Items

Ragster

Member
I'm curious if anyone knows or has seen efficient ways of splitting stacks of items in inventories. I'm trying to think of the most useful way of doing it in my game, while keeping it from being too complicated.
 

TailBit

Member
One loop to see if there are existing stacks of the item, if so then fill them up and subtract that from the amout

If there are still items left to add, then search for empty slots to fill up til you have spent the remaining amount

If there are still some left then return it so you can fetch it from your item_add code and adjust the value on the floor/container
EDIT: missread the question
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
I think the Terraria / Starbound way is the most intuitive... right-click an item stack to grab 1 (normal clicks grab the entire stack), shift-RMB to grab half. If you already hold items of this type, whatever you grab from the stack stacks with what you're holding, so you can just hold down RMB to grab a bunch and then release it when you have enough (e.g. for doing a particular build task), or you can do a single shift-RMB grab to get half when sharing something equally with a co-op friend.

(It should be pretty easy to code this as well since the cases are all fairly straightforward)
 

NightFrost

Member
An MMO I play lets you shift-drag a stack, and when you release it pops up an interface. You can either write the split amount there, use +/- buttons to adjust it, or press quick split buttons for one item or half the stack.
 
Top