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

Need help with script for deleting empty vials from health and mana potions

reebo

New Member
Joined
Nov 22, 2014
Messages
28
Reaction score
1
Hello there,
I'm trying to figure out, how to make empty flasks from pots dissapear. Only script I found on my server was Fluids.lua and it didn't seem to me that it's connected or so.

Im using TFS 1.1 for 10.41 version, if anyone can help me, it would be great!

Regards,
reebo
 
Yop, uhm like I should delete all this in fluids.xml? Its many times there

Code:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local targetItem = Item(itemEx.uid)
    local targetItemId = ItemType(itemEx.itemid)
    if targetItemId:isFluidContainer() and itemEx.type == 0 then
        targetItem:transform(itemEx.itemid, item.type)
        Item(item.uid):transform(item.itemid, 0)
        return true
    end
    if targetItemId:isFluidContainer() and item.type == 0 then
        targetItem:transform(itemEx.itemid, 0)
        Item(item.uid):transform(item.itemid, itemEx.type)
        return true
    end

    if itemEx.itemid == 1 then
        if item.type == 0 then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        elseif itemEx.uid == player:getId() then
            Item(item.uid):transform(item.itemid, 0)
            if item.type == 3 or item.type == 15 or item.type == 43 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
            for i = 0, #fluidType do
                if item.type == fluidType[i] then
                    player:say(fluidMessage[i], TALKTYPE_MONSTER_SAY)
                    return true
                end
            end
            player:say("Gulp.", TALKTYPE_MONSTER_SAY)
        else
            Item(item.uid):transform(item.itemid, 0)
            Game.createItem(2016, item.type, toPosition):decay()
        end
    else
        local fluidSource = targetItemId:getFluidSource()
        if fluidSource ~= 0 then
            Item(item.uid):transform(item.itemid, 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
            Item(item.uid):transform(item.itemid, 0)
            Game.createItem(2016, item.type, toPosition):decay()
        end
    end
    return true
end
 
From which potions? You can look in actions.xml which script it's using.
If it's from normal potions in potions.lua you can delete this
Code:
player:addItem(emptyPot, 1)
 

Similar threads

Back
Top