• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Stacking problem

Aeronx

Intermediate OT User
Joined
Dec 17, 2015
Messages
746
Solutions
9
Reaction score
125
Hello everybody!

I've been searching, testing and trying to do magic to solve this, but i dont find an answer.

I have this script:

Code:
function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    if not creature then
        return true
    end
    if not creature:getType():getLoot() then
        return true
    end
    local tc = 0
    for i, k in pairs(creature:getType():getLoot()) do  
        tc = tc + k.chance
    end
    local BONUS_RATE = 2 -- 1 normal loot, 2 double loot etc
    for i = 1, BONUS_RATE do
        for i, k in pairs(creature:getType():getLoot()) do
            if math.random(100) < killer:getStorageValue(88893) then
                local item = corpse:addItem(k.itemId,math.random(k.maxCount) or k.subType)
                if item then
                    if k.actionId and k.actionId ~= -1 then item:setActionId(k.actionId) end
                    if k.text then item:setAttribute(ITEM_ATTRIBUTE_TEXT, k.text) end
                end
            end
        end
    end
    return true
end

Which works and all BUT the items like gold coins, platinum coints, etc, they dont stack. No action id, nothing different so far, but they dont stack.
vNZQErd.gif

I've checked github since there are "stack" fixes for sources there, but my sources have it implemented already, so i dont really know whats going on here.

Any idea?

Thank you for your time!
 
when i look at them they dont have different text/aid.
Ill try to print aid and text from all items just in case.

Edit:
Removing this lines:
Code:
if item then
   if k.actionId and k.actionId ~= -1 then item:setActionId(k.actionId) end
   if k.text then item:setAttribute(ITEM_ATTRIBUTE_TEXT, k.text) end
end

Solves the stacking problem.
 
Back
Top