function doHealOverTime(cid, div, turn, effect) --alterado v1.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 = {
[1456] = {effect = 13, div = 235}, --super potion
[1451] = {effect = 13, div = 330}, --great potion
[384] = {effect = 12, div = 550}, --ultra potion
[385] = {effect = 14, div = 750}, --hyper potion
[392] = {effect = 14, div = 900}, --full restore
[667] = {effect = 14, div = 1200}, --full restore
[668] = {effect = 14, div = 1350}, --full restore
[669] = {effect = 14, div = 1600}, --full restore
[670] = {effect = 14, div = 1710}, --full restore
[671] = {effect = 14, div = 2280}, --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
doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_MONSTER)
doSendMagicEffect(getThingPos(pid), 0)
setPlayerStorageValue(pid, 173, 1)
doRemoveItem(item.uid, 1)
local a = potions[item.itemid]
doHealOverTime(pid, a.div, 100, a.effect)
return true
end
Queria um sistema assim so que fazendo aquela função de cima que ta no nome do post
Pergunta
kamus9629 8
function doHealOverTime(cid, div, turn, effect) --alterado v1.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 = { [1456] = {effect = 13, div = 235}, --super potion [1451] = {effect = 13, div = 330}, --great potion [384] = {effect = 12, div = 550}, --ultra potion [385] = {effect = 14, div = 750}, --hyper potion [392] = {effect = 14, div = 900}, --full restore [667] = {effect = 14, div = 1200}, --full restore [668] = {effect = 14, div = 1350}, --full restore [669] = {effect = 14, div = 1600}, --full restore [670] = {effect = 14, div = 1710}, --full restore [671] = {effect = 14, div = 2280}, --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 doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_MONSTER) doSendMagicEffect(getThingPos(pid), 0) setPlayerStorageValue(pid, 173, 1) doRemoveItem(item.uid, 1) local a = potions[item.itemid] doHealOverTime(pid, a.div, 100, a.effect) return true end
Queria um sistema assim so que fazendo aquela função de cima que ta no nome do post
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados