Ir para conteúdo
  • Cadastre-se

(Resolvido)Potions mostrar quantidade de heal


Ir para solução Resolvido por Storm,

Posts Recomendados

Boa noite galerinha do TK 

Venho mais uma vez pedir a ajuda de vcs sobre um script de potions

eu tenho um que mostra a quantidade que esta healando mas nao quero usar ele 

o que eu quero usar nao mostra a quantidade que esta healando 

alguem de coraçao bom pode me mostrar onde altero pra que ele mostre a quantidade de heal

 

script que mostra quanto ta healando

 

local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "yes",
range = -1,
area = {1, 1} -- if not set correctly, the message will be sent only to user of the item
}
 
local multiplier = {
health = 1.0,
mana = 1.0
}
 
local POTIONS = {
[8704] = {empty = 8704, splash = 42, rate = 0.5,}, -- small health potion
[7618] = {empty = 7618, splash = 42, rate = 0.5}, -- health potion
[7588] = {empty = 7588, splash = 42, rate = 1.0, level = 50, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7591, splash = 42, rate = 1.1, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 8473, splash = 42, rate = 1.3, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion


[7620] = {empty = 7620, splash = 47, rateMana = 0.2}, -- mana potion
[7589] = {empty = 7589, splash = 47, rateMana = 1.3, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7590, splash = 47, rateMana = 1.5, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion


[8472] = {empty = 8472, splash = 43, rate = 0.8, rateMana = 0.8, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion

}
 
for index, potion in pairs(POTIONS) do
if(type(index) == 'number')then
for k, v in pairs(config) do
if(not potion[k]) then
potion[k] = v
end
end
 
if(potion.removeOnUse) then
potion.removeOnUse = getBooleanFromString(potion.removeOnUse)
end
 
if(potion.usableOnTarget) then
potion.usableOnTarget = getBooleanFromString(potion.usableOnTarget)
end
 
if(potion.splashable) then
potion.splashable = getBooleanFromString(potion.splashable)
end
 
if(type(potion.health) == 'table' and table.maxn(potion.health) > 1) then
potion.health[1] = math.ceil(potion.health[1] * multiplier.health)
potion.health[2] = math.ceil(potion.health[2] * multiplier.health)
else
potion.health = nil
end
 
 
if(type(potion.mana) == 'table' and table.maxn(potion.mana) > 1) then
potion.mana[1] = math.ceil(potion.mana[1] * multiplier.mana)
potion.mana[2] = math.ceil(potion.mana[2] * multiplier.mana)
else
potion.mana = nil
end
 
POTIONS[index] = potion
end
end

--------------------------------
local exh_sto = 93939 -- Storage.
local exh_time = 0.5 -- Segundos.
--------------------------------

function onUse(cid, item, fromPosition, itemEx, toPosition)
--------------------------------
if getCreatureStorage(cid, exh_sto) > os.time() then
    return doPlayerSendCancel(cid, "Exhaustion!!")
end
--------------------------------

local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
 
if(not isPlayer(itemEx.uid) or (not potion.usableOnTarget and cid ~= itemEx.uid)) then
if(not potion.splashable or not potion.splash) then
return false
end
 
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPosition(item.uid)
end
 
 
return true
end
 
if(((potion.level and getPlayerLevel(itemEx.uid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(itemEx.uid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_MONSTER, false, cid)
return true
end
 
if(potion.range > 0 and cid ~= itemEx.uid and getDistanceBetween(getThingPosition(cid), getThingPosition(itemEx.uid)) > potion.range and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_CANUSEFAR)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_TOOFARAWAY)
return true
end
local playerlevel = getPlayerLevel(itemEx.uid)
 
if(potion.rateMana and not doTargetCombatMana(0, itemEx.uid, playerlevel*potion.rateMana, playerlevel*potion.rateMana, CONST_ME_MAGIC_BLUE)) then
return false
end
 
 
if(potion.rate and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, playerlevel*potion.rate, playerlevel*potion.rate, CONST_ME_MAGIC_BLUE)) then
return false
end

--------------------------------
doCreatureSetStorage(cid, exh_sto, exh_time+os.time())
--------------------------------

if(type(potion.area) == 'table' and table.maxn(potion.area) > 1) then
for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), potion.area[1], potion.area[2])) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER, false, tid)
end
end
else
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER, false, itemEx.uid)
if(itemEx.uid ~= cid) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER, false, cid)
end
end
 
return true
end

 

 

 

e aqui o que nao mostra quanto que esta healando 

 

 

local config = {
    removeOnUse = "false",
    usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
    splashable = "no",
    realAnimation = "yes", -- make text effect visible only for players in range 1x1
    healthMultiplier = 1.4,
    manaMultiplier = 1.7
}

local bonus = 1.15

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
    [8704] = {empty = 7636, splash = 2, percentHealth = 2, percentMana = 0, health = {50, 100}}, -- small health potion
    [7618] = {empty = 7636, splash = 2, percentHealth = 3, percentMana = 0, health = {250, 450}}, -- health potion
    [7588] = {empty = 7634, splash = 2, percentHealth = 4, percentMana = 0, health = {200, 400}, level = 1, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
    [7591] = {empty = 7635, splash = 2, percentHealth = 10, percentMana = 0, health = {500, 700}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
    [8473] = {empty = 7635, splash = 2, percentHealth = 14, percentMana = 0, health = {1250, 1490}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

    [7620] = {empty = 7636, splash = 7, percentHealth = 0, percentMana = 10, mana = {250, 400}, vocations = {4, 8, 12}, vocStr = "knights"}, -- mana potion
    [7589] = {empty = 7634, splash = 7, percentHealth = 0, percentMana = 4, mana = {110, 190}, level = 1, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
    [7590] = {empty = 7635, splash = 7, percentHealth = 0, percentMana = 8, mana = {855, 1030}, level = 1, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

    [8472] = {empty = 7635, splash = 3, percentMana = 6, percentHealth = 18, health = {1150, 1250}, mana = {415, 615}, level = 1, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = POTIONS[item.itemid]
    if(not potion) then
        return false
    end

    if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
        if(not config.splashable) then
            return false
        end

        if(toPosition.x == CONTAINER_POSITION) then
            toPosition = getThingPos(item.uid)
        end

        doDecayItem(doCreateItem(2016, potion.splash, toPosition))
        doTransformItem(item.uid, potion.empty)
        return true
    end

    if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
        not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
    then
        doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
    end

    local health = potion.health
    
    local added_health = math.ceil(((potion.percentHealth / 100) * getCreatureMaxHealth(cid) ) * config.healthMultiplier)
    added_health = potion.percentHealth == 0 and 0 or math.random(added_health - 80, added_health + 90)
    if(health and not doCreatureAddHealth(itemEx.uid, added_health)) then
        return false
    end

    local mana = potion.mana
    local added_mana = math.ceil(( (potion.percentMana / 100) * getCreatureMaxMana(cid) ) * config.manaMultiplier)
    added_mana = potion.percentMana == 0 and 0 or math.random(added_mana - 80, added_mana + 90)
    if(mana and not doPlayerAddMana(itemEx.uid, added_mana)) then
        return false
    end

    if isInArray({8704, 7618, 7588, 7591, 8473}, item.itemid) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 180)
    elseif isInArray({7620, 7589, 7590, 8472}, item.itemid) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 17)
    end
    doSendMagicEffect(getThingPos(itemEx.uid), 30)
    if realAnimation then
        for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
            if(isPlayer(tid)) then
            end
        end
    end

    doAddCondition(cid, exhaust)
    if(not potion.empty or config.removeOnUse) then
        doRemoveItem(item.uid, 1)
        return true
    end
end

 

alguem pode ajudar ??

 

e sim no config lua ja esta abilitado

 

 

image.png.159cf4929927068318376a42f5a4bff8.png

igual eu falei com o potions do primeiro script ele mostra helando normal a quantidade 

mas ja com o segundo ele so mostra o efeito " haaaa "

e nao mostra a quantidade que esta healando.

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

local config = {
    removeOnUse = "false",
    usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
    splashable = "no",
    realAnimation = "yes", -- make text effect visible only for players in range 1x1
    healthMultiplier = 1.4,
    manaMultiplier = 1.4
}

local bonus = 1.15

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
    [8704] = {empty = 7636, splash = 2, percentHealth = 2, percentMana = 0, health = {50, 100}}, -- small health potion
    [7618] = {empty = 7636, splash = 2, percentHealth = 3, percentMana = 0, health = {250, 450}}, -- health potion
    [7588] = {empty = 7634, splash = 2, percentHealth = 4, percentMana = 0, health = {200, 400}, level = 1, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
    [7591] = {empty = 7635, splash = 2, percentHealth = 10, percentMana = 0, health = {500, 700}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
    [8473] = {empty = 7635, splash = 2, percentHealth = 14, percentMana = 0, health = {1250, 1490}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

    [7620] = {empty = 7636, splash = 7, percentHealth = 0, percentMana = 10, mana = {250, 400}, vocations = {4, 8, 12}, vocStr = "knights"}, -- mana potion
    [7589] = {empty = 7634, splash = 7, percentHealth = 0, percentMana = 4, mana = {110, 190}, level = 1, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
    [7590] = {empty = 7635, splash = 7, percentHealth = 0, percentMana = 8, mana = {855, 1030}, level = 1, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

    [8472] = {empty = 7635, splash = 3, percentMana = 6, percentHealth = 18, health = {1150, 1250}, mana = {415, 615}, level = 1, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = POTIONS[item.itemid]
    if(not potion) then
        return false
    end

    if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
        if(not config.splashable) then
            return false
        end

        if(toPosition.x == CONTAINER_POSITION) then
            toPosition = getThingPos(item.uid)
        end

        doDecayItem(doCreateItem(2016, potion.splash, toPosition))
        doTransformItem(item.uid, potion.empty)
        return true
    end

    if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
        not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
    then
        doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
    end

    local health = potion.health
    
    local added_health = math.ceil(((potion.percentHealth / 100) * getCreatureMaxHealth(cid) ) * config.healthMultiplier)
    added_health = potion.percentHealth == 0 and 0 or math.random(added_health - 80, added_health + 90)
    if(health and not doCreatureAddHealth(itemEx.uid, added_health)) then
        return false
    end

    local mana = potion.mana
    local added_mana = math.ceil(( (potion.percentMana / 100) * getCreatureMaxMana(cid) ) * config.manaMultiplier)
    added_mana = potion.percentMana == 0 and 0 or math.random(added_mana - 80, added_mana + 90)
    if(mana and not doPlayerAddMana(itemEx.uid, added_mana)) then
        return false
    end

    if isInArray({8704, 7618, 7588, 7591, 8473}, item.itemid) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 180)
    elseif isInArray({7620, 7589, 7590, 8472}, item.itemid) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 17)
    end
    doSendMagicEffect(getThingPos(itemEx.uid), 30)
    if realAnimation then
        for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
            if(isPlayer(tid)) then
            end
        end
    end

    doAddCondition(cid, exhaust)
    if(not potion.empty or config.removeOnUse) then
        doRemoveItem(item.uid, 1)
        return true
    end
end

14 minutos atrás, Storm disse:

posta o código que não mostra o heal.

esse ai amigo @Sttorm

Link para o post
Compartilhar em outros sites
  • Solução

@mullino 

 

Spoiler

ocal config = {
    removeOnUse = "false",
    usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
    splashable = "no",
    realAnimation = "yes", -- make text effect visible only for players in range 1x1
    healthMultiplier = 1.4,
    manaMultiplier = 1.7
}

local bonus = 1.15

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
    [8704] = {empty = 7636, splash = 2, percentHealth = 2, percentMana = 0, health = {50, 100}}, -- small health potion
    [7618] = {empty = 7636, splash = 2, percentHealth = 3, percentMana = 0, health = {250, 450}}, -- health potion
    [7588] = {empty = 7634, splash = 2, percentHealth = 4, percentMana = 0, health = {200, 400}, level = 1, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
    [7591] = {empty = 7635, splash = 2, percentHealth = 10, percentMana = 0, health = {500, 700}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
    [8473] = {empty = 7635, splash = 2, percentHealth = 14, percentMana = 0, health = {1250, 1490}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion
    
    [7620] = {empty = 7636, splash = 7, percentHealth = 0, percentMana = 10, mana = {250, 400}, vocations = {4, 8, 12}, vocStr = "knights"}, -- mana potion
    [7589] = {empty = 7634, splash = 7, percentHealth = 0, percentMana = 4, mana = {110, 190}, level = 1, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
    [7590] = {empty = 7635, splash = 7, percentHealth = 0, percentMana = 8, mana = {855, 1030}, level = 1, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion
    
    [8472] = {empty = 7635, splash = 3, percentMana = 6, percentHealth = 18, health = {1150, 1250}, mana = {415, 615}, level = 1, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = POTIONS[item.itemid]
    if(not potion) then
        return false
    end
    
    if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
        if(not config.splashable) then
            return false
        end
        
        if(toPosition.x == CONTAINER_POSITION) then
            toPosition = getThingPos(item.uid)
        end
        
        doDecayItem(doCreateItem(2016, potion.splash, toPosition))
        doTransformItem(item.uid, potion.empty)
        return true
    end
    
    if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end
    
    if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
    not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
    then
        doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
    end
    
    local health = potion.health
    
    local added_health = math.ceil(((potion.percentHealth / 100) * getCreatureMaxHealth(cid) ) * config.healthMultiplier)
    added_health = potion.percentHealth == 0 and 0 or math.random(added_health - 80, added_health + 90)
    if(health and not doCreatureAddHealth(itemEx.uid, added_health)) then
        return false
    end
    
    local mana = potion.mana
    local added_mana = math.ceil(( (potion.percentMana / 100) * getCreatureMaxMana(cid) ) * config.manaMultiplier)
    added_mana = potion.percentMana == 0 and 0 or math.random(added_mana - 80, added_mana + 90)
    if(mana and not doPlayerAddMana(itemEx.uid, added_mana)) then
        return false
    end
    doSendMagicEffect(getThingPos(itemEx.uid), 30)
    if realAnimation then
        for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
            if(isPlayer(tid)) then
            end
        end
    end
    doSendAnimatedText(getCreaturePosition(cid), "+".. added_health .."", 180)
    doSendAnimatedText(getCreaturePosition(cid), "+".. added_mana .."", 5)
    doAddCondition(cid, exhaust)
    if(not potion.empty or config.removeOnUse) then
        doRemoveItem(item.uid, 1)
        return true
    end
end

 

 

Link para o post
Compartilhar em outros sites
7 minutos atrás, Storm disse:

@Sttorm 

muito obrigado mano funcionou certinho como sempre os seus codigos 

me ajudou bastante.. sem palavras para agradecer... 

obrigado mesmo irmao

 

Link para o post
Compartilhar em outros sites
17 minutos atrás, Yinz disse:

achei que fosse só adicionar no cfg lua showHealingDamage

Já está add mas não mostrava 

Mostrava sim no serve log 

Não saia de cima do player a quantidade

Link para o post
Compartilhar em outros sites
57 minutos atrás, mullino disse:

Já está add mas não mostrava 

Mostrava sim no serve log 

Não saia de cima do player a quantidade

 

pode crê, bom que tu conseguiu com a ajuda do storm, no meu funcionou, deve ser a função das sources.

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