local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)
local poison = Condition(CONDITION_POISON)
poison:setTiming(100)
local messages = {
[FLUID_WATER] = "Gulp.",
[FLUID_WINE] = "Aah...",
[FLUID_BEER] = "Aah...",
[FLUID_MUD] = "Gulp.",
[FLUID_BLOOD] = "Gulp.",
[FLUID_SLIME] = "Urgh!",
[FLUID_OIL] = "Gulp.",
[FLUID_URINE] = "Urgh!",
[FLUID_MILK] = "Mmmh.",
[FLUID_MANAFLUID] = "Aaaah...",
[FLUID_LIFEFLUID] = "Aaaah...",
[FLUID_LEMONADE] = "Mmmh."
}
function onUse(player, item, fromPosition, target, toPosition)
local targetItemType = ItemType(target:getId())
if targetItemType and targetItemType:isFluidContainer() then
if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
target:transform(target:getId(), item:getFluidType())...
What does your fluids.lua script look like?yes sir!
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local ItemType = ItemType(item.itemid)
if target:getActionId() == 1337 && ItemType == 13 then -- i think 13 is the typeid of urine else change it to the right one
return destroyItem(player, target, toPosition)
end
end
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)
local poison = Condition(CONDITION_POISON)
poison:setTiming(100)
local messages = {
[FLUID_WATER] = "Gulp.",
[FLUID_WINE] = "Aah...",
[FLUID_BEER] = "Aah...",
[FLUID_MUD] = "Gulp.",
[FLUID_BLOOD] = "Gulp.",
[FLUID_SLIME] = "Urgh!",
[FLUID_OIL] = "Gulp.",
[FLUID_URINE] = "Urgh!",
[FLUID_MILK] = "Mmmh.",
[FLUID_MANAFLUID] = "Aaaah...",
[FLUID_LIFEFLUID] = "Aaaah...",
[FLUID_LEMONADE] = "Mmmh."
}
function onUse(player, item, fromPosition, target, toPosition)
local targetItemType = ItemType(target:getId())
if targetItemType and targetItemType:isFluidContainer() then
if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
target:transform(target:getId(), item:getFluidType())
item:transform(item:getId(), 0)
return true
elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then
target:transform(target:getId(), 0)
item:transform(item:getId(), target:getFluidType())
return true
end
end
if target:isCreature() and target:getPlayer() ~= nil then
if item:getFluidType() == FLUID_NONE then
player:sendCancelMessage("It is empty.")
else
local self = target == player
if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then
player:addCondition(drunk)
elseif self and item:getFluidType() == FLUID_SLIME then
player:addCondition(slime)
elseif item:getFluidType() == FLUID_MANAFLUID then
target:addMana(math.random(50, 100))
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
elseif item:getFluidType() == FLUID_LIFEFLUID then
target:addHealth(math.random(25, 50))
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
if not self then
if item:getFluidType() ~= FLUID_MANAFLUID and item:getFluidType() ~= FLUID_LIFEFLUID then
if toPosition.x == CONTAINER_POSITION then
toPosition = player:getPosition()
end
Game.createItem(2886, item:getFluidType(), toPosition):decay()
return true
end
end
local message = messages[item:getFluidType()]
if message then
target:say(message, TALKTYPE_MONSTER_SAY)
else
target:say("Gulp.", TALKTYPE_MONSTER_SAY)
end
item:transform(item:getId(), FLUID_NONE)
end
else
if toPosition.x == CONTAINER_POSITION then
toPosition = player:getPosition()
end
local tile = Tile(toPosition)
if not tile then
return false
end
if item:getFluidType() ~= FLUID_NONE and tile:hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then
return false
end
local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
if fluidSource ~= FLUID_NONE then
item:transform(item:getId(), fluidSource)
elseif item:getFluidType() == FLUID_NONE then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
else
Game.createItem(2886, item.type, toPosition):decay()
item:transform(item:getId(), 0)
end
end
return true
end
if item:getFluidType() == FLUID_URINE then
if target:getId() == 1270 and toPosition.x == 32170 and toPosition.y == 32146 and toPosition.z == 11 then
item:transform(item:getId(), FLUID_NONE)
Game.sendMagicEffect({x = 32170, y = 32146, z = 11}, 3)
Game.removeItemOnMap({x = 32170, y = 32146, z = 11}, 1270)
return true
end
end
FYI you could just typeLua:local drunk = Condition(CONDITION_DRUNK) drunk:setParameter(CONDITION_PARAM_TICKS, 60000) local poison = Condition(CONDITION_POISON) poison:setTiming(100) local messages = { [FLUID_WATER] = "Gulp.", [FLUID_WINE] = "Aah...", [FLUID_BEER] = "Aah...", [FLUID_MUD] = "Gulp.", [FLUID_BLOOD] = "Gulp.", [FLUID_SLIME] = "Urgh!", [FLUID_OIL] = "Gulp.", [FLUID_URINE] = "Urgh!", [FLUID_MILK] = "Mmmh.", [FLUID_MANAFLUID] = "Aaaah...", [FLUID_LIFEFLUID] = "Aaaah...", [FLUID_LEMONADE] = "Mmmh." } function onUse(player, item, fromPosition, target, toPosition) local targetItemType = ItemType(target:getId()) if targetItemType and targetItemType:isFluidContainer() then if target:getFluidType() == 0 and item:getFluidType() ~= 0 then target:transform(target:getId(), item:getFluidType()) item:transform(item:getId(), 0) return true elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then target:transform(target:getId(), 0) item:transform(item:getId(), target:getFluidType()) return true end end if target:isCreature() and target:getPlayer() ~= nil then if item:getFluidType() == FLUID_NONE then player:sendCancelMessage("It is empty.") else local self = target == player if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then player:addCondition(drunk) elseif self and item:getFluidType() == FLUID_SLIME then player:addCondition(slime) elseif item:getFluidType() == FLUID_MANAFLUID then target:addMana(math.random(50, 100)) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) elseif item:getFluidType() == FLUID_LIFEFLUID then target:addHealth(math.random(25, 50)) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) end if not self then if item:getFluidType() ~= FLUID_MANAFLUID and item:getFluidType() ~= FLUID_LIFEFLUID then if toPosition.x == CONTAINER_POSITION then toPosition = player:getPosition() end Game.createItem(2886, item:getFluidType(), toPosition):decay() return true end end local message = messages[item:getFluidType()] if message then target:say(message, TALKTYPE_MONSTER_SAY) else target:say("Gulp.", TALKTYPE_MONSTER_SAY) end item:transform(item:getId(), FLUID_NONE) end else if toPosition.x == CONTAINER_POSITION then toPosition = player:getPosition() end local tile = Tile(toPosition) if not tile then return false end if item:getFluidType() ~= FLUID_NONE and tile:hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then return false end local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE if fluidSource ~= FLUID_NONE then item:transform(item:getId(), fluidSource) elseif item:getFluidType() == FLUID_NONE then player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.") else Game.createItem(2886, item.type, toPosition):decay() item:transform(item:getId(), 0) end end return true end
Vial of Urine: 2874 (same as empty vial)
And you are right, can't use vial on the wall.
EDIT: Got it guys. Just added it inside fluids.lua:
Lua:if item:getFluidType() == FLUID_URINE then if target:getId() == 1270 and toPosition.x == 32170 and toPosition.y == 32146 and toPosition.z == 11 then item:transform(item:getId(), FLUID_NONE) Game.sendMagicEffect({x = 32170, y = 32146, z = 11}, 3) Game.removeItemOnMap({x = 32170, y = 32146, z = 11}, 1270) return true end end
Game.sendMagicEffect({x = 32170, y = 32146, z = 11}, 3)
Game.removeItemOnMap({x = 32170, y = 32146, z = 11}, 1270)
like this instead
Game.sendMagicEffect(toPosition, 3)
Game.removeItemOnMap(toPosition, 1270)