psilocybusmaxim
Member
Okay so I'm working with a 2.Frankenstein OTX 7.4 - 7.72 server I've been updating for a bit, but I can't change vials from disappearing. I want it to where I can just make the vial empty after it's used. I don't know if the problems doRemoveItem or doChangeTypeItem(item.uid, 0), I've just been scratching my head at this any advice would be appreciated! I've been working on other problems, but I just don't know how to tackle this one.
I have 2 fluid lua's and a potion.lua posted.
Thanks for looking!
This fixed it for me sorry people! I tried it before I posted but I put it in the wrong folder! xD
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 500)
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 120000)
local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, 10)
addDamageCondition(poison, 40, 4000, -3)
function onUse(cid, item, frompos, item2, topos)
ITEMCONTAINER = {2562, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2032, 2033, 3941, 3942, 2005, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2023, 2031, 2034, 1775}
GAINWATER = {1771, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4664, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825, 490, 4828, 4829, 4830, 4831, 1368, 1369}
GAINLEMONADE = {1776}
GAINBEER = {1772}
GAINWINE = {1773, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785}
GAINSLIME = {2807, 2848, 2857, 2897, 2899, 2908, 3004, 3010, 3011, 3052, 3733, 3734, 3735, 3736, 4260, 4280, 4296, 4320, 4326, 4393}
if(hasCondition(cid, CONDITION_EXHAUSTED) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
--switch vial container--
if item.type >= 1 and isInArray(ITEMCONTAINER, item2.itemid) == 1 then
if item2.type == 0 then
doChangeTypeItem(item2.uid, item.type)
doChangeTypeItem(item.uid, 0)
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
-------------------------
--None--
elseif item.type == 0 then --None
if isInArray(GAINWATER, item2.itemid) == 1 or item2.itemid >= 4632 and item2.itemid <= 4663 then
doChangeTypeItem(item.uid, 1)
elseif isInArray(GAINSLIME, item2.itemid) == 1 then
doChangeTypeItem(item.uid, 4)
elseif item2.itemid > 2806 and item2.itemid < 3132 or item2.itemid >= 4251 and item2.itemid <= 4327 then
if isInArray(GAINSLIME, item2.itemid) == 1 then
else
doChangeTypeItem(item.uid, 2)
end
elseif isInArray(GAINLEMONADE, item2.itemid) == 1 then
doChangeTypeItem(item.uid, 5)
elseif isInArray(GAINBEER, item2.itemid) == 1 then
doChangeTypeItem(item.uid, 3)
elseif isInArray(GAINWINE, item2.itemid) == 1 then
doChangeTypeItem(item.uid, 15)
end
------
--Water--
elseif item.type == 1 then --Water
if item2.uid == cid then
doPlayerSay(cid, "Gulp.", 1)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--Blood--
elseif item.type == 2 then --Blood
if item2.uid == cid then
doPlayerSay(cid, "Gulp.", 1)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
elseif item2.actionid == 4107 then
doChangeTypeItem(item.uid, 0)
doTeleportThing(cid,{x=32791, y=32334, z=10})
doSendMagicEffect({x=32791, y=32334, z=10},12)
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--Beer--
elseif item.type == 3 then --Beer
if item2.uid == cid then
doPlayerSay(cid, "Aah...", 1)
doAddCondition(cid, drunk)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--Slime--
elseif item.type == 4 then --Slime
if item2.uid == cid then
doPlayerSay(cid, "Urgh!", 1)
doAddCondition(cid, poison)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--Lemonade--
elseif item.type == 5 then --Lemonade
if item2.uid == cid then
doPlayerSay(cid, "Mmmh.", 1)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--Milk--
elseif item.type == 6 then --Milk
if item2.uid == cid then
doPlayerSay(cid, "Mmmh.", 1)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--Mana--
elseif item.type == 7 then --Mana
if item2.uid == cid then
new_mana = math.random(40, 70)
doPlayerAddMana(cid, new_mana)
doSendMagicEffect(topos, 12)
doPlayerSay(cid, "Aaaah...", 1)
doAddCondition(cid, exhaust)
doChangeTypeItem(item.uid, 0)
DidUseMana(cid, frompos, topos)
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--???--
elseif item.type == 8 then -- ?.
doChangeTypeItem(item.uid, 0)
------
--???--
elseif item.type == 9 then --Water?.
doChangeTypeItem(item.uid, 0)
------
elseif item.type == 10 then --Life
if item2.uid == cid then
new_life = math.random(55, 105)
doPlayerAddHealth(cid, new_life)
doSendMagicEffect(topos, 12)
doPlayerSay(cid, "Aaaah...", 1)
doAddCondition(cid, exhaust)
doChangeTypeItem(item.uid, 0)
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--oil--
elseif item.type == 11 then --Oil
if item2.uid == cid then
doPlayerSay(cid, "Urgh!", 1)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--???--
elseif item.type == 12 then --Smile?.
doChangeTypeItem(item.uid, 0)
------
--Urine--
elseif item.type == 13 then --Urine
if item2.uid == cid then
doPlayerSay(cid, "Urgh!", 1)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
--???--
elseif item.type == 14 then -- ?.
doChangeTypeItem(item.uid, 0)
------
--Wine--
elseif item.type == 15 then --Wine
if item2.uid == cid then
doPlayerSay(cid, "Aah...", 1)
doAddCondition(cid, drunk)
if getPlayerStorageValue(cid, 253) == 1 and item.itemid == 2006 then
doRemoveItem(item.uid)
else
doChangeTypeItem(item.uid, 0)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash.uid)
end
------
end
return 1
end
Lua:
local ITEM_RUM_FLASK = 2006
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 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 exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 4)
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(hasCondition(cid, CONDITION_EXHAUST) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if(doComparePositions(getCreaturePosition(cid), toPosition))then
itemEx.uid = cid
end
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(not doPlayerAddMana(itemEx.uid, math.random(60, 90))) then
return false
end
doAddCondition(cid, exhaust)
doCreatureSay(itemEx.uid, "Aaaah...")
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
elseif(item.type == TYPE_LIFE_FLUID) then
if(not doCreatureAddHealth(itemEx.uid, math.random(55, 105))) then
return false
end
doAddCondition(cid, exhaust)
doCreatureSay(itemEx.uid, "Aaaah...")
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
elseif(isInArray(alcoholDrinks, item.type)) then
if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then
return false
end
doCreatureSay(cid, "Aaah...")
elseif(isInArray(poisonDrinks, item.type)) then
if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then
return false
end
doCreatureSay(cid, "Urgh!")
elseif(item.type == TYPE_LAVA) then
if(not doTargetCombatCondition(0, cid, burn, CONST_ME_NONE)) then
return false
end
doCreatureSay(cid, "Urgh!")
else
doCreatureSay(cid, "Gulp.")
end
doRemoveItem(item.uid, 1)
return true
end
if(not isCreature(itemEx.uid)) then
if(item.type == TYPE_EMPTY) then
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
if(item.type == TYPE_EMPTY) then
doPlayerSendCancel(cid, "It is empty.")
return true
end
doCreateItem(2025, item.type, toPosition)
doChangeTypeItem(item.uid, TYPE_EMPTY)
return true
end
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
function onUse(cid, item, frompos, item2, topos)
if(hasCondition(cid, CONDITION_EXHAUSTED) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if item2.itemid == 1 then
if item.type == 0 then
doPlayerSendCancel(cid, "It is empty.")
else
if item2.uid == cid then
doChangeTypeItem(item.uid, 0)
if item.type == 7 then
new_mana = math.random(80, 160)
doPlayerAddMana(cid, new_mana)
doSendMagicEffect(topos, 12)
doPlayerSay(cid, "Aaaah...", 1)
doAddCondition(cid, exhaust)
elseif item.type == 10 then
new_life = math.random(40, 80)
doPlayerAddHealth(cid, new_life)
doSendMagicEffect(topos, 12)
doPlayerSay(cid, "Aaaah...", 1)
else
doPlayerSay(cid, "Gulp.", 1)
end
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash)
end
end
elseif item2.itemid >= 490 and item2.itemid <= 517
or item2.itemid >= 618 and item2.itemid <= 629
or item2.itemid == 1368 or item2.itemid == 1369
or item2.itemid >= 4820 and item2.itemid <= 4825
or item2.itemid >= 4828 and item2.itemid <= 4831
or item2.itemid >= 4608 and item2.itemid <= 4666 then
doChangeTypeItem(item.uid, 1)
elseif item2.itemid == 103 then
doChangeTypeItem(item.uid, 19)
elseif item2.itemid >= 598 and item2.itemid < 601
or item2.itemid == 1509
or item2.itemid >= 518 and item2.itemid <= 529 then
doChangeTypeItem(item.uid, 26)
elseif item2.itemid >= 351 and item2.itemid <= 355 then
doChangeTypeItem(item.uid, 19)
elseif item2.itemid >= 602 and item2.itemid <= 605
or item2.itemid >= 4691 and item2.itemid <= 4755
or item2.itemid == 4758 then
doChangeTypeItem(item.uid, 28)
elseif item2.itemid == 1771 then
doChangeTypeItem(item.uid, 1)
elseif item2.itemid == 1772 then
doChangeTypeItem(item.uid, 3)
elseif item2.itemid == 1773 then
doChangeTypeItem(item.uid, 15)
elseif item2.itemid > 2806 and item2.itemid < 3132
or item2.itemid >= 4251 and item2.itemid <= 4327 then
doChangeTypeItem(item.uid, 2)
else
if item.type == 0 then
doPlayerSendCancel(cid, "It is empty.")
else
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
doDecayItem(splash)
end
end
return 1
end
I have 2 fluid lua's and a potion.lua posted.
Thanks for looking!
Post automatically merged:
This fixed it for me sorry people! I tried it before I posted but I put it in the wrong folder! xD
Try this one
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 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(doComparePositions(getCreaturePosition(cid), toPosition))then itemEx.uid = cid end 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(not doPlayerAddMana(itemEx.uid, math.random(40, 80))) then return false end doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER_SAY) doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) elseif(item.type == TYPE_LIFE_FLUID) then if(not doCreatureAddHealth(itemEx.uid, math.random(40, 80))) then return false end doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER_SAY) doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) elseif(isInArray(alcoholDrinks, item.type)) then if(not doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)) then return false end doCreatureSay(cid, "Aaah...", TALKTYPE_MONSTER_SAY) elseif(isInArray(poisonDrinks, item.type)) then if(not doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)) then return false end doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER_SAY) elseif(item.type == TYPE_LAVA) then if(not doTargetCombatCondition(0, cid, burn, CONST_ME_NONE)) then return false end doCreatureSay(cid, "Urgh!", TALKTYPE_MONSTER_SAY) else doCreatureSay(cid, "Gulp.", TALKTYPE_MONSTER_SAY) end doChangeTypeItem(item.uid, TYPE_EMPTY) return true end if(not isCreature(itemEx.uid)) then if(item.type == TYPE_EMPTY) then 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 if(item.type == TYPE_EMPTY) then doPlayerSendCancel(cid, "It is empty.") return true end doDecayItem(doCreateItem(POOL, item.type, toPosition)) doChangeTypeItem(item.uid, TYPE_EMPTY) return true end
Last edited: