JG
pedido

Potion Healando Por Lvl

Por JGNoya, 30 de dez. de 2013 em Scripts

resolvido
script
8
1.3k
JGNoyaJ
30 de dezembro de 2013 às 11:58

Alguém teria um script de potions que almenta o heal de acordo com o lvl do player por exemplo :

 

lvl 1k - heala 3k de mana

lvl 2k - heala 6k

E assim por diante ...

 

Se alguém tiver esse script me ajudaria muito , já tentei uns 2 scripts assim mas nenhum funcionou .

markindootM
30 de dezembro de 2013 às 13:01

function onUse(cid, item, fromPosition, itemEx, toPosition)
--- configuration by notle
local min = 1999 --- minimo que vai curar com menos 1000 de lvl
local max = 2000 --- maximo que vai curar com menos 1000 de lvl
local min300 = 3999 --- minimo que vai curar com lvl 2000
local max300 = 4000 --- maximo que vai curar com lvl 2000
local min500 = 5999 --- minimo que vai curar com lvl 3000
local max500 = 6000 --- maximo que vai curar com lvl 3000
local exhaust = 1100 -- Tempo para player poder se curar novamente! (1000 por segundos)
local lvl1,lvl2,lvl3 = 1999,2999,3000 -- modificação de level
--- configuration by notle
if (getPlayerStorageValue(cid, 14725) <= os.time()) then
if getPlayerLevel(cid) <= lvl1 then
doPlayerAddMana(itemEx.uid, math.random(min, max))
elseif getPlayerLevel(cid) >= lvl1+1 and getPlayerLevel(cid) <= lvl2 then
doPlayerAddMana(itemEx.uid, math.random(min300, max300))
elseif getPlayerLevel(cid) >= lvl3 then
doPlayerAddMana(itemEx.uid, math.random(min500, max500))
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 14722, os.time()+exhaust/1000)
else
doPlayerSendCancel(cid, "Desculpe, você só pode se curar novamente depois de "..exhaust.." segundos.")
end
end
end

lvl 1000 cura 1999 a 2000
lvl 2000 cura 3999 a 4000
lvl 3000 cura 5999 a 6000

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
--- configuration by notle
local config = {
level = 1000, min = 1000, max = 2000, -- fico mais facil pra vc editar :D
level2
= 2000, min2 = 3000, max2 = 4000, -- fico mais facil pra vc editar :D
level3
= 3000, min3 = 5000, max3 = 6000, -- fico mais facil pra vc editar :D
level4
= 4000, min4 = 7000, max4 = 8000} -- fico mais facil pra vc editar :D
local exhaust = 1100 -- Tempo para player poder se curar novamente! (1000 por segundos)
--- configuration by notle
if (getPlayerStorageValue(cid, 14725) <= os.time()) then
if getPlayerLevel(cid) <= config.level and doPlayerAddMana(itemEx.uid, math.random(config.min, config.max)) or getPlayerLevel(cid) <= config.level2 and doPlayerAddMana(itemEx.uid, math.random(config.min2, config.max2)) or getPlayerLevel(cid) <= config.level3 and doPlayerAddMana(itemEx.uid, math.random(config.min3, config.max3))or getPlayerLevel(cid) >= config.level4 and doPlayerAddMana(itemEx.uid, math.random(config.min4, config.max4)) then
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 14725, os.time()+exhaust/1000)
return true
end
end
end

 

ambos funcionam e apenas um é menor que o outro,

fica a seu critério qual usar.

 

 

OBS: na hora de coloca id do potion

tem que ver se não já tem em
actions.xml
se não vai da erro
pq ja vai ter ID ligados em outros arquivos
só tirar deixa só nesse novo.

MasterDinoM
30 de dezembro de 2013 às 13:12

Tenta ai:

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

function onUse(cid, item, fromPosition, itemEx, toPosition) 
if(not isPlayer(itemEx.uid)) then
return FALSE
end

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

doAddCondition(cid, exhaust)
doCreatureAddMana(itemEx.uid, math.random((getPlayerLevel(itemEx.uid)*3),(getPlayerLevel(itemEx.uid)*3)+100))
doSendMagicEffect(getThingPos(itemEx.uid), 5)
doCreatureSay(itemEx.uid, "I feel powerful!", TALKTYPE_ORANGE_1) 
doRemoveItem(item.uid, 1)
return TRUE 
end
JGNoyaJ
30 de dezembro de 2013 às 14:47

Eu testei aqui , mas não deu certo não , nem os scripts do marquindoot nem o do MasterDino '-'

MasterDinoM
30 de dezembro de 2013 às 20:41

Qual versao voce ta usando?

zipter98Z
30 de dezembro de 2013 às 22:29

Tenta esse aqui, se não funcionar e der erro no console, poste-o aqui.

 

function onUse(cid, item, frompos, item2, topos)
 
local cfg = {
    [3000] = 1000,     --[quanto vai healar] = lv mínimo necessário,
    [6000] = 3000,
}
 
local cfg_two = {
    has_exausted = true,    --Terá exausted? [true/sim] [false/não]
    exausted = 5,           --Se colocar true acima, configure o exausted aqui (em segundos).
}
 
local heal = {}
 
    for a, b in pairs(cfg) do
        if getPlayerLevel(cid) >= b then
            table.insert(heal, a)
        end
    end
    
    if cfg_two.has_exausted == true then
        if getPlayerStorageValue(cid, 91831) > os.time() then
            return doPlayerSendCancel(cid, "Wait some seconds to use this again.")
        end
    end
    
    doCreatureSay(cid, "Hmmm, now I feel better!", TALKTYPE_MONSTER)
    if cfg_two.has_exausted == true then
        setPlayerStorageValue(cid, 91831, os.time() + cfg_two.exausted)
    end
    doCreatureAddMana(cid, heal[math.random(#heal)])
    doRemoveItem(item.uid, 1)
    return true
end
JGNoyaJ
06 de janeiro de 2014 às 15:20

Já consegui arrumar aqui , podem fechar o tópico eu que coloquei errado o script do marquin '-'

zipter98Z
06 de janeiro de 2014 às 15:27

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