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

Lua Vial/Bottle/Bucket/Mug containers wont pick up water.

elnelson

Lunaria World Dev
Joined
Jun 20, 2009
Messages
580
Solutions
2
Reaction score
58
Location
México
Hello, otlanders i have a problem. When i try to fill the container (vial or w/e) with shallow water (id:4644) vial wont fill up. but, when i try to use with desert shallow water (id: 4632) it fills the vial with wáter.

here is the script im using on TFS 0.4 Rev 3777
Lua:
local DISTILLERY = {5513, 5514, 5469, 5470}
local ITEM_RUM_FLASK = 5553
local ITEM_POOL = 2016
local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
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 exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
 if(itemEx.uid == cid) then
  if(item.type == TYPE_EMPTY) then
   doPlayerSendCancel(cid, "It is empty.")
   return true
  end
  if(item.type == TYPE_MANA_FLUID) then
   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
    doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
   end
   if(not doPlayerAddMana(cid, math.random(80, 160))) then
    return false
   end
   doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doAddCondition(cid, exhaust)
  elseif(item.type == TYPE_LIFE_FLUID) then
   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
    doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
   end
   if(not doCreatureAddHealth(cid, math.random(40, 75))) then
    return false
   end
   doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doAddCondition(cid, exhaust)
  elseif(isInArray(alcoholDrinks, item.type)) then
   if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
    return false
   end
   doCreatureSay(cid, "Aaah...", TALKTYPE_ORANGE_1)
  elseif(isInArray(poisonDrinks, item.type)) then
   if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
    return false
   end
   doCreatureSay(cid, "Urgh!", TALKTYPE_ORANGE_1)
  else
   doCreatureSay(cid, "Gulp.", TALKTYPE_ORANGE_1)
  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 and isInArray(DISTILLERY, itemEx.itemid)) then
    if(itemEx.actionid == 100) then
     doItemEraseAttribute(itemEx.uid, "description")
     doItemEraseAttribute(itemEx.uid, "aid")
     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
   if(casks[itemEx.itemid] ~= nil) then
    doChangeTypeItem(item.uid, casks[itemEx.itemid])
    return true
   end
   local fluidEx = getFluidSourceType(itemEx.itemid)
   if(fluidEx ~= false) then
    doChangeTypeItem(item.uid, fluidEx)
    return true
   end
   doPlayerSendCancel(cid, "It is empty.")
   return true
  end
  if(item.type == TYPE_OIL and oilLamps[itemEx.itemid] ~= nil) then
   doTransformItem(itemEx.uid, oilLamps[itemEx.itemid])
   doChangeTypeItem(item.uid, TYPE_NONE)
   return true
  end
  if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
   return false
  end
 end
 doDecayItem(doCreateItem(ITEM_POOL, item.type, toPosition))
 doChangeTypeItem(item.uid, TYPE_EMPTY)
 return true
end
[code]
 
Apparently, the code is relevant to your issue in the part:
Lua:
   local fluidEx = getFluidSourceType(itemEx.itemid)
   if(fluidEx ~= false) then
    doChangeTypeItem(item.uid, fluidEx)
    return true
   end

If you have some coding experience, maybe you will find references to getfluidSourceType() in your constants declarations, definitions declarations or luafunctions guide. Please let the community have a little bit of insight so we are able to help you.
 
Apparently, the code is relevant to your issue in the part:
Lua:
   local fluidEx = getFluidSourceType(itemEx.itemid)
   if(fluidEx ~= false) then
    doChangeTypeItem(item.uid, fluidEx)
    return true
   end

If you have some coding experience, maybe you will find references to getfluidSourceType() in your constants declarations, definitions declarations or luafunctions guide. Please let the community have a little bit of insight so we are able to help you.
Lua:
function getFluidSourceType(itemid)
local item = getItemInfo(itemid)
return item and item.fluidSource or false
end
 
Okay, now find any references to getItemInfo(itemid).

Also, try to find in your items.xml (or whatever it is you kids use nowadays) any references to fluid types relevant to itemid 4644 and itemid 4632 (both water types, see if they have a special property or lack thereof correspondent to the function of filling vials with water)
 
Okay, now find any references to getItemInfo(itemid).

Also, try to find in your items.xml (or whatever it is you kids use nowadays) any references to fluid types relevant to itemid 4644 and itemid 4632 (both water types, see if they have a special property or lack thereof correspondent to the function of filling vials with water)
i have these references. what can i try now?
Lua:
 <item fromid="4632" toid="4643" name="shallow water">
  <attribute key="fluidSource" value="water"/>
 </item>
 <item fromid="4644" toid="4663" name="shallow water">
  <attribute key="fluidSource" value="water"/>
  <attribute key="allowpickupable" value="1"/>
 </ítem>
 
Well, the only difference seems to be the "allowpickupable" property. Maybe if you remove that whole line, it'll work. Does it work with other types of shallow water? As in, from itemid 4645 to 4663? If not, that might just be the solution. Also, don't forget to reset the server so that items.xml may be reloaded!!

Also, maybe it's a bit silly to ask, but are you trying this on a bordered tile or one with something on top? This could be the root of the problem as well.
 
Well, the only difference seems to be the "allowpickupable" property. Maybe if you remove that whole line, it'll work. Does it work with other types of shallow water? As in, from itemid 4645 to 4663? If not, that might just be the solution. Also, don't forget to reset the server so that items.xml may be reloaded!!

Also, maybe it's a bit silly to ask, but are you trying this on a bordered tile or one with something on top? This could be the root of the problem as well.
i've spot a difference between id:4632 and id:4644.
Desert shallow water cant /r (remove) tile, but when i remove tile from 4644 there is grass down from the border, might it be the bug? how could i fix it? maybe a module that picks up ítems on top?

btw i added
Lua:
 <item fromid="4632" toid="4643" name="shallow water">
  <attribute key="fluidSource" value="water"/>
  <attribute key="allowpickupable" value="1"/>
 </item>
 <item fromid="4644" toid="4663" name="shallow water">
  <attribute key="fluidSource" value="water"/>
  <attribute key="allowpickupable" value="1"/>
 </item>
still wont pick up

changed ítem.otbm properties of shallow water to desert shallow water and wont pick up
 
Remove allowpickupable from both! You said 4632 could pick up water, but 4644 couldn't; and 4644 has the allowpickupable property! Let's try this first, and if it doesn't work, we will implement a function that picks up water regardless of grass border.
 
Remove allowpickupable from both! You said 4632 could pick up water, but 4644 couldn't; and 4644 has the allowpickupable property! Let's try this first, and if it doesn't work, we will implement a function that picks up water regardless of grass border.
still wont wont :/ i think is the position of ítems id (below grass - above border) that container looks for wáter below the border, but there is grass isntead of water
 
What is the border itemid? Could you do a screenshot as well? Perhaps we can add the itemid to the code-- see, maybe there isn't even the actual itemid on this tile. Have you tried using the flask/whatever container directly on a created tile of the desired itemid? i.e "/i 4644" on a clear spot where there are no borders or doodads on the ground.
 
What is the border itemid? Could you do a screenshot as well? Perhaps we can add the itemid to the code-- see, maybe there isn't even the actual itemid on this tile. Have you tried using the flask/whatever container directly on a created tile of the desired itemid? i.e "/i 4644" on a clear spot where there are no borders or doodads on the ground.
i have these references.
8GecDcb.png

hope u can help me building something that could fix this.
 
Add this:
Lua:
--local things = {4644, 4645} --etc
--for k, v in pairs(things) do
for v=4644, 4663 do
  if(getTileItemById(position, v) ~= nil) then
     doChangeTypeItem(item.uid, TYPE_WATER)
     break
  end
end

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

// This is highly impractical and inefficient
 
Last edited:
Add this:
Lua:
--local things = {4644, 4645} --etc
--for k, v in pairs(things) do
for v=4644, 4663 do
  if(getTileItemById(position, v) ~= nil) then
     doChangeTypeItem(item.uid, TYPE_WATER)
     break
  end
end

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

// This is highly impractical and inefficient
it is not working :S
 
Change
Lua:
  if(getTileItemById(position, v) ~= nil) then

To
Lua:
tileid = getTileItemById(position, v)
  if(tileid.itemid == v) then

And post full code pls. Are u receiving any errosr?
 
Change
Lua:
  if(getTileItemById(position, v) ~= nil) then

To
Lua:
tileid = getTileItemById(position, v)
  if(tileid.itemid == v) then

And post full code pls. Are u receiving any errosr?
this is the final result, seems not working.
Lua:
local DISTILLERY = {5513, 5514, 5469, 5470}
local ITEM_RUM_FLASK = 5553
local ITEM_POOL = 2016
local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
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 exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
 if(itemEx.uid == cid) then
  if(item.type == TYPE_EMPTY) then
   doPlayerSendCancel(cid, "It is empty.")
   return true
  end
  if(item.type == TYPE_MANA_FLUID) then
   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
    doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
   end
   if(not doPlayerAddMana(cid, math.random(80, 160))) then
    return false
   end
   doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doAddCondition(cid, exhaust)
  elseif(item.type == TYPE_LIFE_FLUID) then
   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
    doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
   end
   if(not doCreatureAddHealth(cid, math.random(40, 75))) then
    return false
   end
   doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doAddCondition(cid, exhaust)
  elseif(isInArray(alcoholDrinks, item.type)) then
   if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
    return false
   end
   doCreatureSay(cid, "Aaah...", TALKTYPE_ORANGE_1)
  elseif(isInArray(poisonDrinks, item.type)) then
   if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
    return false
   end
   doCreatureSay(cid, "Urgh!", TALKTYPE_ORANGE_1)
  else
  doCreatureSay(itemEx.uid, "Gulp!", TALKTYPE_ORANGE_1)
  local config = {
    storage = 121314,
 storage2 = 3322,
    removeValue = 10,
    delay = 1
}
 
       local storage = getPlayerStorageValue(cid, config.storage)
  local storage2 = getPlayerStorageValue(cid, config.storage2)
  local storage3 = getPlayerStorageValue(cid, 12345)
  if (storage2 > 0) and isInArray(TYPE_WATER, item.type) then
  doPlayerSendCancel(cid, "You are full.")
  doDecayItem(doCreateItem(ITEM_POOL, item.type, toPosition))
  else
    if (storage3 >= 10) and (storage2 <= 0) and isInArray(TYPE_WATER, item.type) then
 -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "[Warning]: You are drinking water; current temperature "..storage3 - config.removeValue.." ")
 -- doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 doSendMagicEffect(getThingPosition(itemEx.uid), CONST_ME_MAGIC_BLUE)
        setPlayerStorageValue(cid, config.storage, storage - config.removeValue)
  setPlayerStorageValue(cid, config.storage2, 1)
        addEvent(function(cid)
            if getPlayerGUID(cid) > 0 then
                setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) + config.removeValue)
    setPlayerStorageValue(cid, config.storage2, 0)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "[Warning]: You are dehydrated water; current temperature "..storage3.." ")
            end
        end, config.delay * 60000, cid)
    end
  end
  doChangeTypeItem(item.uid, TYPE_EMPTY)
  return true
 end
end
 if(not isCreature(itemEx.uid)) then
  if(item.type == TYPE_EMPTY) then
   if(item.itemid == ITEM_RUM_FLASK and isInArray(DISTILLERY, itemEx.itemid)) then
    if(itemEx.actionid == 100) then
     doItemEraseAttribute(itemEx.uid, "description")
     doItemEraseAttribute(itemEx.uid, "aid")
     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
   if(casks[itemEx.itemid] ~= nil) then
    doChangeTypeItem(item.uid, casks[itemEx.itemid])
    return true
   end
   local fluidEx = getFluidSourceType(itemEx.itemid)
   if(fluidEx ~= false) then
   print("---")
   print(itemEx.fluidSource)
   print("---")
    doChangeTypeItem(item.uid, fluidEx)
    return true
   end
   doPlayerSendCancel(cid, "It is empty.")
   return true
  end
  if(item.type == TYPE_OIL and oilLamps[itemEx.itemid] ~= nil) then
   doTransformItem(itemEx.uid, oilLamps[itemEx.itemid])
   doChangeTypeItem(item.uid, TYPE_NONE)
   return true
  end
  if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
   return false
  end
  
  
--local things = {4644, 4645} --etc
--for k, v in pairs(things) do
for v=4644, 4663 do
tileid = getTileItemById(position, v)
if(tileid.itemid == v) then
doChangeTypeItem(item.uid, TYPE_WATER)
break
end
end
end
 doDecayItem(doCreateItem(ITEM_POOL, item.type, toPosition))
 doChangeTypeItem(item.uid, TYPE_EMPTY)
 return true
end
 
Sorry, small error. Dealing with a lot of personal stuff IRL.

Change:
Lua:
tileid = getTileItemById(position, v)

To:
Lua:
tileid = getTileItemById(toPosition, v)

Basically code behaviour was wrong because it was refering to nil declared 'position', when it should've been toPosition.
 
Sorry, small error. Dealing with a lot of personal stuff IRL.

Change:
Lua:
tileid = getTileItemById(position, v)

To:
Lua:
tileid = getTileItemById(toPosition, v)

Basically code behaviour was wrong because it was refering to nil declared 'position', when it should've been toPosition.
Sorry for the late, i was on school and didnt have time to check my posts.

Still wont work after modification. bump please?
 
Try this, I think you can't fill a vial from a normal water border on rl either. You can just add the item ids and make them fill shit with water (line 102)

Code:
local DISTILLERY = {5513, 5514, 5469, 5470}
-- ugly hack
local WATER_BORDER_FIRST = 4644 -- border ID begins here
local WATER_BORDER_LAST = 4655 -- and ends here
-- better make this into a table if you want more IDs to give water
local ITEM_RUM_FLASK = 5553
local ITEM_POOL = 2016
local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
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 exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
 if(itemEx.uid == cid) then
  if(item.type == TYPE_EMPTY) then
   doPlayerSendCancel(cid, "It is empty.")
   return true
  end
  if(item.type == TYPE_MANA_FLUID) then
   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
    doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
   end
   if(not doPlayerAddMana(cid, math.random(80, 160))) then
    return false
   end
   doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doAddCondition(cid, exhaust)
  elseif(item.type == TYPE_LIFE_FLUID) then
   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
    doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
   end
   if(not doCreatureAddHealth(cid, math.random(40, 75))) then
    return false
   end
   doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
   doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
   doAddCondition(cid, exhaust)
  elseif(isInArray(alcoholDrinks, item.type)) then
   if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
    return false
   end
   doCreatureSay(cid, "Aaah...", TALKTYPE_ORANGE_1)
  elseif(isInArray(poisonDrinks, item.type)) then
   if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
    return false
   end
   doCreatureSay(cid, "Urgh!", TALKTYPE_ORANGE_1)
  else
   doCreatureSay(cid, "Gulp.", TALKTYPE_ORANGE_1)
  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 and isInArray(DISTILLERY, itemEx.itemid)) then
    if(itemEx.actionid == 100) then
     doItemEraseAttribute(itemEx.uid, "description")
     doItemEraseAttribute(itemEx.uid, "aid")
     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
   if(casks[itemEx.itemid] ~= nil) then
    doChangeTypeItem(item.uid, casks[itemEx.itemid])
    return true
   end
   -- fill with water if itemEx is between the first and last ID we specified
   if(itemEx.itemid >= WATER_BORDER_FIRST and itemEx.itemid <= WATER_BORDER_LAST) then
    doChangeTypeItem(item.uid, TYPE_WATER)
    return true
   end
   -- the rest is business as usual
   local fluidEx = getFluidSourceType(itemEx.itemid)
   if(fluidEx ~= false) then
    doChangeTypeItem(item.uid, fluidEx)
    return true
   end
   doPlayerSendCancel(cid, "It is empty.")
   return true
  end
  if(item.type == TYPE_OIL and oilLamps[itemEx.itemid] ~= nil) then
   doTransformItem(itemEx.uid, oilLamps[itemEx.itemid])
   doChangeTypeItem(item.uid, TYPE_NONE)
   return true
  end
  if(hasProperty(itemEx.uid, CONST_PROP_BLOCKSOLID)) then
   return false
  end
 end
 doDecayItem(doCreateItem(ITEM_POOL, item.type, toPosition))
 doChangeTypeItem(item.uid, TYPE_EMPTY)
 return true
end
 
Last edited:
Back
Top