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

Problems with vials, bucket (Liquids)

Eduardo170

Well-Known Member
Joined
Jan 7, 2014
Messages
422
Solutions
3
Reaction score
66
Location
Caracas, Venezuela
Server Informatión
Server OTX2 (TFS 0.3.6)
Informatión
:
  • Not nothing prints on the console
  • The fluid does not pass.
Code:
local ITEM_RUM_FLASK = 5553

local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MILK = 6
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_COCONUT_MILK = 14
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_FRUIT_JUICE = 21
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
local TYPE_TEA = 35

local distillery = {[5513] = 5469, [5514] = 5470}
local oilLamps = {[2046] = 2044}
local casks = {[1771] = TYPE_WATER, [1772] = TYPE_BEER, [1773] = TYPE_WINE}
local alcoholDrinks = {TYPE_BEER, TYPE_WINE, TYPE_RUM}
local poisonDrinks = {TYPE_SLIME, TYPE_SWAMP}

local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(poison, CONDITION_PARAM_MINVALUE, -50) -- Minimum damage the condition can do at total
setConditionParam(poison, CONDITION_PARAM_MAXVALUE, -120) -- Maximum damage
setConditionParam(poison, CONDITION_PARAM_STARTVALUE, -5) -- The damage the condition will do on the first hit
setConditionParam(poison, CONDITION_PARAM_TICKINTERVAL, 4000) -- Delay between damages
setConditionParam(poison, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

local burn = createConditionObject(CONDITION_FIRE)
setConditionParam(burn, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(burn, CONDITION_PARAM_MINVALUE, -70) -- Minimum damage the condition can do at total
setConditionParam(burn, CONDITION_PARAM_MAXVALUE, -150) -- Maximum damage
setConditionParam(burn, CONDITION_PARAM_STARTVALUE, -10) -- The damage the condition will do on the first hit
setConditionParam(burn, CONDITION_PARAM_TICKINTERVAL, 10000) -- Delay between damages
setConditionParam(burn, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(isPlayer(itemEx.uid)) then
        if(item.type == TYPE_EMPTY) then
            doPlayerSendCancel(cid, "It is empty.")
            return true
        end

        if(item.type == TYPE_MANA_FLUID) then
            if(not doPlayerAddMana(itemEx.uid, math.random(80, 160))) then
                return false
            end

            doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
            doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
        elseif(item.type == TYPE_LIFE_FLUID) then
            if(not doCreatureAddHealth(itemEx.uid, math.random(40, 75))) then
                return false
            end

            doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
            doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
        elseif(itemEx.uid == cid) then
            if(isInArray(alcoholDrinks, item.type)) then
                if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
                    return false
                end

                doCreatureSay(cid, "Aaah...", TALKTYPE_MONSTER)
            elseif(isInArray(poisonDrinks, item.type)) then
                if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
                    return false
                end

                doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
            elseif(item.type == TYPE_LAVA) then
                if(not doTargetCombatCondition(0, cid, burn, CONST_ME_NONE)) then
                    return false
                end

                doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
            else
                doCreatureSay(cid, "Gulp.", TALKTYPE_MONSTER)
            end
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        doChangeTypeItem(item.uid, TYPE_EMPTY)
        return true
    end

    if(not isCreature(itemEx.uid)) then
        if(item.type == TYPE_EMPTY) then
            if(item.itemid == ITEM_RUM_FLASK) then
                local tmp = distillery[itemEx.itemid]
                if(tmp ~= nil) then
                    doTransformItem(itemEx.uid, tmp)
                    doChangeTypeItem(item.uid, TYPE_RUM)
                else
                    doPlayerSendCancel(cid, "You have to process the bunch into the distillery to get rum.")
                end

                return true
            end

            if(isItemFluidContainer(itemEx.itemid) and itemEx.type ~= TYPE_EMPTY) then
                doChangeTypeItem(item.uid, itemEx.type)
                doChangeTypeItem(itemEx.uid, TYPE_EMPTY)
                return true
            end

            local tmp = casks[itemEx.itemid]
            if(tmp == nil) then
                tmp = getFluidSourceType(itemEx.itemid)
            end

            if(tmp) then
                doChangeTypeItem(item.uid, tmp)
                return true
            end

            doPlayerSendCancel(cid, "It is empty.")
            return true
        end

        local tmp = oilLamps[itemEx.itemid]
        if(item.type == TYPE_OIL and tmp ~= nil) then
            doTransformItem(itemEx.uid, tmp)
            doChangeTypeItem(item.uid, TYPE_NONE)
            return true
        end

        if(isItemFluidContainer(itemEx.itemid) and itemEx.type == TYPE_EMPTY) then
            doChangeTypeItem(itemEx.uid, itemEx.type)
            doChangeTypeItem(item.uid, TYPE_EMPTY)
            return true
        end

        if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
            return false
        end
    end

    doDecayItem(doCreateItem(POOL, item.type, toPosition))
    doChangeTypeItem(item.uid, TYPE_EMPTY)
    return true
end

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Consumables (Liquids+Foods) -->
    <action itemid="1775;2005-2009;2011-2015;2023;2031-2034;2562;2574-2577;3941-3942;5553;10150" event="script" value="liquids/containers.lua"/>
    <action itemid="6558" event="script" value="liquids/demonic_blood.lua"/>
    <action itemid="7588-7591;8472-8473;7618;7620;8704" event="script" value="liquids/potions.lua"/>
    <action itemid="7439" event="script" value="liquids/berserk_potion.lua"/>
    <action itemid="7440" event="script" value="liquids/mastermind_potion.lua"/>
    <action itemid="7443" event="script" value="liquids/bullseye_potion.lua"/>
    <action itemid="8474" event="script" value="liquids/antidote_potion.lua"/>
    <action itemid="2328;2362;2666-2691;2695-2696;2787-2796;5097;5678;6125;6278-6279;6393-6394;6501;6541-6545;6569;6574;7158-7159;7245;7372-7377;7909;7963;8112;8838-8845;8847;9005;9114;10454;11246;11429;12415-12418;12637-12639" event="script" value="foods/food.lua"/>
    <action itemid="9992" event="script" value="foods/rotworm_stew.lua"/>
    <action itemid="9993" event="script" value="foods/hydra_tongue_salad.lua"/>
    <action itemid="9994" event="script" value="foods/roasted_dragon_wings.lua"/>
    <action itemid="9995" event="script" value="foods/fried_tropical_terrorbird.lua"/>
    <action itemid="9996" event="script" value="foods/banana_chocolate_shake.lua"/>
    <action itemid="9997" event="script" value="foods/veggie_casserole.lua"/>
    <action itemid="9998" event="script" value="foods/filled_jalapeno_peppers.lua"/>
    <action itemid="9999" event="script" value="foods/blessed_steak.lua"/>
    <action itemid="10000" event="script" value="foods/carrot_cake.lua"/>
    <action itemid="10001" event="script" value="foods/northern_fishburger.lua"/>
    <action itemid="12540" event="script" value="foods/coconut_shrimp_bake.lua"/>
    <action itemid="12542" event="script" value="foods/pot_of_blackjack.lua"/>
    <action itemid="12543" event="script" value="foods/demonic_candy_ball.lua"/>
    <action itemid="12544" event="script" value="liquids/stamina_refuel.lua"/>

jyvWDSU.gif

NvYJ77r.gif

773559c5-feff-4269-a72e-8eb6bf93e4c5


Sorry for @up

@up

@up

@up

@up

@up

@up
 
Last edited by a moderator:
Solution
Not solved, bump.
lines 114 to 118.
Lua:
if(isItemFluidContainer(itemEx.itemid) and itemEx.type ~= TYPE_EMPTY) then
                doChangeTypeItem(item.uid, itemEx.type)
                doChangeTypeItem(itemEx.uid, TYPE_EMPTY)
                return true
            end
These lines dictate if an empty container is being used on another container, that is not empty.. and what it will do.
item.uid = the empty vial in your gif.
itemEx.type = the fluid in the bucket

soo.. it's literally telling us that it's scripted correctly.
Code:
if there is a bucket that is not empty then
    change empty vial into vial with bucket's liquid inside
    change bucket that is not empty into an empty bucket
end

This is the part in your gif.
There...
Maybe explain abit more in detail what the problem is, there could be loads of problems concerning your vial. is the vial picking up wrong fluid? is it not working at all? do you get any errors? how does your action.xml look?. more information makes it simpler to narrow down. All we know now is that you got a problem with your vials.
 
Maybe explain abit more in detail what the problem is, there could be loads of problems concerning your vial. is the vial picking up wrong fluid? is it not working at all? do you get any errors? how does your action.xml look?. more information makes it simpler to narrow down. All we know now is that you got a problem with your vials.
@Update in post, action.xml and container.lua This scripts are in the end of post
 
Last edited:
I can't find an error in your script.
Here's my containers.lua
Maybe it'll fix it randomly.
Code:
local ITEM_RUM_FLASK = 5553

local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MILK = 6
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_COCONUT_MILK = 14
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_FRUIT_JUICE = 21
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
local TYPE_TEA = 35

local distillery = {[5513] = 5469, [5514] = 5470}
local oilLamps = {[2046] = 2044}
local casks = {[1771] = TYPE_WATER, [1369] = TYPE_WATER, [1368] = TYPE_WATER, [1772] = TYPE_BEER, [1773] = TYPE_WINE}
local alcoholDrinks = {TYPE_BEER, TYPE_WINE, TYPE_RUM}
local poisonDrinks = {TYPE_SLIME, TYPE_SWAMP}

local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(poison, CONDITION_PARAM_MINVALUE, -50) -- Minimum damage the condition can do at total
setConditionParam(poison, CONDITION_PARAM_MAXVALUE, -120) -- Maximum damage
setConditionParam(poison, CONDITION_PARAM_STARTVALUE, -5) -- The damage the condition will do on the first hit
setConditionParam(poison, CONDITION_PARAM_TICKINTERVAL, 4000) -- Delay between damages
setConditionParam(poison, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

local burn = createConditionObject(CONDITION_FIRE)
setConditionParam(burn, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(burn, CONDITION_PARAM_MINVALUE, -70) -- Minimum damage the condition can do at total
setConditionParam(burn, CONDITION_PARAM_MAXVALUE, -150) -- Maximum damage
setConditionParam(burn, CONDITION_PARAM_STARTVALUE, -10) -- The damage the condition will do on the first hit
setConditionParam(burn, CONDITION_PARAM_TICKINTERVAL, 10000) -- Delay between damages
setConditionParam(burn, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(isPlayer(itemEx.uid)) then
       if(item.type == TYPE_EMPTY) then
           doPlayerSendCancel(cid, "It is empty.")
           return true
       end

       if(item.type == TYPE_MANA_FLUID) then
           if(not doPlayerAddMana(itemEx.uid, math.random(80, 160))) then
               return false
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
       elseif(item.type == TYPE_LIFE_FLUID) then
           if(not doCreatureAddHealth(itemEx.uid, math.random(40, 75))) then
               return false
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
       elseif(itemEx.uid == cid) then
           if(isInArray(alcoholDrinks, item.type)) then
               if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Aaah...", TALKTYPE_MONSTER)
           elseif(isInArray(poisonDrinks, item.type)) then
               if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
           elseif(item.type == TYPE_LAVA) then
               if(not doTargetCombatCondition(0, cid, burn, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
           else
               doCreatureSay(cid, "Gulp.", TALKTYPE_MONSTER)
           end
       else
           doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
           return true
       end

       doChangeTypeItem(item.uid, TYPE_EMPTY)
       return true
   end

   if(not isCreature(itemEx.uid)) then
       if(item.type == TYPE_EMPTY) then
           if(item.itemid == ITEM_RUM_FLASK) then
               local tmp = distillery[itemEx.itemid]
               if(tmp ~= nil) then
                   doTransformItem(itemEx.uid, tmp)
                   doChangeTypeItem(item.uid, TYPE_RUM)
               else
                   doPlayerSendCancel(cid, "You have to process the bunch into the distillery to get rum.")
               end

               return true
           end

           if(isItemFluidContainer(itemEx.itemid) and itemEx.type ~= TYPE_EMPTY) then
               doChangeTypeItem(item.uid, itemEx.type)
               doChangeTypeItem(itemEx.uid, TYPE_EMPTY)
               return true
           end

           local tmp = casks[itemEx.itemid]
           if(tmp == nil) then
               tmp = getFluidSourceType(itemEx.itemid)
           end

           if(tmp) then
               doChangeTypeItem(item.uid, tmp)
               return true
           end

           doPlayerSendCancel(cid, "It is empty.")
           return true
       end

       local tmp = oilLamps[itemEx.itemid]
       if(item.type == TYPE_OIL and tmp ~= nil) then
           doTransformItem(itemEx.uid, tmp)
           doChangeTypeItem(item.uid, TYPE_NONE)
           return true
       end

       if(isItemFluidContainer(itemEx.itemid) and itemEx.type == TYPE_EMPTY) then
           doChangeTypeItem(itemEx.uid, itemEx.type)
           doChangeTypeItem(item.uid, TYPE_EMPTY)
           return true
       end

       if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
           return false
       end
   end

   doDecayItem(doCreateItem(POOL, item.type, toPosition))
   doChangeTypeItem(item.uid, TYPE_EMPTY)
   return true
end
Code:
    <action itemid="1775" event="script" value="liquids/containers.lua"/>
   <action itemid="2005" event="script" value="liquids/containers.lua"/>
   <action itemid="2006" event="script" value="liquids/containers.lua"/>
   <action itemid="2007" event="script" value="liquids/containers.lua"/>
   <action itemid="2008" event="script" value="liquids/containers.lua"/>
   <action itemid="2009" event="script" value="liquids/containers.lua"/>
   <action itemid="2011" event="script" value="liquids/containers.lua"/>
   <action itemid="2012" event="script" value="liquids/containers.lua"/>
   <action itemid="2013" event="script" value="liquids/containers.lua"/>
   <action itemid="2014" event="script" value="liquids/containers.lua"/>
   <action itemid="2015" event="script" value="liquids/containers.lua"/>
   <action itemid="2023" event="script" value="liquids/containers.lua"/>
   <action itemid="2031" event="script" value="liquids/containers.lua"/>
   <action itemid="2032" event="script" value="liquids/containers.lua"/>
   <action itemid="2033" event="script" value="liquids/containers.lua"/>
   <action itemid="2034" event="script" value="liquids/containers.lua"/>
   <action itemid="2562" event="script" value="liquids/containers.lua"/>
   <action itemid="2574" event="script" value="liquids/containers.lua"/>
   <action itemid="2575" event="script" value="liquids/containers.lua"/>
   <action itemid="2576" event="script" value="liquids/containers.lua"/>
   <action itemid="2577" event="script" value="liquids/containers.lua"/>
   <action itemid="3941" event="script" value="liquids/containers.lua"/>
   <action itemid="3942" event="script" value="liquids/containers.lua"/>
   <action itemid="5553" event="script" value="liquids/containers.lua"/>
   <action itemid="10150" event="script" value="liquids/containers.lua"/>
 
I can't find an error in your script.
Here's my containers.lua
Maybe it'll fix it randomly.
Code:
local ITEM_RUM_FLASK = 5553

local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MILK = 6
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_COCONUT_MILK = 14
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_FRUIT_JUICE = 21
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
local TYPE_TEA = 35

local distillery = {[5513] = 5469, [5514] = 5470}
local oilLamps = {[2046] = 2044}
local casks = {[1771] = TYPE_WATER, [1369] = TYPE_WATER, [1368] = TYPE_WATER, [1772] = TYPE_BEER, [1773] = TYPE_WINE}
local alcoholDrinks = {TYPE_BEER, TYPE_WINE, TYPE_RUM}
local poisonDrinks = {TYPE_SLIME, TYPE_SWAMP}

local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(poison, CONDITION_PARAM_MINVALUE, -50) -- Minimum damage the condition can do at total
setConditionParam(poison, CONDITION_PARAM_MAXVALUE, -120) -- Maximum damage
setConditionParam(poison, CONDITION_PARAM_STARTVALUE, -5) -- The damage the condition will do on the first hit
setConditionParam(poison, CONDITION_PARAM_TICKINTERVAL, 4000) -- Delay between damages
setConditionParam(poison, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

local burn = createConditionObject(CONDITION_FIRE)
setConditionParam(burn, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(burn, CONDITION_PARAM_MINVALUE, -70) -- Minimum damage the condition can do at total
setConditionParam(burn, CONDITION_PARAM_MAXVALUE, -150) -- Maximum damage
setConditionParam(burn, CONDITION_PARAM_STARTVALUE, -10) -- The damage the condition will do on the first hit
setConditionParam(burn, CONDITION_PARAM_TICKINTERVAL, 10000) -- Delay between damages
setConditionParam(burn, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(isPlayer(itemEx.uid)) then
       if(item.type == TYPE_EMPTY) then
           doPlayerSendCancel(cid, "It is empty.")
           return true
       end

       if(item.type == TYPE_MANA_FLUID) then
           if(not doPlayerAddMana(itemEx.uid, math.random(80, 160))) then
               return false
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
       elseif(item.type == TYPE_LIFE_FLUID) then
           if(not doCreatureAddHealth(itemEx.uid, math.random(40, 75))) then
               return false
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
       elseif(itemEx.uid == cid) then
           if(isInArray(alcoholDrinks, item.type)) then
               if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Aaah...", TALKTYPE_MONSTER)
           elseif(isInArray(poisonDrinks, item.type)) then
               if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
           elseif(item.type == TYPE_LAVA) then
               if(not doTargetCombatCondition(0, cid, burn, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
           else
               doCreatureSay(cid, "Gulp.", TALKTYPE_MONSTER)
           end
       else
           doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
           return true
       end

       doChangeTypeItem(item.uid, TYPE_EMPTY)
       return true
   end

   if(not isCreature(itemEx.uid)) then
       if(item.type == TYPE_EMPTY) then
           if(item.itemid == ITEM_RUM_FLASK) then
               local tmp = distillery[itemEx.itemid]
               if(tmp ~= nil) then
                   doTransformItem(itemEx.uid, tmp)
                   doChangeTypeItem(item.uid, TYPE_RUM)
               else
                   doPlayerSendCancel(cid, "You have to process the bunch into the distillery to get rum.")
               end

               return true
           end

           if(isItemFluidContainer(itemEx.itemid) and itemEx.type ~= TYPE_EMPTY) then
               doChangeTypeItem(item.uid, itemEx.type)
               doChangeTypeItem(itemEx.uid, TYPE_EMPTY)
               return true
           end

           local tmp = casks[itemEx.itemid]
           if(tmp == nil) then
               tmp = getFluidSourceType(itemEx.itemid)
           end

           if(tmp) then
               doChangeTypeItem(item.uid, tmp)
               return true
           end

           doPlayerSendCancel(cid, "It is empty.")
           return true
       end

       local tmp = oilLamps[itemEx.itemid]
       if(item.type == TYPE_OIL and tmp ~= nil) then
           doTransformItem(itemEx.uid, tmp)
           doChangeTypeItem(item.uid, TYPE_NONE)
           return true
       end

       if(isItemFluidContainer(itemEx.itemid) and itemEx.type == TYPE_EMPTY) then
           doChangeTypeItem(itemEx.uid, itemEx.type)
           doChangeTypeItem(item.uid, TYPE_EMPTY)
           return true
       end

       if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
           return false
       end
   end

   doDecayItem(doCreateItem(POOL, item.type, toPosition))
   doChangeTypeItem(item.uid, TYPE_EMPTY)
   return true
end
Code:
    <action itemid="1775" event="script" value="liquids/containers.lua"/>
   <action itemid="2005" event="script" value="liquids/containers.lua"/>
   <action itemid="2006" event="script" value="liquids/containers.lua"/>
   <action itemid="2007" event="script" value="liquids/containers.lua"/>
   <action itemid="2008" event="script" value="liquids/containers.lua"/>
   <action itemid="2009" event="script" value="liquids/containers.lua"/>
   <action itemid="2011" event="script" value="liquids/containers.lua"/>
   <action itemid="2012" event="script" value="liquids/containers.lua"/>
   <action itemid="2013" event="script" value="liquids/containers.lua"/>
   <action itemid="2014" event="script" value="liquids/containers.lua"/>
   <action itemid="2015" event="script" value="liquids/containers.lua"/>
   <action itemid="2023" event="script" value="liquids/containers.lua"/>
   <action itemid="2031" event="script" value="liquids/containers.lua"/>
   <action itemid="2032" event="script" value="liquids/containers.lua"/>
   <action itemid="2033" event="script" value="liquids/containers.lua"/>
   <action itemid="2034" event="script" value="liquids/containers.lua"/>
   <action itemid="2562" event="script" value="liquids/containers.lua"/>
   <action itemid="2574" event="script" value="liquids/containers.lua"/>
   <action itemid="2575" event="script" value="liquids/containers.lua"/>
   <action itemid="2576" event="script" value="liquids/containers.lua"/>
   <action itemid="2577" event="script" value="liquids/containers.lua"/>
   <action itemid="3941" event="script" value="liquids/containers.lua"/>
   <action itemid="3942" event="script" value="liquids/containers.lua"/>
   <action itemid="5553" event="script" value="liquids/containers.lua"/>
   <action itemid="10150" event="script" value="liquids/containers.lua"/>
I tried your solution and still nothing.
 
Last edited:
I worked a couple of hours on this one, it works perfect and it has all of the real tibia features, including the corpses and all that. (Versión 9.1)

Code:
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
addDamageCondition(poison, 2, 6000, -5)
addDamageCondition(poison, 3, 6000, -4)
addDamageCondition(poison, 5, 6000, -3)
addDamageCondition(poison, 10, 6000, -2)
addDamageCondition(poison, 20, 6000, -1)

local fluidType = {3, 4, 5, 7, 10, 11, 12, 13, 15, 19, 27, 35, 51}
local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Urgh!", "Aah...", "Urgh!", "Aah...", "Mmmh.", "Aah..."}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == 1 then
        if item.type == 0 then
            doPlayerSendCancel(cid, "Sorry, not possible.")
        elseif itemEx.uid == cid then
            doChangeTypeItem(item.uid, 0)
            if item.type == 3 or item.type == 15 or item.type == 27 then
                doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
            elseif item.type == 4 or item.type == 12 then
                doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)
            elseif item.type == 7 then
                doPlayerAddMana(cid, math.random(50, 100))
                doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
            elseif item.type == 10 then
                doCreatureAddHealth(cid, math.random(60, 120))
                doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
            end
            for i = 0, table.maxn(fluidType) do
                if item.type == fluidType[i] then
                    doCreatureSay(cid, fluidMessage[i], TALKTYPE_ORANGE_1)
                    return TRUE
                end
            end
            doCreatureSay(cid, "Gulp.", TALKTYPE_ORANGE_1)
        else
            local splash = doCreateItem(2016, item.type, toPosition)
            doChangeTypeItem(item.uid, 0)
            doDecayItem(splash)
        end
    elseif (itemEx.itemid >= 1370 and itemEx.itemid <= 1378) or (itemEx.itemid >= 1360 and itemEx.itemid <= 1369)
        or (itemEx.itemid >= 4820 and itemEx.itemid <= 4825) or (itemEx.itemid >= 5076 and itemEx.itemid <= 5079)
        or itemEx.itemid == 1771 or itemEx.itemid == 6390 or itemEx.itemid == 5739 or itemEx.itemid == 5740
        or (itemEx.itemid >= 3693 and itemEx.itemid <= 3696) or itemEx.itemid == 1427 or itemEx.itemid == 1428
        or (itemEx.itemid >= 4608 and itemEx.itemid <= 4666) or itemEx.itemid == 10499 or itemEx.itemid == 12661
        or itemEx.itemid == 12304 or itemEx.itemid == 12039 or itemEx.itemid == 12040 or itemEx.itemid == 493
        or itemEx.itemid == 12042 or itemEx.itemid == 12043 or (itemEx.itemid >= 6627 and itemEx.itemid <= 6694)
        or (itemEx.itemid >= 7943 and itemEx.itemid <= 7954) or (itemEx.itemid >= 11030 and itemEx.itemid <= 11042)
        or itemEx.itemid == 12304 or (itemEx.itemid >= 13553 and itemEx.itemid <= 13558)
        or (itemEx.itemid >= 13849 and itemEx.itemid <= 13854) then
        doChangeTypeItem(item.uid, 1)
    elseif itemEx.itemid == 2317 or itemEx.itemid == 6560 or itemEx.itemid == 2806 or itemEx.itemid == 2808
       or itemEx.itemid == 2813 or itemEx.itemid == 2817 or itemEx.itemid == 2820 or itemEx.itemid == 2824
        or itemEx.itemid == 2826 or itemEx.itemid == 2830 or itemEx.itemid == 2831 or itemEx.itemid == 2835
        or itemEx.itemid == 2839 or itemEx.itemid == 2844 or itemEx.itemid == 2845 or itemEx.itemid == 2849
        or itemEx.itemid == 2860 or itemEx.itemid == 2862 or itemEx.itemid == 2864 or itemEx.itemid == 2866
        or itemEx.itemid == 2871 or itemEx.itemid == 2876 or itemEx.itemid == 2881 or itemEx.itemid == 2882
        or itemEx.itemid == 2886 or itemEx.itemid == 2889 or itemEx.itemid == 2893 or itemEx.itemid == 2905
        or itemEx.itemid == 2914 or itemEx.itemid == 2916 or itemEx.itemid == 2920 or itemEx.itemid == 2928
        or itemEx.itemid == 2931 or itemEx.itemid == 2935 or itemEx.itemid == 2938 or itemEx.itemid == 2940
        or itemEx.itemid == 2945 or itemEx.itemid == 2956 or itemEx.itemid == 2960 or itemEx.itemid == 2967
        or itemEx.itemid == 2969 or itemEx.itemid == 2972 or itemEx.itemid == 2979 or itemEx.itemid == 2981
        or itemEx.itemid == 2983 or itemEx.itemid == 2985 or itemEx.itemid == 2989 or itemEx.itemid == 2992
        or itemEx.itemid == 2995 or itemEx.itemid == 3001 or itemEx.itemid == 3007 or itemEx.itemid == 3019
        or itemEx.itemid == 3037 or itemEx.itemid == 3040 or itemEx.itemid == 3043 or itemEx.itemid == 3046
        or itemEx.itemid == 3055 or itemEx.itemid == 3058 or itemEx.itemid == 3065 or itemEx.itemid == 3067
        or itemEx.itemid == 3069 or itemEx.itemid == 3073 or itemEx.itemid == 3077 or itemEx.itemid == 3080
        or itemEx.itemid == 3084 or itemEx.itemid == 3086 or itemEx.itemid == 3090 or itemEx.itemid == 3095
        or itemEx.itemid == 3099 or itemEx.itemid == 3104 or itemEx.itemid == 3109 or itemEx.itemid == 3119
        or itemEx.itemid == 3128 or itemEx.itemid == 3129 or itemEx.itemid == 4251 or itemEx.itemid == 4253
        or itemEx.itemid == 4256 or itemEx.itemid == 4259 or itemEx.itemid == 4262 or itemEx.itemid == 4265
        or itemEx.itemid == 4268 or itemEx.itemid == 4271 or itemEx.itemid == 4274 or itemEx.itemid == 4277
        or itemEx.itemid == 4283 or itemEx.itemid == 4286 or itemEx.itemid == 4292 or itemEx.itemid == 4298
        or itemEx.itemid == 4301 or itemEx.itemid == 4304 or itemEx.itemid == 4307 or itemEx.itemid == 4310
        or itemEx.itemid == 4314 or itemEx.itemid == 4317 or itemEx.itemid == 4323 or itemEx.itemid == 5522
        or itemEx.itemid == 5523 or itemEx.itemid == 5524 or itemEx.itemid == 5525 or itemEx.itemid == 5526
        or itemEx.itemid == 5527 or itemEx.itemid == 6302 or itemEx.itemid == 6303 or itemEx.itemid == 6312
        or itemEx.itemid == 6313 or itemEx.itemid == 6320 or itemEx.itemid == 6321 or itemEx.itemid == 6328
        or itemEx.itemid == 6331 or itemEx.itemid == 6332 or itemEx.itemid == 6333 or itemEx.itemid == 6336
        or itemEx.itemid == 6337 or itemEx.itemid == 6340 or itemEx.itemid == 6341 or itemEx.itemid == 6364
        or itemEx.itemid == 6365 or itemEx.itemid == 5540 or itemEx.itemid == 5625 or itemEx.itemid == 5528
        or itemEx.itemid == 5666 or itemEx.itemid == 5688 or itemEx.itemid == 5762 or itemEx.itemid == 8186
        or itemEx.itemid == 5934 or itemEx.itemid == 5960 or itemEx.itemid == 5962 or itemEx.itemid == 5966
        or itemEx.itemid == 5968 or itemEx.itemid == 5969 or itemEx.itemid == 5970 or itemEx.itemid == 5973
        or itemEx.itemid == 5975 or itemEx.itemid == 5978 or itemEx.itemid == 5979 or itemEx.itemid == 5980
        or itemEx.itemid == 5981 or itemEx.itemid == 5982 or itemEx.itemid == 5983 or itemEx.itemid == 5984
        or itemEx.itemid == 5985 or itemEx.itemid == 5986 or itemEx.itemid == 5987 or itemEx.itemid == 5991
        or itemEx.itemid == 5994 or itemEx.itemid == 5996 or itemEx.itemid == 5998 or itemEx.itemid == 5999
        or itemEx.itemid == 6000 or itemEx.itemid == 6001 or itemEx.itemid == 6002 or itemEx.itemid == 6003
        or (itemEx.itemid >= 6006 and itemEx.itemid <= 6018) or itemEx.itemid == 6020 or itemEx.itemid == 6022
        or itemEx.itemid == 6026 or itemEx.itemid == 6032 or itemEx.itemid == 6033 or itemEx.itemid == 6034
        or itemEx.itemid == 6035 or (itemEx.itemid >= 6038 and itemEx.itemid <= 6046) or itemEx.itemid == 6048
        or itemEx.itemid == 6049 or (itemEx.itemid >= 6051 and itemEx.itemid <= 6059) or itemEx.itemid == 6061
        or (itemEx.itemid >= 6063 and itemEx.itemid <= 6069) or (itemEx.itemid >= 6072 and itemEx.itemid <= 6076)
        or (itemEx.itemid >= 6079 and itemEx.itemid <= 6081) or itemEx.itemid == 6083 or itemEx.itemid == 6520
        or    itemEx.itemid == 7256 or itemEx.itemid == 7260 or itemEx.itemid == 5978 or itemEx.itemid == 7316
        or    itemEx.itemid == 7317 or itemEx.itemid == 7320 or itemEx.itemid == 7321 or itemEx.itemid == 7324
        or    itemEx.itemid == 7325 or itemEx.itemid == 7327 or itemEx.itemid == 7328 or itemEx.itemid == 7330
        or    itemEx.itemid == 7334 or itemEx.itemid == 7335 or itemEx.itemid == 7338 or itemEx.itemid == 7339
        or    itemEx.itemid == 6516 or itemEx.itemid == 7621 or itemEx.itemid == 7622 or itemEx.itemid == 7623
        or itemEx.itemid == 7624 or itemEx.itemid == 7628 or itemEx.itemid == 7629 or itemEx.itemid == 7637
        or itemEx.itemid == 7638 or itemEx.itemid == 7740 or itemEx.itemid == 7741 or itemEx.itemid == 7847
        or itemEx.itemid == 7848 or itemEx.itemid == 7926 or itemEx.itemid == 7927 or itemEx.itemid == 7930
        or itemEx.itemid == 7931 or itemEx.itemid == 5978 or itemEx.itemid == 8307 or itemEx.itemid == 8308
        or itemEx.itemid == 8941 or itemEx.itemid == 8942 or itemEx.itemid == 8947 or itemEx.itemid == 8948
        or itemEx.itemid == 9780 or itemEx.itemid == 9781 or itemEx.itemid == 9783 or itemEx.itemid == 9829
        or itemEx.itemid == 9830 or itemEx.itemid == 9871 or itemEx.itemid == 9872 or itemEx.itemid == 9875
        or itemEx.itemid == 9876 or itemEx.itemid == 9879 or itemEx.itemid == 9880 or itemEx.itemid == 9882
        or itemEx.itemid == 9913 or itemEx.itemid == 9914 or itemEx.itemid == 9915 or itemEx.itemid == 9916
        or itemEx.itemid == 9919 or itemEx.itemid == 9920 or itemEx.itemid == 9923 or itemEx.itemid == 9924
        or itemEx.itemid == 9935 or itemEx.itemid == 9936 or itemEx.itemid == 9938 or itemEx.itemid == 10007
        or itemEx.itemid == 10008 or itemEx.itemid == 10319 or itemEx.itemid == 10320 or itemEx.itemid == 10321
        or itemEx.itemid == 10322 or itemEx.itemid == 10323 or itemEx.itemid == 10524 or itemEx.itemid == 10525
        or itemEx.itemid == 11138 or itemEx.itemid == 11139 or itemEx.itemid == 11247 or itemEx.itemid == 11250
        or itemEx.itemid == 11251 or itemEx.itemid == 11254 or itemEx.itemid == 11269 or itemEx.itemid == 11272
        or itemEx.itemid == 11273 or itemEx.itemid == 11276 or itemEx.itemid == 11277 or itemEx.itemid == 11280
        or itemEx.itemid == 11281 or itemEx.itemid == 11284 or itemEx.itemid == 11285 or itemEx.itemid == 11288
        or itemEx.itemid == 11316 or itemEx.itemid == 11317 or itemEx.itemid == 11362 or itemEx.itemid == 11363
        or itemEx.itemid == 11404 or itemEx.itemid == 11407 or itemEx.itemid == 11430 or itemEx.itemid == 11431
        or itemEx.itemid == 12316 or itemEx.itemid == 12545 or itemEx.itemid == 12546 or itemEx.itemid == 12609
        or itemEx.itemid == 12610 or itemEx.itemid == 12680 or itemEx.itemid == 13308 or itemEx.itemid == 13309
        or itemEx.itemid == 13312 or itemEx.itemid == 13315 or itemEx.itemid == 13316 or itemEx.itemid == 13317
        or itemEx.itemid == 13324 or itemEx.itemid == 13327 or itemEx.itemid == 13328 or itemEx.itemid == 13331
        or itemEx.itemid == 13509 or itemEx.itemid == 13510 or itemEx.itemid == 13513 or itemEx.itemid == 13516
        or itemEx.itemid == 13519 or itemEx.itemid == 13324 or itemEx.itemid == 13528 or itemEx.itemid == 13839
        or itemEx.itemid == 13840 or itemEx.itemid == 13878 then
            doChangeTypeItem(item.uid, 2)
    elseif itemEx.itemid == 1772 then
        doChangeTypeItem(item.uid, 3)
    elseif itemEx.itemid == 2807 or itemEx.itemid == 2848 or itemEx.itemid == 2857 or itemEx.itemid == 2885 or 
    itemEx.itemid == 2897 or itemEx.itemid == 2899 or itemEx.itemid == 2902 or itemEx.itemid == 6560 or
    itemEx.itemid == 2908 or itemEx.itemid == 3004 or itemEx.itemid == 3010 or itemEx.itemid == 3013 or
    itemEx.itemid == 3049 or itemEx.itemid == 3052 or itemEx.itemid == 3068 or itemEx.itemid == 4280 or
    itemEx.itemid == 6560 or itemEx.itemid == 4289 or itemEx.itemid == 4320 or itemEx.itemid == 4326 or
    itemEx.itemid == 5765 or itemEx.itemid == 5961 or itemEx.itemid == 5974 or itemEx.itemid == 5977 or
    itemEx.itemid == 5988 or itemEx.itemid == 5989 or itemEx.itemid == 5990 or itemEx.itemid == 5992 or
    itemEx.itemid == 6021 or itemEx.itemid == 6023 or itemEx.itemid == 6024 or itemEx.itemid == 6036 or
    itemEx.itemid == 6037 or itemEx.itemid == 6047 or itemEx.itemid == 6050 or itemEx.itemid == 6060 or
    itemEx.itemid == 6062 or itemEx.itemid == 6077 or itemEx.itemid == 8933 or itemEx.itemid == 8934 or
    itemEx.itemid == 8951 or itemEx.itemid == 8952 or itemEx.itemid == 9767 or itemEx.itemid == 9768 or
    itemEx.itemid == 11310 or itemEx.itemid == 11311 or itemEx.itemid == 11347 or itemEx.itemid == 11348 or
    itemEx.itemid == 11357 or itemEx.itemid == 11360 or itemEx.itemid == 11375 or itemEx.itemid == 11376 or
    itemEx.itemid == 12527 or itemEx.itemid == 12528 or itemEx.itemid == 13514 or itemEx.itemid == 13515 or
    itemEx.itemid == 13522 or itemEx.itemid == 13523 or itemEx.itemid == 13525 or itemEx.itemid == 13976 or
    itemEx.itemid == 13979 or itemEx.itemid == 13752 or itemEx.itemid == 13753 or itemEx.itemid == 13815 or
    itemEx.itemid == 13819 or itemEx.itemid == 13956 or itemEx.itemid == 13957 or itemEx.itemid == 13963 or
    itemEx.itemid == 13966 then
        doChangeTypeItem(item.uid, 4)
    elseif (itemEx.itemid >= 4691 and itemEx.itemid <= 4712) or (itemEx.itemid >= 4749 and itemEx.itemid <= 4755) or itemEx.itemid == 6353 then
        doChangeTypeItem(item.uid, 12)
    elseif itemEx.itemid == 430 then
        doChangeTypeItem(item.uid, 13)
    elseif itemEx.itemid == 1773 or itemEx.itemid == 1780 or itemEx.itemid == 1781 or itemEx.itemid == 1783 or itemEx.itemid == 1785 then
        doChangeTypeItem(item.uid, 15)
    elseif (itemEx.itemid >= 598 and itemEx.itemid <= 601) or itemEx.itemid == 1509
        or itemEx.itemid == 13960 or itemEx.itemid == 13814 or itemEx.itemid == 13816 or itemEx.itemid == 13958 or itemEx.itemid == 13959 or itemEx.itemid == 13969 then
        doChangeTypeItem(item.uid, 26)
    elseif (itemEx.itemid >= 354 and itemEx.itemid <= 355) or (itemEx.itemid >= 9024 and itemEx.itemid <= 9025)
    or (itemEx.itemid >= 13547 and itemEx.itemid <= 13552) or (itemEx.itemid >= 13740 and itemEx.itemid <= 13751)
    or (itemEx.itemid >= 13843 and itemEx.itemid <= 13848) then
        doChangeTypeItem(item.uid, 19)
    elseif (itemEx.itemid >= 5513 and itemEx.itemid <= 5514) or itemEx.itemid == 5539 then
        doChangeTypeItem(item.uid, 27)
    elseif itemEx.itemid == 8960 or itemEx.itemid == 8961 then
        doChangeTypeItem(item.uid, 21)
    elseif itemEx.itemid == 2005 or itemEx.itemid == 2006 or itemEx.itemid == 2007 or itemEx.itemid == 2008
    or itemEx.itemid == 2009 or itemEx.itemid == 2011 or itemEx.itemid == 2012 or itemEx.itemid == 2013
    or itemEx.itemid == 2014 or itemEx.itemid == 2015 or itemEx.itemid == 2023 or itemEx.itemid == 2031
    or itemEx.itemid == 3941 or itemEx.itemid == 3942 or itemEx.itemid == 7935 or itemEx.itemid == 7936
    or itemEx.itemid == 7937 or itemEx.itemid == 2562 or itemEx.itemid == 1775 or itemEx.itemid == 2033
    or itemEx.itemid == 2031 or itemEx.itemid == 2034 then
        doChangeTypeItem(item.uid, itemEx.type)
        doChangeTypeItem(itemEx.uid, 0)
        return TRUE
    elseif itemEx.itemid == 7141 then
        doChangeTypeItem(item.uid, 51)
        doTransformItem(itemEx.uid, 7140)
    elseif itemEx.itemid == 13863 and item.type >= 1 then
        doChangeTypeItem(item.uid, 0)
        doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
    elseif itemEx.itemid == 13863 and item.type == 0 then
        doPlayerSendCancel(cid, "You cannot use this object.")
    elseif item.type == 0 then
        doPlayerSendCancel(cid, "Sorry, not possible.")
    else
        if toPosition.x == CONTAINER_POSITION then
            toPosition = getCreaturePosition(cid)
        end
        splash = doCreateItem(2016, item.type, toPosition)
        doChangeTypeItem(item.uid, 0)
        doDecayItem(splash)
    end
    return TRUE
end
work in 8.6 rev 0.3.7?
?.
 
I worked a couple of hours on this one, it works perfect and it has all of the real tibia features, including the corpses and all that. (Versión 9.1)

Code:
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
addDamageCondition(poison, 2, 6000, -5)
addDamageCondition(poison, 3, 6000, -4)
addDamageCondition(poison, 5, 6000, -3)
addDamageCondition(poison, 10, 6000, -2)
addDamageCondition(poison, 20, 6000, -1)

local fluidType = {3, 4, 5, 7, 10, 11, 12, 13, 15, 19, 27, 35, 51}
local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Urgh!", "Aah...", "Urgh!", "Aah...", "Mmmh.", "Aah..."}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == 1 then
        if item.type == 0 then
            doPlayerSendCancel(cid, "Sorry, not possible.")
        elseif itemEx.uid == cid then
            doChangeTypeItem(item.uid, 0)
            if item.type == 3 or item.type == 15 or item.type == 27 then
                doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
            elseif item.type == 4 or item.type == 12 then
                doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)
            elseif item.type == 7 then
                doPlayerAddMana(cid, math.random(50, 100))
                doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
            elseif item.type == 10 then
                doCreatureAddHealth(cid, math.random(60, 120))
                doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
            end
            for i = 0, table.maxn(fluidType) do
                if item.type == fluidType[i] then
                    doCreatureSay(cid, fluidMessage[i], TALKTYPE_ORANGE_1)
                    return TRUE
                end
            end
            doCreatureSay(cid, "Gulp.", TALKTYPE_ORANGE_1)
        else
            local splash = doCreateItem(2016, item.type, toPosition)
            doChangeTypeItem(item.uid, 0)
            doDecayItem(splash)
        end
    elseif (itemEx.itemid >= 1370 and itemEx.itemid <= 1378) or (itemEx.itemid >= 1360 and itemEx.itemid <= 1369)
        or (itemEx.itemid >= 4820 and itemEx.itemid <= 4825) or (itemEx.itemid >= 5076 and itemEx.itemid <= 5079)
        or itemEx.itemid == 1771 or itemEx.itemid == 6390 or itemEx.itemid == 5739 or itemEx.itemid == 5740
        or (itemEx.itemid >= 3693 and itemEx.itemid <= 3696) or itemEx.itemid == 1427 or itemEx.itemid == 1428
        or (itemEx.itemid >= 4608 and itemEx.itemid <= 4666) or itemEx.itemid == 10499 or itemEx.itemid == 12661
        or itemEx.itemid == 12304 or itemEx.itemid == 12039 or itemEx.itemid == 12040 or itemEx.itemid == 493
        or itemEx.itemid == 12042 or itemEx.itemid == 12043 or (itemEx.itemid >= 6627 and itemEx.itemid <= 6694)
        or (itemEx.itemid >= 7943 and itemEx.itemid <= 7954) or (itemEx.itemid >= 11030 and itemEx.itemid <= 11042)
        or itemEx.itemid == 12304 or (itemEx.itemid >= 13553 and itemEx.itemid <= 13558)
        or (itemEx.itemid >= 13849 and itemEx.itemid <= 13854) then
        doChangeTypeItem(item.uid, 1)
    elseif itemEx.itemid == 2317 or itemEx.itemid == 6560 or itemEx.itemid == 2806 or itemEx.itemid == 2808
       or itemEx.itemid == 2813 or itemEx.itemid == 2817 or itemEx.itemid == 2820 or itemEx.itemid == 2824
        or itemEx.itemid == 2826 or itemEx.itemid == 2830 or itemEx.itemid == 2831 or itemEx.itemid == 2835
        or itemEx.itemid == 2839 or itemEx.itemid == 2844 or itemEx.itemid == 2845 or itemEx.itemid == 2849
        or itemEx.itemid == 2860 or itemEx.itemid == 2862 or itemEx.itemid == 2864 or itemEx.itemid == 2866
        or itemEx.itemid == 2871 or itemEx.itemid == 2876 or itemEx.itemid == 2881 or itemEx.itemid == 2882
        or itemEx.itemid == 2886 or itemEx.itemid == 2889 or itemEx.itemid == 2893 or itemEx.itemid == 2905
        or itemEx.itemid == 2914 or itemEx.itemid == 2916 or itemEx.itemid == 2920 or itemEx.itemid == 2928
        or itemEx.itemid == 2931 or itemEx.itemid == 2935 or itemEx.itemid == 2938 or itemEx.itemid == 2940
        or itemEx.itemid == 2945 or itemEx.itemid == 2956 or itemEx.itemid == 2960 or itemEx.itemid == 2967
        or itemEx.itemid == 2969 or itemEx.itemid == 2972 or itemEx.itemid == 2979 or itemEx.itemid == 2981
        or itemEx.itemid == 2983 or itemEx.itemid == 2985 or itemEx.itemid == 2989 or itemEx.itemid == 2992
        or itemEx.itemid == 2995 or itemEx.itemid == 3001 or itemEx.itemid == 3007 or itemEx.itemid == 3019
        or itemEx.itemid == 3037 or itemEx.itemid == 3040 or itemEx.itemid == 3043 or itemEx.itemid == 3046
        or itemEx.itemid == 3055 or itemEx.itemid == 3058 or itemEx.itemid == 3065 or itemEx.itemid == 3067
        or itemEx.itemid == 3069 or itemEx.itemid == 3073 or itemEx.itemid == 3077 or itemEx.itemid == 3080
        or itemEx.itemid == 3084 or itemEx.itemid == 3086 or itemEx.itemid == 3090 or itemEx.itemid == 3095
        or itemEx.itemid == 3099 or itemEx.itemid == 3104 or itemEx.itemid == 3109 or itemEx.itemid == 3119
        or itemEx.itemid == 3128 or itemEx.itemid == 3129 or itemEx.itemid == 4251 or itemEx.itemid == 4253
        or itemEx.itemid == 4256 or itemEx.itemid == 4259 or itemEx.itemid == 4262 or itemEx.itemid == 4265
        or itemEx.itemid == 4268 or itemEx.itemid == 4271 or itemEx.itemid == 4274 or itemEx.itemid == 4277
        or itemEx.itemid == 4283 or itemEx.itemid == 4286 or itemEx.itemid == 4292 or itemEx.itemid == 4298
        or itemEx.itemid == 4301 or itemEx.itemid == 4304 or itemEx.itemid == 4307 or itemEx.itemid == 4310
        or itemEx.itemid == 4314 or itemEx.itemid == 4317 or itemEx.itemid == 4323 or itemEx.itemid == 5522
        or itemEx.itemid == 5523 or itemEx.itemid == 5524 or itemEx.itemid == 5525 or itemEx.itemid == 5526
        or itemEx.itemid == 5527 or itemEx.itemid == 6302 or itemEx.itemid == 6303 or itemEx.itemid == 6312
        or itemEx.itemid == 6313 or itemEx.itemid == 6320 or itemEx.itemid == 6321 or itemEx.itemid == 6328
        or itemEx.itemid == 6331 or itemEx.itemid == 6332 or itemEx.itemid == 6333 or itemEx.itemid == 6336
        or itemEx.itemid == 6337 or itemEx.itemid == 6340 or itemEx.itemid == 6341 or itemEx.itemid == 6364
        or itemEx.itemid == 6365 or itemEx.itemid == 5540 or itemEx.itemid == 5625 or itemEx.itemid == 5528
        or itemEx.itemid == 5666 or itemEx.itemid == 5688 or itemEx.itemid == 5762 or itemEx.itemid == 8186
        or itemEx.itemid == 5934 or itemEx.itemid == 5960 or itemEx.itemid == 5962 or itemEx.itemid == 5966
        or itemEx.itemid == 5968 or itemEx.itemid == 5969 or itemEx.itemid == 5970 or itemEx.itemid == 5973
        or itemEx.itemid == 5975 or itemEx.itemid == 5978 or itemEx.itemid == 5979 or itemEx.itemid == 5980
        or itemEx.itemid == 5981 or itemEx.itemid == 5982 or itemEx.itemid == 5983 or itemEx.itemid == 5984
        or itemEx.itemid == 5985 or itemEx.itemid == 5986 or itemEx.itemid == 5987 or itemEx.itemid == 5991
        or itemEx.itemid == 5994 or itemEx.itemid == 5996 or itemEx.itemid == 5998 or itemEx.itemid == 5999
        or itemEx.itemid == 6000 or itemEx.itemid == 6001 or itemEx.itemid == 6002 or itemEx.itemid == 6003
        or (itemEx.itemid >= 6006 and itemEx.itemid <= 6018) or itemEx.itemid == 6020 or itemEx.itemid == 6022
        or itemEx.itemid == 6026 or itemEx.itemid == 6032 or itemEx.itemid == 6033 or itemEx.itemid == 6034
        or itemEx.itemid == 6035 or (itemEx.itemid >= 6038 and itemEx.itemid <= 6046) or itemEx.itemid == 6048
        or itemEx.itemid == 6049 or (itemEx.itemid >= 6051 and itemEx.itemid <= 6059) or itemEx.itemid == 6061
        or (itemEx.itemid >= 6063 and itemEx.itemid <= 6069) or (itemEx.itemid >= 6072 and itemEx.itemid <= 6076)
        or (itemEx.itemid >= 6079 and itemEx.itemid <= 6081) or itemEx.itemid == 6083 or itemEx.itemid == 6520
        or    itemEx.itemid == 7256 or itemEx.itemid == 7260 or itemEx.itemid == 5978 or itemEx.itemid == 7316
        or    itemEx.itemid == 7317 or itemEx.itemid == 7320 or itemEx.itemid == 7321 or itemEx.itemid == 7324
        or    itemEx.itemid == 7325 or itemEx.itemid == 7327 or itemEx.itemid == 7328 or itemEx.itemid == 7330
        or    itemEx.itemid == 7334 or itemEx.itemid == 7335 or itemEx.itemid == 7338 or itemEx.itemid == 7339
        or    itemEx.itemid == 6516 or itemEx.itemid == 7621 or itemEx.itemid == 7622 or itemEx.itemid == 7623
        or itemEx.itemid == 7624 or itemEx.itemid == 7628 or itemEx.itemid == 7629 or itemEx.itemid == 7637
        or itemEx.itemid == 7638 or itemEx.itemid == 7740 or itemEx.itemid == 7741 or itemEx.itemid == 7847
        or itemEx.itemid == 7848 or itemEx.itemid == 7926 or itemEx.itemid == 7927 or itemEx.itemid == 7930
        or itemEx.itemid == 7931 or itemEx.itemid == 5978 or itemEx.itemid == 8307 or itemEx.itemid == 8308
        or itemEx.itemid == 8941 or itemEx.itemid == 8942 or itemEx.itemid == 8947 or itemEx.itemid == 8948
        or itemEx.itemid == 9780 or itemEx.itemid == 9781 or itemEx.itemid == 9783 or itemEx.itemid == 9829
        or itemEx.itemid == 9830 or itemEx.itemid == 9871 or itemEx.itemid == 9872 or itemEx.itemid == 9875
        or itemEx.itemid == 9876 or itemEx.itemid == 9879 or itemEx.itemid == 9880 or itemEx.itemid == 9882
        or itemEx.itemid == 9913 or itemEx.itemid == 9914 or itemEx.itemid == 9915 or itemEx.itemid == 9916
        or itemEx.itemid == 9919 or itemEx.itemid == 9920 or itemEx.itemid == 9923 or itemEx.itemid == 9924
        or itemEx.itemid == 9935 or itemEx.itemid == 9936 or itemEx.itemid == 9938 or itemEx.itemid == 10007
        or itemEx.itemid == 10008 or itemEx.itemid == 10319 or itemEx.itemid == 10320 or itemEx.itemid == 10321
        or itemEx.itemid == 10322 or itemEx.itemid == 10323 or itemEx.itemid == 10524 or itemEx.itemid == 10525
        or itemEx.itemid == 11138 or itemEx.itemid == 11139 or itemEx.itemid == 11247 or itemEx.itemid == 11250
        or itemEx.itemid == 11251 or itemEx.itemid == 11254 or itemEx.itemid == 11269 or itemEx.itemid == 11272
        or itemEx.itemid == 11273 or itemEx.itemid == 11276 or itemEx.itemid == 11277 or itemEx.itemid == 11280
        or itemEx.itemid == 11281 or itemEx.itemid == 11284 or itemEx.itemid == 11285 or itemEx.itemid == 11288
        or itemEx.itemid == 11316 or itemEx.itemid == 11317 or itemEx.itemid == 11362 or itemEx.itemid == 11363
        or itemEx.itemid == 11404 or itemEx.itemid == 11407 or itemEx.itemid == 11430 or itemEx.itemid == 11431
        or itemEx.itemid == 12316 or itemEx.itemid == 12545 or itemEx.itemid == 12546 or itemEx.itemid == 12609
        or itemEx.itemid == 12610 or itemEx.itemid == 12680 or itemEx.itemid == 13308 or itemEx.itemid == 13309
        or itemEx.itemid == 13312 or itemEx.itemid == 13315 or itemEx.itemid == 13316 or itemEx.itemid == 13317
        or itemEx.itemid == 13324 or itemEx.itemid == 13327 or itemEx.itemid == 13328 or itemEx.itemid == 13331
        or itemEx.itemid == 13509 or itemEx.itemid == 13510 or itemEx.itemid == 13513 or itemEx.itemid == 13516
        or itemEx.itemid == 13519 or itemEx.itemid == 13324 or itemEx.itemid == 13528 or itemEx.itemid == 13839
        or itemEx.itemid == 13840 or itemEx.itemid == 13878 then
            doChangeTypeItem(item.uid, 2)
    elseif itemEx.itemid == 1772 then
        doChangeTypeItem(item.uid, 3)
    elseif itemEx.itemid == 2807 or itemEx.itemid == 2848 or itemEx.itemid == 2857 or itemEx.itemid == 2885 or 
    itemEx.itemid == 2897 or itemEx.itemid == 2899 or itemEx.itemid == 2902 or itemEx.itemid == 6560 or
    itemEx.itemid == 2908 or itemEx.itemid == 3004 or itemEx.itemid == 3010 or itemEx.itemid == 3013 or
    itemEx.itemid == 3049 or itemEx.itemid == 3052 or itemEx.itemid == 3068 or itemEx.itemid == 4280 or
    itemEx.itemid == 6560 or itemEx.itemid == 4289 or itemEx.itemid == 4320 or itemEx.itemid == 4326 or
    itemEx.itemid == 5765 or itemEx.itemid == 5961 or itemEx.itemid == 5974 or itemEx.itemid == 5977 or
    itemEx.itemid == 5988 or itemEx.itemid == 5989 or itemEx.itemid == 5990 or itemEx.itemid == 5992 or
    itemEx.itemid == 6021 or itemEx.itemid == 6023 or itemEx.itemid == 6024 or itemEx.itemid == 6036 or
    itemEx.itemid == 6037 or itemEx.itemid == 6047 or itemEx.itemid == 6050 or itemEx.itemid == 6060 or
    itemEx.itemid == 6062 or itemEx.itemid == 6077 or itemEx.itemid == 8933 or itemEx.itemid == 8934 or
    itemEx.itemid == 8951 or itemEx.itemid == 8952 or itemEx.itemid == 9767 or itemEx.itemid == 9768 or
    itemEx.itemid == 11310 or itemEx.itemid == 11311 or itemEx.itemid == 11347 or itemEx.itemid == 11348 or
    itemEx.itemid == 11357 or itemEx.itemid == 11360 or itemEx.itemid == 11375 or itemEx.itemid == 11376 or
    itemEx.itemid == 12527 or itemEx.itemid == 12528 or itemEx.itemid == 13514 or itemEx.itemid == 13515 or
    itemEx.itemid == 13522 or itemEx.itemid == 13523 or itemEx.itemid == 13525 or itemEx.itemid == 13976 or
    itemEx.itemid == 13979 or itemEx.itemid == 13752 or itemEx.itemid == 13753 or itemEx.itemid == 13815 or
    itemEx.itemid == 13819 or itemEx.itemid == 13956 or itemEx.itemid == 13957 or itemEx.itemid == 13963 or
    itemEx.itemid == 13966 then
        doChangeTypeItem(item.uid, 4)
    elseif (itemEx.itemid >= 4691 and itemEx.itemid <= 4712) or (itemEx.itemid >= 4749 and itemEx.itemid <= 4755) or itemEx.itemid == 6353 then
        doChangeTypeItem(item.uid, 12)
    elseif itemEx.itemid == 430 then
        doChangeTypeItem(item.uid, 13)
    elseif itemEx.itemid == 1773 or itemEx.itemid == 1780 or itemEx.itemid == 1781 or itemEx.itemid == 1783 or itemEx.itemid == 1785 then
        doChangeTypeItem(item.uid, 15)
    elseif (itemEx.itemid >= 598 and itemEx.itemid <= 601) or itemEx.itemid == 1509
        or itemEx.itemid == 13960 or itemEx.itemid == 13814 or itemEx.itemid == 13816 or itemEx.itemid == 13958 or itemEx.itemid == 13959 or itemEx.itemid == 13969 then
        doChangeTypeItem(item.uid, 26)
    elseif (itemEx.itemid >= 354 and itemEx.itemid <= 355) or (itemEx.itemid >= 9024 and itemEx.itemid <= 9025)
    or (itemEx.itemid >= 13547 and itemEx.itemid <= 13552) or (itemEx.itemid >= 13740 and itemEx.itemid <= 13751)
    or (itemEx.itemid >= 13843 and itemEx.itemid <= 13848) then
        doChangeTypeItem(item.uid, 19)
    elseif (itemEx.itemid >= 5513 and itemEx.itemid <= 5514) or itemEx.itemid == 5539 then
        doChangeTypeItem(item.uid, 27)
    elseif itemEx.itemid == 8960 or itemEx.itemid == 8961 then
        doChangeTypeItem(item.uid, 21)
    elseif itemEx.itemid == 2005 or itemEx.itemid == 2006 or itemEx.itemid == 2007 or itemEx.itemid == 2008
    or itemEx.itemid == 2009 or itemEx.itemid == 2011 or itemEx.itemid == 2012 or itemEx.itemid == 2013
    or itemEx.itemid == 2014 or itemEx.itemid == 2015 or itemEx.itemid == 2023 or itemEx.itemid == 2031
    or itemEx.itemid == 3941 or itemEx.itemid == 3942 or itemEx.itemid == 7935 or itemEx.itemid == 7936
    or itemEx.itemid == 7937 or itemEx.itemid == 2562 or itemEx.itemid == 1775 or itemEx.itemid == 2033
    or itemEx.itemid == 2031 or itemEx.itemid == 2034 then
        doChangeTypeItem(item.uid, itemEx.type)
        doChangeTypeItem(itemEx.uid, 0)
        return TRUE
    elseif itemEx.itemid == 7141 then
        doChangeTypeItem(item.uid, 51)
        doTransformItem(itemEx.uid, 7140)
    elseif itemEx.itemid == 13863 and item.type >= 1 then
        doChangeTypeItem(item.uid, 0)
        doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
    elseif itemEx.itemid == 13863 and item.type == 0 then
        doPlayerSendCancel(cid, "You cannot use this object.")
    elseif item.type == 0 then
        doPlayerSendCancel(cid, "Sorry, not possible.")
    else
        if toPosition.x == CONTAINER_POSITION then
            toPosition = getCreaturePosition(cid)
        end
        splash = doCreateItem(2016, item.type, toPosition)
        doChangeTypeItem(item.uid, 0)
        doDecayItem(splash)
    end
    return TRUE
end
please god dont script like thaat
create a table with ids and check for them in an array or something
please
 
It's annoying for me to organize things, I just saw the list of IDs at the editor and pasted the line, and changed the id for each one.

I don't really see the diference, maybe 80 ms per ID? :v Almost a second? xD
the difference is no one can read it
how is it more annoying to have something clean and easy to manipulate instead of taking longer and going out of your way to do the same thing but in a worse way
 
The point is that it works, and exactly like real tibia. xD If you want to manipulate it, fine, do it. Better than start from nothing, and still u are going to complain about it, better make one (If u want use mine or not) as u please and share it with this comunity :'v Specially with this dude, but well, maybe he doesn't have an idea of how to solve the fluid crisis, so the idea was to save the day for him (I don't think he's even going to edit)
dude im having the same trouble i don't know how to write these scripts im using version 7.72 otx too
 
Not solved, bump.
lines 114 to 118.
Lua:
if(isItemFluidContainer(itemEx.itemid) and itemEx.type ~= TYPE_EMPTY) then
                doChangeTypeItem(item.uid, itemEx.type)
                doChangeTypeItem(itemEx.uid, TYPE_EMPTY)
                return true
            end
These lines dictate if an empty container is being used on another container, that is not empty.. and what it will do.
item.uid = the empty vial in your gif.
itemEx.type = the fluid in the bucket

soo.. it's literally telling us that it's scripted correctly.
Code:
if there is a bucket that is not empty then
    change empty vial into vial with bucket's liquid inside
    change bucket that is not empty into an empty bucket
end

This is the part in your gif.
There is nothing wrong with this section.


However.. further down in the script..
lines 141 to 145
Lua:
if(isItemFluidContainer(itemEx.itemid) and itemEx.type == TYPE_EMPTY) then
            doChangeTypeItem(itemEx.uid, itemEx.type)
            doChangeTypeItem(item.uid, TYPE_EMPTY)
            return true
        end
These lines dictate if a full container is being used on another container, that is empty.. and what it will do.
itemEx.uid = empty vial
itemEx.type = empty vials fluid type

Right now it's telling us to fill the empty vial with itself.. which is wrong.

Either you want to change this section so the fluids will pass back and forth (empty -> full) (full -> empty)
Or you can do it like Real Tibia.. and have it like this.. (empty -> full) (full -> splat on floor)

Sooo it comes down to again..
I can't find anything wrong with your code, in the area that you seem to be having trouble with it.

But for humor's sake.. here's an updated script that does (empty -> full) (full -> empty)
I also added some water casks that you were missing.
Lua:
local ITEM_RUM_FLASK = 5553

local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MILK = 6
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_COCONUT_MILK = 14
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_FRUIT_JUICE = 21
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
local TYPE_TEA = 35

local distillery = {[5513] = 5469, [5514] = 5470}
local oilLamps = {[2046] = 2044}
local casks = {[1771] = TYPE_WATER, [1369] = TYPE_WATER, [1368] = TYPE_WATER, [1772] = TYPE_BEER, [1773] = TYPE_WINE}
local alcoholDrinks = {TYPE_BEER, TYPE_WINE, TYPE_RUM}
local poisonDrinks = {TYPE_SLIME, TYPE_SWAMP}

local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(poison, CONDITION_PARAM_MINVALUE, -50) -- Minimum damage the condition can do at total
setConditionParam(poison, CONDITION_PARAM_MAXVALUE, -120) -- Maximum damage
setConditionParam(poison, CONDITION_PARAM_STARTVALUE, -5) -- The damage the condition will do on the first hit
setConditionParam(poison, CONDITION_PARAM_TICKINTERVAL, 4000) -- Delay between damages
setConditionParam(poison, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

local burn = createConditionObject(CONDITION_FIRE)
setConditionParam(burn, CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
setConditionParam(burn, CONDITION_PARAM_MINVALUE, -70) -- Minimum damage the condition can do at total
setConditionParam(burn, CONDITION_PARAM_MAXVALUE, -150) -- Maximum damage
setConditionParam(burn, CONDITION_PARAM_STARTVALUE, -10) -- The damage the condition will do on the first hit
setConditionParam(burn, CONDITION_PARAM_TICKINTERVAL, 10000) -- Delay between damages
setConditionParam(burn, CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(isPlayer(itemEx.uid)) then
       if(item.type == TYPE_EMPTY) then
           doPlayerSendCancel(cid, "It is empty.")
           return true
       end

       if(item.type == TYPE_MANA_FLUID) then
           if(not doPlayerAddMana(itemEx.uid, math.random(80, 160))) then
               return false
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
       elseif(item.type == TYPE_LIFE_FLUID) then
           if(not doCreatureAddHealth(itemEx.uid, math.random(40, 75))) then
               return false
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
       elseif(itemEx.uid == cid) then
           if(isInArray(alcoholDrinks, item.type)) then
               if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Aaah...", TALKTYPE_MONSTER)
           elseif(isInArray(poisonDrinks, item.type)) then
               if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
           elseif(item.type == TYPE_LAVA) then
               if(not doTargetCombatCondition(0, cid, burn, CONST_ME_NONE)) then
                   return false
               end

               doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER)
           else
               doCreatureSay(cid, "Gulp.", TALKTYPE_MONSTER)
           end
       else
           doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
           return true
       end

       doChangeTypeItem(item.uid, TYPE_EMPTY)
       return true
   end

   if(not isCreature(itemEx.uid)) then
       if(item.type == TYPE_EMPTY) then
           if(item.itemid == ITEM_RUM_FLASK) then
               local tmp = distillery[itemEx.itemid]
               if(tmp ~= nil) then
                   doTransformItem(itemEx.uid, tmp)
                   doChangeTypeItem(item.uid, TYPE_RUM)
               else
                   doPlayerSendCancel(cid, "You have to process the bunch into the distillery to get rum.")
               end

               return true
           end

           if(isItemFluidContainer(itemEx.itemid) and itemEx.type ~= TYPE_EMPTY) then
               doChangeTypeItem(item.uid, itemEx.type)
               doChangeTypeItem(itemEx.uid, TYPE_EMPTY)
               return true
           end

           local tmp = casks[itemEx.itemid]
           if(tmp == nil) then
               tmp = getFluidSourceType(itemEx.itemid)
           end

           if(tmp) then
               doChangeTypeItem(item.uid, tmp)
               return true
           end

           doPlayerSendCancel(cid, "It is empty.")
           return true
       end

       local tmp = oilLamps[itemEx.itemid]
       if(item.type == TYPE_OIL and tmp ~= nil) then
           doTransformItem(itemEx.uid, tmp)
           doChangeTypeItem(item.uid, TYPE_NONE)
           return true
       end

       if(isItemFluidContainer(itemEx.itemid) and itemEx.type == TYPE_EMPTY) then
           doChangeTypeItem(itemEx.uid, item.type)
           doChangeTypeItem(item.uid, TYPE_EMPTY)
           return true
       end

       if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
           return false
       end
   end

   doDecayItem(doCreateItem(POOL, item.type, toPosition))
   doChangeTypeItem(item.uid, TYPE_EMPTY)
   return true
end
 
Solution
Back
Top