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

[HELP] health pots

zyirc

New Member
Joined
Jul 15, 2008
Messages
175
Reaction score
0
Location
Sweden
I wanted to make that vials disappears but for some reason

Health pots
Great health pots
Ultimate health pots does not disappears

only
Mana pot
Strong mana
great mana
Strong health pots Works

Any Clue?

Potions.lua

local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.uid ~= cid or itemEx.itemid ~= 1) then
return TRUE
end

if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end

if(item.itemid == antidotePot) then
if(doCombat(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid,emptyPot)
elseif(item.itemid == smallHealthPot) then
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 50, 100, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, emptyPot)
elseif(item.itemid == healthPot) then
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveiTem(item.uid,emptyPot)
elseif(item.itemid == manaPot) then
if(doTargetCombatMana(0, cid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, emptyPot)
elseif(item.itemid == strongHealthPot) then
if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
return TRUE
end

if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid,strongEmptyPot)
elseif(item.itemid == strongManaPot) then
if(not(isSorcerer(cid) or isDruid(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by sorcerers, druids and paladins of level 50 or higher.", TALKTYPE_ORANGE_1)
return TRUE
end

if(doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid,strongEmptyPot)
elseif(item.itemid == greatSpiritPot) then
if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
return TRUE
end

if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid,greatEmptyPot)
elseif(item.itemid == greatHealthPot) then
if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
return TRUE
end

if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemove(item.uid,greatEmptyPot)
elseif(item.itemid == greatManaPot) then
if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
return TRUE
end

if(doTargetCombatMana(0, cid, 200, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid,greatEmptyPot)
elseif(item.itemid == ultimateHealthPot) then
if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
return TRUE
end

if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 800, 1000, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doAddCondition(cid, exhaust)
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doremoveItem(item.uid,greatEmptyPot)
end
return TRUE
end
 
doRemoveiTem(item.uid,emptyPot)
doremoveItem()

... these are case sensitive - that's the first thing, the right way to go is doRemoveItem(item.uid) - you don't need any other params.
 
doRemoveiTem(item.uid,emptyPot)
doremoveItem()

... these are case sensitive - that's the first thing, the right way to go is doRemoveItem(item.uid) - you don't need any other params.

I added doRemoveItem(item.uid)

i didnt work ..

EDIT: Its like Forever Strong healths thats problem -.-
 
Code:
local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636
 
local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)
 
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(itemEx.uid ~= cid or itemEx.itemid ~= 1) then
        return TRUE
    end
 
    if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return TRUE
    end
 
    if(item.itemid == antidotePot) then
        if(doCombat(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == smallHealthPot) then
        if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 50, 100, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == healthPot) then
        if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == manaPot) then
        if(doTargetCombatMana(0, cid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == strongHealthPot) then
        if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end
 
        if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == strongManaPot) then
if(not(isSorcerer(cid) or isDruid(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
doCreatureSay(cid, "This potion can only be consumed by sorcerers, druids and paladins of level 50 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end
 
        if(doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == greatSpiritPot) then
        if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end
 
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == greatHealthPot) then
        if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end
 
        if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == greatManaPot) then
        if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end
 
        if(doTargetCombatMana(0, cid, 200, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    elseif(item.itemid == ultimateHealthPot) then
        if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 2) then
            doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
            return TRUE
        end
 
        if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 800, 1000, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
            return FALSE
        end
        doAddCondition(cid, exhaust)
        doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid)
    end
    return TRUE
end

Try this instead
 
Code:
local ultimatehealthpot = 8473
local greathealthpot = 7591
local greatmanapot = 7590
local greatspiritpot = 8472
local stronghealthpot = 7588
local strongmanapot = 7589
local healthpot = 7618
local manapot = 7620
local smallhealthpot = 8704
local antidotepot = 8474
local greatemptypot = 7635
local strongemptypot = 7634
local emptypot = 7636
 
local antidote = createcombatobject()
setcombatparam(antidote, combat_param_type, combat_healing)
setcombatparam(antidote, combat_param_effect, const_me_magic_blue)
setcombatparam(antidote, combat_param_targetcasterortopmost, true)
setcombatparam(antidote, combat_param_aggressive, false)
setcombatparam(antidote, combat_param_dispel, condition_poison)
 
local exhaust = createconditionobject(condition_exhaust_heal)
setconditionparam(exhaust, condition_param_ticks, (getconfiginfo('timebetweenexactions') - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
 
Function onuse(cid, item, fromposition, itemex, toposition)
    if(itemex.uid ~= cid or itemex.itemid ~= 1) then
        return true
    end
 
    if(getcreaturecondition(cid, condition_exhaust_heal) == true) then
        doplayersenddefaultcancel(cid, returnvalue_youareexhausted)
        return true
    end
 
    if(item.itemid == antidotepot) then
        if(docombat(cid, antidote, numbertovariant(cid)) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == smallhealthpot) then
        if(dotargetcombathealth(0, cid, combat_healing, 50, 100, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == healthpot) then
        if(dotargetcombathealth(0, cid, combat_healing, 100, 200, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == manapot) then
        if(dotargetcombatmana(0, cid, 70, 130, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == stronghealthpot) then
        if(not(isknight(cid) or ispaladin(cid)) or (getplayerlevel(cid) < 50)) and not(getplayergroupid(cid) >= 2) then
            docreaturesay(cid, "this potion can only be consumed by paladins and knights of level 50 or higher.", talktype_orange_1)
            return true
        end
 
        if(dotargetcombathealth(0, cid, combat_healing, 200, 400, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == strongmanapot) then
if(not(issorcerer(cid) or isdruid(cid) or ispaladin(cid)) or (getplayerlevel(cid) < 50)) and not(getplayergroupid(cid) >= 2) then
docreaturesay(cid, "this potion can only be consumed by sorcerers, druids and paladins of level 50 or higher.", talktype_orange_1)
            return true
        end
 
        if(dotargetcombatmana(0, cid, 110, 190, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == greatspiritpot) then
        if(not(ispaladin(cid)) or (getplayerlevel(cid) < 80)) and not(getplayergroupid(cid) >= 2) then
            docreaturesay(cid, "this potion can only be consumed by paladins of level 80 or higher.", talktype_orange_1)
            return true
        end
 
if(dotargetcombathealth(0, cid, combat_healing, 200, 400, const_me_magic_blue) == lua_error or dotargetcombatmana(0, cid, 110, 190, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == greathealthpot) then
        if(not(isknight(cid)) or (getplayerlevel(cid) < 80)) and not(getplayergroupid(cid) >= 2) then
            docreaturesay(cid, "this potion can only be consumed by knights of level 80 or higher.", talktype_orange_1)
            return true
        end
 
        if(dotargetcombathealth(0, cid, combat_healing, 500, 700, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == greatmanapot) then
        if(not(issorcerer(cid) or isdruid(cid)) or (getplayerlevel(cid) < 80)) and not(getplayergroupid(cid) >= 2) then
            docreaturesay(cid, "this potion can only be consumed by sorcerers and druids of level 80 or higher.", talktype_orange_1)
            return true
        end
 
        if(dotargetcombatmana(0, cid, 200, 300, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    elseif(item.itemid == ultimatehealthpot) then
        if(not(isknight(cid)) or (getplayerlevel(cid) < 130)) and not(getplayergroupid(cid) >= 2) then
            docreaturesay(cid, "this potion can only be consumed by knights of level 130 or higher.", talktype_orange_1)
            return true
        end
 
        if(dotargetcombathealth(0, cid, combat_healing, 800, 1000, const_me_magic_blue) == lua_error) then
            return false
        end
        doaddcondition(cid, exhaust)
        docreaturesay(cid, "aaaah...", talktype_orange_1)
        doremoveitem(item.uid)
    end
    return true
end

try this instead


thanks :d rep +++
 
Back
Top