Ir para conteúdo
  • 0

Preciso de Potion instantâneo.


eliaspalermo

Pergunta

Olá Boa noite.

Queria que esses potions recuperassem instantaneamente e tivessem um delay de 10 segundos de uso. Se alguém puder me ajudar ><

Citar

function doHealOverTime(cid, div, turn, effect)                     --alterado v2.6 peguem o script todo!!
if not isCreature(cid) then return true end

if turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then 
   setPlayerStorageValue(cid, 173, -1)
   return true 
end

local d = div / 10000
local amount = math.floor(getCreatureMaxHealth(cid) * d)
doCreatureAddHealth(cid, amount)
if math.floor(turn/10) == turn/10 then
   doSendMagicEffect(getThingPos(cid), effect)
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
end

local potions = {
[12347] = {effect = 13, div = 15}, --Small Recovery
[12348] = {effect = 13, div = 30}, --Medium Recovery              
[12346] = {effect = 12, div = 60}, --Large Recovery
[12345] = {effect = 14, div = 100}, --Super Recovery
}

function onUse(cid, item, frompos, item2, topos)
local pid = getThingFromPosWithProtect(topos)

if getCreatureMaster(pid) ~= cid then
return doPlayerSendCancel(cid, "Recovery e compativel apenas com o Digimon!")
end

if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then
return doPlayerSendCancel(cid, "Este Digimon ja esta com a vida totalmente cheia.")
end

if getPlayerStorageValue(pid, 173) >= 1 then
return doPlayerSendCancel(cid, "Este Digimon ja esta sob uso do Recovery.")
end

if getPlayerStorageValue(cid, 52481) >= 1 then
return doPlayerSendCancel(cid, "Voce nao pode usar Potion quando estiver no duelo.")
end
 
doCreatureSay(cid, ""..getCreatureName(pid)..", Pegue o Recovery!", TALKTYPE_SAY)
doSendMagicEffect(getThingPos(pid), 0)
setPlayerStorageValue(pid, 173, 1)
doRemoveItem(item.uid, 1)

local a = potions[item.itemid]
doHealOverTime(pid, a.div, 100, a.effect)
doSendAnimatedText(getThingPos(item2.uid), "RECOVERY!", 205)

return true
end

 

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0
function doHealOverTime(cid, div, turn, effect)                    


		
if not isCreature(cid) then return true end

if turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then 
   setPlayerStorageValue(cid, 173, -1)
   return true 
end

local d = div / 10000
local amount = math.floor(getCreatureMaxHealth(cid) * d)
doCreatureAddHealth(cid, amount)
if math.floor(turn/10) == turn/10 then
   doSendMagicEffect(getThingPos(cid), effect)
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
end

local potions = {
[12347] = {effect = 13, div = 30}, --super potion
[12348] = {effect = 13, div = 60}, --great potion              
[12346] = {effect = 12, div = 80}, --ultra potion
[12345] = {effect = 14, div = 90}, --hyper potion
[12343] = {effect = 14, div = 110}, --full restore
}

function onUse(cid, item, frompos, item2, topos)
local pid = getThingFromPosWithProtect(topos)

if not isSummon(pid) or getCreatureMaster(pid) ~= cid then
return doPlayerSendCancel(cid, "You can only use potions on your own Pokemons!")
end

if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then
return doPlayerSendCancel(cid, "This pokemon is already at full health.")
end

if getPlayerStorageValue(pid, 173) >= 1 then
return doPlayerSendCancel(cid, "This pokemon is already under effects of potions.")
end

if getPlayerStorageValue(cid, 52481) >= 1 then
return doPlayerSendCancel(cid, "You can't do that while a duel.")
end

if getPlayerStorageValue(cid, 990) >= 1 then
   doPlayerSendCancel(cid, "You can't use rpotion during gym battles.")
   return true
end



local cd = {
cdtime = 30, -- TEMPO EM SEGUNDO PARA PODER USAR O ITEM 30 = 30 SEGUNDOS !
str = 69889, -- NÃO MEXA
}
if getPlayerStorageValue(cid, cd.str) < os.time() then
doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_MONSTER)
doSendMagicEffect(getThingPos(pid), 0)
setPlayerStorageValue(cid, cd.str, os.time() + cd.cdtime)
setPlayerStorageValue(pid, 173, 1)
doRemoveItem(item.uid, 1)

local a = potions[item.itemid]
doHealOverTime(pid, a.div, 100, a.effect)

elseif getPlayerStorageValue(cid, cd.str) >= os.time() then
doPlayerSendCancel(cid, "espere para usar novamente")

return true
end
end

 

Link para o comentário
Compartilhar em outros sites

  • 0
3 horas atrás, Kuro o Shiniga disse:

function doHealOverTime(cid, div, turn, effect)                    


		
if not isCreature(cid) then return true end

if turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then 
   setPlayerStorageValue(cid, 173, -1)
   return true 
end

local d = div / 10000
local amount = math.floor(getCreatureMaxHealth(cid) * d)
doCreatureAddHealth(cid, amount)
if math.floor(turn/10) == turn/10 then
   doSendMagicEffect(getThingPos(cid), effect)
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
end

local potions = {
[12347] = {effect = 13, div = 30}, --super potion
[12348] = {effect = 13, div = 60}, --great potion              
[12346] = {effect = 12, div = 80}, --ultra potion
[12345] = {effect = 14, div = 90}, --hyper potion
[12343] = {effect = 14, div = 110}, --full restore
}

function onUse(cid, item, frompos, item2, topos)
local pid = getThingFromPosWithProtect(topos)

if not isSummon(pid) or getCreatureMaster(pid) ~= cid then
return doPlayerSendCancel(cid, "You can only use potions on your own Pokemons!")
end

if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then
return doPlayerSendCancel(cid, "This pokemon is already at full health.")
end

if getPlayerStorageValue(pid, 173) >= 1 then
return doPlayerSendCancel(cid, "This pokemon is already under effects of potions.")
end

if getPlayerStorageValue(cid, 52481) >= 1 then
return doPlayerSendCancel(cid, "You can't do that while a duel.")
end

if getPlayerStorageValue(cid, 990) >= 1 then
   doPlayerSendCancel(cid, "You can't use rpotion during gym battles.")
   return true
end



local cd = {
cdtime = 30, -- TEMPO EM SEGUNDO PARA PODER USAR O ITEM 30 = 30 SEGUNDOS !
str = 69889, -- NÃO MEXA
}
if getPlayerStorageValue(cid, cd.str) < os.time() then
doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_MONSTER)
doSendMagicEffect(getThingPos(pid), 0)
setPlayerStorageValue(cid, cd.str, os.time() + cd.cdtime)
setPlayerStorageValue(pid, 173, 1)
doRemoveItem(item.uid, 1)

local a = potions[item.itemid]
doHealOverTime(pid, a.div, 100, a.effect)

elseif getPlayerStorageValue(cid, cd.str) >= os.time() then
doPlayerSendCancel(cid, "espere para usar novamente")

return true
end
end

 

Opa amigo obrigado, só que ainda não está curando instantaneamente e quando em batalha da lost heal e cancela a cura.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...