Ir para conteúdo
  • Cadastre-se

(Resolvido)Problema, pote vazia não some


Ir para solução Resolvido por klipstyle,

Posts Recomendados

E ai pessoal, estou mais uma vez precisando de ajuda de vocês.

 

Apos usar as potes de hp e mana inves de sumir elas estão ficando na backpack vazias. Queria saber se alguem pode me ajudar com isso por favor?

 

fluids script

-- TODO: Rewrite this script using fluidtypes from LIQUIDS doc-file,

--      and correct itemid's to recieve the liquids.
 
local drunk = Condition(CONDITION_DRUNK)
    drunk:setParameter(CONDITION_PARAM_TICKS, 60000)
 
local poison = Condition(CONDITION_POISON)
    poison:setParameter(CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
    poison:setParameter(CONDITION_PARAM_MINVALUE, -50) -- Minimum damage the condition can do at total
    poison:setParameter(CONDITION_PARAM_MAXVALUE, -120) -- Maximum damage
    poison:setParameter(CONDITION_PARAM_STARTVALUE, -5) -- The damage the condition will do on the first hit
    poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 4000) -- Delay between damages
    poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)
 
local fluidType = {3, 4, 5, 7, 10, 11, 13, 15, 19, 43}
local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Aah...", "Urgh!", "Aaaah..."}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local iex = Item(itemEx.uid)
local i = Item(item.uid)
local p = Player(cid)
local ie = ItemType(itemEx.itemid)
    if ie:isFluidContainer() and itemEx.type == 0 then
        iex:transform(itemEx.itemid, item.type)
        i:transform(item.itemid, 0)
        return true
    end
    if ie:isFluidContainer() and item.type == 0 then
        iex:transform(itemEx.itemid, 0)
        i:transform(item.itemid, itemEx.type)
        return true
    end
 
    if itemEx.itemid == 1 then
        if item.type == 0 then
            p:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        elseif itemEx.uid == cid then
            i:transform(item.itemid, 0)
            if item.type == 3 or item.type == 15 or item.type == 43 then
p:addCondition(drunk)
            elseif item.type == 4 then
                p:addCondition(poison)
            elseif item.type == 7 then
                p:addMana(math.random(50, 150))
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item.type == 10 then
                p:addHealth(60)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            for i = 0, #fluidType do
                if item.type == fluidType then
                    p:say(fluidMessage, TALKTYPE_ORANGE_1)
                    return true
                end
            end
            p:say("Gulp.", TALKTYPE_ORANGE_1)
        else
            i:transform(item.itemid, 0)
            Game.createItem(2016, item.type, toPosition):decay()
        end
    else
        local fluidSource = ie:getFluidSource()
        if fluidSource ~= 0 then
            i:transform(item.itemid, fluidSource)
        elseif item.type == 0 then
            p:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = p:getPosition()
            end
            i:transform(item.itemid, 0)
            Game.createItem(2016, item.type, toPosition):decay()
        end
    end
    return true
end
 

 

potions script

local config = {

-- strong health potion
[7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50, emptyId = 7634},
-- strong mana potion
[7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50, emptyId = 7634},
-- great mana potion
[7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80, emptyId = 7635},
-- great health potion
[7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80, emptyId = 7635},
-- health potion potion
[7618] = {health = {125, 175}, emptyId = 7636},
-- mana potion potion
[7620] = {mana = {75, 125}, emptyId = 7636},
-- great spirit potion
[8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80, emptyId = 7635},
-- ultimate health potion
[8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130, emptyId = 7635},
-- antidote potion
[8474] = {antidote = true, emptyId = 7636},
-- small health potion
[8704] = {health = {60, 85}, emptyId = 7636}
}
 
local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)
 
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 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)
local potion = config[item.itemid]
if not potion then
return true
end
 
if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
return true
end
 
local player = Player(cid)
if player:getCondition(CONDITION_EXHAUST_HEAL) then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return true
end
 
if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then
return false
end
 
if (potion.level and player:getLevel() < potion.level)
or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId()))
and not (player:getGroup():getId() >= 2) then
player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY)
return true
end
 
if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then
return false
end
 
if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then
return false
end
 
local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict)
if cStorage < 100000 then
player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1)
elseif cStorage == 100000 then
player:addAchievement('Potion Addict')
player:setStorageValue(Storage.Achievements.PotionAddict, 100001)
end
 
doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition)
setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1)
Item(item.uid):remove(1)
doPlayerAddItem(cid,potion.emptyId, 1)
return true

end

 

Agradeço desde já.

 

Link para o post
Compartilhar em outros sites

Tente assim:

 

-- TODO: Rewrite this script using fluidtypes from LIQUIDS doc-file,

 

--      and correct itemid's to recieve the liquids.
 
local drunk = Condition(CONDITION_DRUNK)
    drunk:setParameter(CONDITION_PARAM_TICKS, 60000)
 
local poison = Condition(CONDITION_POISON)
    poison:setParameter(CONDITION_PARAM_DELAYED, true) -- Condition will delay the first damage from when it's added
    poison:setParameter(CONDITION_PARAM_MINVALUE, -50) -- Minimum damage the condition can do at total
    poison:setParameter(CONDITION_PARAM_MAXVALUE, -120) -- Maximum damage
    poison:setParameter(CONDITION_PARAM_STARTVALUE, -5) -- The damage the condition will do on the first hit
    poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 4000) -- Delay between damages
    poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true) -- Re-update condition when adding it(ie. min/max value)
 
local fluidType = {3, 4, 5, 7, 10, 11, 13, 15, 19, 43}
local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Aah...", "Urgh!", "Aaaah..."}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local iex = Item(itemEx.uid)
local i = Item(item.uid)
local p = Player(cid)
local ie = ItemType(itemEx.itemid)
    if ie:isFluidContainer() and itemEx.type == 0 then
        iex:transform(itemEx.itemid, item.type)
        i:transform(item.itemid, 0)
        return true
    end
    if ie:isFluidContainer() and item.type == 0 then
        iex:transform(itemEx.itemid, 0)
        i:transform(item.itemid, itemEx.type)
        return true
    end
 
    if itemEx.itemid == 1 then
        if item.type == 0 then
            p:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        elseif itemEx.uid == cid then
            i:transform(item.itemid, 0)
            if item.type == 3 or item.type == 15 or item.type == 43 then
p:addCondition(drunk)
            elseif item.type == 4 then
                p:addCondition(poison)
            elseif item.type == 7 then
                p:addMana(math.random(50, 150))
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item.type == 10 then
                p:addHealth(60)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            for i = 0, #fluidType do
                if item.type == fluidType then
                    p:say(fluidMessage, TALKTYPE_ORANGE_1)
                    return true
                end
            end
            p:say("Gulp.", TALKTYPE_ORANGE_1)
        else
            Item(item.uid):remove(1)
            Game.createItem(2016, item.type, toPosition):decay()
        end
    else
        local fluidSource = ie:getFluidSource()
        if fluidSource ~= 0 then
            i:transform(item.itemid, fluidSource)
        elseif item.type == 0 then
            p:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = p:getPosition()
            end
            Item(item.uid):remove(1)
         
        end
    end
    return true
end

 
potions.lua
 

local config = {

 

-- strong health potion
[7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50, emptyId = 7634},
-- strong mana potion
[7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50, emptyId = 7634},
-- great mana potion
[7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80, emptyId = 7635},
-- great health potion
[7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80, emptyId = 7635},
-- health potion potion
[7618] = {health = {125, 175}, emptyId = 7636},
-- mana potion potion
[7620] = {mana = {75, 125}, emptyId = 7636},
-- great spirit potion
[8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80, emptyId = 7635},
-- ultimate health potion
[8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130, emptyId = 7635},
-- antidote potion
[8474] = {antidote = true, emptyId = 7636},
-- small health potion
[8704] = {health = {60, 85}, emptyId = 7636}
}
 
local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)
 
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 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)
local potion = config[item.itemid]
if not potion then
return true
end
 
if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
return true
end
 
local player = Player(cid)
if player:getCondition(CONDITION_EXHAUST_HEAL) then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return true
end
 
if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then
return false
end
 
if (potion.level and player:getLevel() < potion.level)
or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId()))
and not (player:getGroup():getId() >= 2) then
player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY)
return true
end
 
if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then
return false
end
 
if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then
return false
end
 
local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict)
if cStorage < 100000 then
player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1)
elseif cStorage == 100000 then
player:addAchievement('Potion Addict')
player:setStorageValue(Storage.Achievements.PotionAddict, 100001)
end
 
doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition)
setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1)
Item(item.uid):remove(1)
return true

end

Editado por smowking (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

amigo simplesmente remova a seguinte linha do arquivo potions.

 

doPlayerAddItem(cid,potion.emptyId, 1)

 

ou caso queira testar antes de sair apagando adicione -- na frente da linha

 

--doPlayerAddItem(cid,potion.emptyId, 1)

www.pokemiw.com
24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo