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

Solved Use only 1 item instead of the whole stack.

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I've made the following action script:
Code:
local fish = {2667}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isInArray(fish, itemEx.itemid) == TRUE then
        local rand = math.random(1, 10)
        if rand < 8 then
        doTransformItem(itemEx.uid, 2240)
        doPlayerAddItem(cid, 2668, 1)
        doCreatureSay(cid, "You successfully gutted the fish and collected some fillet.", TALKTYPE_ORANGE_1)
    else
        doTransformItem(itemEx.uid, 2240)
        doCreatureSay(cid, "You gutted the fish but failed to get some fillet.", TALKTYPE_ORANGE_1)
        end
end
end

But I have the following problem. when I use this on just 1 fish, it works perfectly but when I use it on a stack of fish then the whole stack will disappear instead of just 1 fish.

Anyone knows how to fix this?

Thanks in advance.
 
Instead of doTransformItem, you can use doRemoveItem to remove the fish and doPlayerAddItem to add the fish remains.
Code:
doRemoveItem(itemEx.uid, 1)
Here you can choose how many it removes, so it will just remove 1 from the stack.
 
Back
Top