FJ
pedido

Regen constante

Por Fjinst, 30 de jun. de 2015 em Scripts

resolvido
script
20
3.8k
FjinstF
30 de junho de 2015 às 19:37

Troquei o

 

<event type="login" name="regen" event="script" value="regen.lua"/>

 

por

<event type="think" name="regen" event="script" value="regen.lua"/>

 

com esse script que você passou

 

agora quando o player loga, fica curando sem exhaust varias vezes

 

 

 

Sobre o bug que falei é que se o player logar, e logar denovo ele cura, ignorando o exhaust do jogo, não é que o script buga e fica curando varias vezes, e sim cada vez que o player logar vai curar, ou seja da para os espertinhos ficarem logando e deslogando só pra burlar o exhaust do script

 

Desculpe por não ter explicado claramente

 

 

Acho que tive uma idéia, tem como você criar um creaturescripts que assim que o player loga fica com battle por 3 segundos? assim evitaria isso

Editado Junho 30 por Fjinst

RigByR
30 de junho de 2015 às 20:25

Acho que seria melhor fazer um globalevent mas ta ai do jeito que você quer.

 

function doDoT(cid)
    local a = {
        {levelMin = 0, levelMax = 10, heal = 1}, 
        {levelMin = 11, levelMax = 20, heal = 4},
        {levelMin = 21, levelMax = math.huge, heal = 20},
}
    if not isCreature(cid) then
        return false
    end
    if getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
        for _, b in pairs(a) do
            if getPlayerLevel(cid) >= b.levelMin and getPlayerLevel(cid) <= b.levelMax then
                doCreatureAddHealth(cid, b.heal)
                addEvent(doDoT, 2000, cid)
            end
        end
    end
return true
end
 
function onLogin(cid)
    local condition_infight = createConditionObject(CONDITION_INFIGHT)
    setConditionParam(condition_infight, CONDITION_PARAM_TICKS, 3 * 1000)
    doAddCondition(cid, condition_infight)
    doDoT(cid)
return true
end
FjinstF
01 de julho de 2015 às 09:31
[01/07/2015 09:30:01] [Error - CreatureScript Interface]

[01/07/2015 09:30:01] data/creaturescripts/scripts/passiva/hp.lua:onLogin

[01/07/2015 09:30:01] Description:

[01/07/2015 09:30:01] (luaDoAddCondition) Condition not found

RigByR
01 de julho de 2015 às 09:52
Melhor resposta

Pronto agora ta totalmente funcional, não vai ter nenhum bug assim.

onThink, em exaust você coloca o tempo entre cada heal

 

function doDoT(cid)
local exaust = 2 -- tempo entre cada heal
    local a = {
        {levelMin = 0, levelMax = 10, heal = 1}, 
        {levelMin = 11, levelMax = 20, heal = 4},
        {levelMin = 21, levelMax = math.huge, heal = 20},
}
    if not isCreature(cid) then
        return false
    end
    if getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
        for _, b in pairs(a) do
            if getPlayerLevel(cid) >= b.levelMin and getPlayerLevel(cid) <= b.levelMax then
                if getPlayerStorageValue(cid, 83742397438247932) < os.time() then
                    doCreatureAddHealth(cid, b.heal)
                    addEvent(doDoT, exaust*1000, cid)
                    setPlayerStorageValue(cid, 83742397438247932, os.time() + exaust - 1)
                end
            end
        end
    end
return true
end
 
function onThink(cid, interval)
    doDoT(cid)
return true
end
BrunoB
01 de julho de 2015 às 21:04

Tópico movido para a seção de dúvidas e pedidos resolvidos.