• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling Game.createItem using 100+ as count

Lundrial

lundrial:getTitle()
Joined
Apr 15, 2014
Messages
142
Reaction score
104
Location
Chile
Well this have been discussed here
I'm trying to make it add another stack of items if count exceeds 100, or item is not stackable, it is possible since the player:addItem(item, count) works this way just fine:

if you use for example:

Code:
player:addItem(2160, 500)
It will add 5 stacks of 100 crystal coins or if you use a sword:

Code:
player:addItem(2376, 8)
it will add 8 swords.

but for some reason, when adding items to any container or using Game.createItem(item, count) won't add more than the stack limit, or it will add just 1 item if the item is non stackable.

after putting some thought into it, it might work only with players since if it adds another stack to the player and he doesn't have space for it, it will drop it on the ground but it's not doing the same thing for containers, if it could check if the container has sufficient slots to hold all the stacks/number of items used in count it should be capable to add the items correctly

it would be really cool if someone could help me with this since this is keeping me from releasing some buggy stuff
 
Last edited:
yeah, that actually sounds better, I'd prefer to leave the default functions how they're, im gonna try but I kinda suck at this, thanks for the idea :>
You actually do any harm if you replace it, you simply fix the issue.
(even thought i created function createItem(itemID, pos, amount) instead of replacing it, because I use creating function in addEvents quite frequently)

Edit: ah I understood the first post wrong anyway, thought Game.createItem() was issue

for containers I suggest to make new function, because It just more complicated to add item to container without the metamethod addItem()

for example do function like this: addItemToContainer(container, itemID, amount)
then inside function you can use: container:addItem(itemID, amount)
 
Last edited:
Back
Top