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

TFS 1.X+ Help making stackable Fluids (server with 8.6 sources )

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,738
Solutions
9
Reaction score
274
Location
Chile
Hello

I'm using 1.3 nekiro downgraded datapack protocol 8.60 with 7.60 map and items otb with otcv8

I want to make fluids like mana/life/water and so son.. stackable items. Have tested enabling stackable option for runes in files otb, spr and dat. It worked pretty good with no problem it's displaying rune charges properly. Then i tried enabling stackable option for fluids in items.otb. that it's the itemid 2006 and in the spr / dat it's the item id 2874. So i enabled stackable option in both needed files but it didn't work, so i read on the forum that it needs a change inside fluids.lua file but i don't know which or where they must be made. Can somebody enlighten me please?
Thanks.

this is my fluids.lua file
Lua:
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)

local poison = Condition(CONDITION_POISON)
poison:setParameter(CONDITION_PARAM_DELAYED, true)
poison:setParameter(CONDITION_PARAM_MINVALUE, -50)
poison:setParameter(CONDITION_PARAM_MAXVALUE, -120)
poison:setParameter(CONDITION_PARAM_STARTVALUE, -5)
poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 4000)
poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local fluidMessage = {
    [3] = "Aah...",
    [4] = "Urgh!",
    [5] = "Mmmh.",
    [7] = "Aaaah...",
    [10] = "Aaaah...",
    [11] = "Urgh!",
    [13] = "Urgh!",
    [15] = "Aah...",
    [19] = "Urgh!",
    [43] = "Aaaah..."
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local targetItemType = ItemType(target.itemid)
    if targetItemType and targetItemType:isFluidContainer() then
        if target.type == 0 and item.type ~= 0 then
            target:transform(target:getId(), item.type)
            item:transform(item:getId(), 0)
            return true
        elseif target.type ~= 0 and item.type == 0 then
            target:transform(target:getId(), 0)
            item:transform(item:getId(), target.type)
            return true
        end
    end

    if target.itemid == 1 then
        if item.type == 0 then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        elseif target.uid == player.uid then
            if table.contains({3, 15, 43}, item.type) then
                player:addCondition(drunk)
            elseif item.type == 4 then
                player:addCondition(poison)
            elseif item.type == 7 then
                player:addMana(math.random(50, 150))
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item.type == 10 then
                player:addHealth(60)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            player:say(fluidMessage[item.type] or "Gulp.", TALKTYPE_MONSTER_SAY)
            item:transform(item:getId(), 0)
        else
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), 0)
        end
    else
        local fluidSource = targetItemType and targetItemType:getFluidSource() or 0
        if fluidSource ~= 0 then
            item:transform(item:getId(), fluidSource)
        elseif item.type == 0 then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = player:getPosition()
            end
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), 0)
        end
    end
    return true
end
 
Last edited:
Top