• 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!

C++ Boss Reward System BlackTek-Server

Forkz

Advanced OT User
Joined
Jun 29, 2020
Messages
586
Solutions
17
Reaction score
159
1753592222779.webp1753592258767.webp


Made it with some tweaks, on TFS 1.4.2 Hard asf Bcuz not clean source!, Thx alot for the Commit! Works perfect with Lua monsters/xml monsters if u have both styles :)
 
Last edited:
I got a weird bug using it whenever the loot has stackable items those items cant be stacked again with another items having same id

for example the looted crystal coins cant be stacked with another crystal coins.
has any one faced this problem?
 
Last edited:
I got a weird but using it whenever the loot has stackable items those items cant be stacked again with another items having same id

for example the looted crystal coins cant be stacked with another crystal coins.
has any one faced this problem?
had this issue for a moment, but it was gone after a while? :O u did on a clean source?
 
I got a weird but using it whenever the loot has stackable items those items cant be stacked again with another items having same id

for example the looted crystal coins cant be stacked with another crystal coins.
has any one faced this problem?
This problem is due to the fact that there were custom attributes assigned to the items during their creation to be used for removing them after the 7 days was up... Stackables with custom attributes can't stack with other stackables, so if you want to resolve this problem, you sacrifice the "automatic deletion" for the stackables, but is worth IMO. You have to find the piece of code which assigns the items the date with a custom attribute and don't assign it if the item is a stackable, ez pz fix.
 
This problem is due to the fact that there were custom attributes assigned to the items during their creation to be used for removing them after the 7 days was up... Stackables with custom attributes can't stack with other stackables, so if you want to resolve this problem, you sacrifice the "automatic deletion" for the stackables, but is worth IMO. You have to find the piece of code which assigns the items the date with a custom attribute and don't assign it if the item is a stackable, ez pz fix.
I kinda like the 7 days item deletion so I made a simple item that when you use it on a bugged item or a container it fixes all the items
1753687634423.webp


LUA:
local FIX_ITEM_ID = 8919
local COOLDOWN_STORAGE = 50001
local COOLDOWN_SECONDS = 4

local fixTool = Action()

function fixTool.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target or not target:isItem() then
        player:sendCancelMessage("You must use this on an item or container.")
        return true
    end

    -- Cooldown check
    local lastUse = player:getStorageValue(COOLDOWN_STORAGE)
    local now = os.time()
    if lastUse ~= -1 and now - lastUse < COOLDOWN_SECONDS then
        local remaining = COOLDOWN_SECONDS - (now - lastUse)
        player:sendCancelMessage("You must wait " .. remaining .. " more seconds to use this again.")
        return true
    end
    player:setStorageValue(COOLDOWN_STORAGE, now)

    local fixedCount = 0

    if target:isContainer() then
        for i = 0, target:getSize() - 1 do
            local subItem = target:getItem(i)
            if subItem then
                subItem:removeAttribute(ITEM_ATTRIBUTE_DATE)
                subItem:removeAttribute(ITEM_ATTRIBUTE_REWARDID)
                subItem:removeAttribute(ITEM_ATTRIBUTE_OWNER)
                fixedCount = fixedCount + 1
            end
        end
    else
        target:removeAttribute(ITEM_ATTRIBUTE_DATE)
        target:removeAttribute(ITEM_ATTRIBUTE_REWARDID)
        target:removeAttribute(ITEM_ATTRIBUTE_OWNER)
        fixedCount = 1
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Fixed " .. fixedCount .. " item(s).")
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    return true
end

fixTool:id(FIX_ITEM_ID)
fixTool:register()
 
Could do the same with a lua movement script, if it's stackables coming from reward chest, clear the custom attribute :)

I like your solution though, show's dedication :)
so i thought about making it from events/scripts/players.lua from the function onMoveItem made it check the container of the reward bag and it removes any reward attribute from the item i dont know if it is the right thing to do or may do critical problems later but here it is

LUA:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromContainer, toContainer)

    -- Check if item is moved from container ID 21518
    if fromContainer and fromContainer:isContainer() then
        if fromContainer:getId() == 21518 then
            if item:isItem() then
                item:removeAttribute(ITEM_ATTRIBUTE_REWARDID)
                item:removeAttribute(ITEM_ATTRIBUTE_OWNER)
                item:removeAttribute(ITEM_ATTRIBUTE_DATE)
            end
        end
    end

    return true
end

edit-- it works nice for me
 
As blacked said the items has attributes and it should be removed.
uss my method up there the onmoveitem or the action script
I hadn’t noticed this bug before, but after seeing the report, I tested it using the reward container system and confirmed the issue: stackable items like coins weren’t stacking properly due to hidden attributes.

Personally, I prefer handling things directly in the C++ source rather than Lua whenever possible, so I went ahead and fixed it there.

If you’re interested, feel free to take a look at the commit I made with the fix.

 
Last edited:
I hadn’t noticed this bug before, but after seeing the report, I tested it using the reward container system and confirmed the issue: stackable items like coins weren’t stacking properly due to hidden attributes.

Personally, I prefer handling things directly in the C++ source rather than Lua whenever possible, so I went ahead and fixed it there.

If you’re interested, feel free to take a look at the commit I made with the fix.

nvm
 
Last edited:
I hadn’t noticed this bug before, but after seeing the report, I tested it using the reward container system and confirmed the issue: stackable items like coins weren’t stacking properly due to hidden attributes.

Personally, I prefer handling things directly in the C++ source rather than Lua whenever possible, so I went ahead and fixed it there.

If you’re interested, feel free to take a look at the commit I made with the fix.

This solution you posted is working but it has an error when the player doesn't grab the loot and logs out or dies, all items that are Stackable are eliminated, only the players need to do boss and grab the loot at once to avoid being eliminated if they die or log out
 
This solution you posted is working but it has an error when the player doesn't grab the loot and logs out or dies, all items that are Stackable are eliminated, only the players need to do boss and grab the loot at once to avoid being eliminated if they die or log out
Good to know. I hadn’t tested the logout/death scenario to confirm whether it was bugged. It looks like @condinblack has a fix—please check his commit. I haven’t tested it yet, but I believe it should work.
 
Back
Top