Eu quero uma poção que cura uma porcentagem de exemplo
que cura o pokémon de 10.000, mas que cura por segundo de 1000. até atingir 10.000
Eu quero uma poção que cura uma porcentagem de exemplo
que cura o pokémon de 10.000, mas que cura por segundo de 1000. até atingir 10.000
Em 22/03/2021 em 18:57, KaboFlow disse:Versão do Servidor: TFS - 1.0Tipo de Script: actionsCódigo:function doHealOverTime(cid, hp, effect) if not isCreature(cid) then return true end doSendMagicEffect(getThingPos(cid), effect) doCreatureAddHealth(cid, math.floor(hp)) end local potions = { [12347] = {effect = 14, hp = 120}, --super potion [12348] = {effect = 14, hp = 300}, --great potion [12346] = {effect = 14, hp = 800}, --ultra potion [12345] = {effect = 14, hp = 2000}, --hyper potion [7588] = {effect = 14, hp = 6000}, -- 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 setPlayerStorageValue(pid, 173, -1) 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 potion 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.hp, a.effect) doPlayerSendCancel(cid, "Your monsters recovered " ..a.hp.. " of HP.") return true endEu quero uma poção que cura uma porcentagem de exemplo
que cura o pokémon de 10.000, mas que cura por segundo de 1000. até atingir 10.000
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSau(cid, "Healing..."), addEvent(HealPerTurn, duration, cid, health, effect, time, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid], potions[item.itemid].effect, vezes_repete, segundos) return true end
Substitua o código por esse e mude os id das potions na tabela e as respectivas vida e efeito de cada potion. Deixei todas as variáveis comentadas, só mudar os valores na tabela de potions que está tudo pronto.
15 horas atrás, Yan18 disse:local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSau(cid, "Healing..."), addEvent(HealPerTurn, duration, cid, health, effect, time, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid], potions[item.itemid].effect, vezes_repete, segundos) return true end
Substitua o código por esse e mude os id das potions na tabela e as respectivas vida e efeito de cada potion. Deixei todas as variáveis comentadas, só mudar os valores na tabela de potions que está tudo pronto.
salve error , removi a ,,,,,
[31/03/2021 12:13:43] [Error - LuaScriptInterface::loadFile] data/actions/scripts/potion/potion.lua:19: unexpected symbol near ','
[31/03/2021 12:13:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/potion/potion.lua)
[31/03/2021 12:13:43] data/actions/scripts/potion/potion.lua:19: unexpected symbol near ','
agora ta com error
[31/03/2021 12:16:35] [Error - Action Interface]
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:onUse
[31/03/2021 12:16:35] Description:
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:17: attempt to compare number with table
[31/03/2021 12:16:35] stack traceback:
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:17: in function 'HealPerTurn'
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:64: in function <data/actions/scripts/potion/potion.lua:41>
2 horas atrás, KaboFlow disse:
salve error , removi a ,,,,,
[31/03/2021 12:13:43] [Error - LuaScriptInterface::loadFile] data/actions/scripts/potion/potion.lua:19: unexpected symbol near ','
[31/03/2021 12:13:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/potion/potion.lua)
[31/03/2021 12:13:43] data/actions/scripts/potion/potion.lua:19: unexpected symbol near ','
agora ta com error
[31/03/2021 12:16:35] [Error - Action Interface]
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:onUse
[31/03/2021 12:16:35] Description:
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:17: attempt to compare number with table
[31/03/2021 12:16:35] stack traceback:
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:17: in function 'HealPerTurn'
[31/03/2021 12:16:35] data/actions/scripts/potion/potion.lua:64: in function <data/actions/scripts/potion/potion.lua:41>
É uma vírgula extra, devo ter inserido sem querer e nem percebi. Troca o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSau(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid], potions[item.itemid].effect, vezes_repete, segundos) return true end
Em 31/03/2021 em 14:49, Yan18 disse:É uma vírgula extra, devo ter inserido sem querer e nem percebi. Troca o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSau(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid], potions[item.itemid].effect, vezes_repete, segundos) return true end
[02/04/2021 12:02:49] [Error - Action Interface]
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:onUse
[02/04/2021 12:02:49] Description:
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:17: attempt to compare number with table
[02/04/2021 12:02:49] stack traceback:
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:17: in function 'HealPerTurn'
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:63: in function <data/actions/scripts/potion/potion.lua:40>
2 horas atrás, KaboFlow disse:
[02/04/2021 12:02:49] [Error - Action Interface]
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:onUse
[02/04/2021 12:02:49] Description:
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:17: attempt to compare number with table
[02/04/2021 12:02:49] stack traceback:
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:17: in function 'HealPerTurn'
[02/04/2021 12:02:49] data/actions/scripts/potion/potion.lua:63: in function <data/actions/scripts/potion/potion.lua:40>
Esqueci de colocar o campo health da tabela das potions no parâmetro health da função. Troque o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSau(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end
1 hora atrás, Yan18 disse:Esqueci de colocar o campo health da tabela das potions no parâmetro health da função. Troque o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSau(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end
[02/04/2021 16:13:26] [Error - Action Interface]
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:onUse
[02/04/2021 16:13:26] Description:
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:19: attempt to call global 'doCreatureSau' (a nil value)
[02/04/2021 16:13:26] stack traceback:
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:19: in function 'HealPerTurn'
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:64: in function <data/actions/scripts/potion/potion.lua:41>
agora se dá vida, mas dá apenas 1 vez, não regenera por segundo e a poção não é removida se eu tiver 100 ela não desce para 99 ou se eu tiver 1 poção é infinita
39 minutos atrás, KaboFlow disse:
[02/04/2021 16:13:26] [Error - Action Interface]
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:onUse
[02/04/2021 16:13:26] Description:
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:19: attempt to call global 'doCreatureSau' (a nil value)
[02/04/2021 16:13:26] stack traceback:
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:19: in function 'HealPerTurn'
[02/04/2021 16:13:26] data/actions/scripts/potion/potion.lua:64: in function <data/actions/scripts/potion/potion.lua:41>
agora se dá vida, mas dá apenas 1 vez, não regenera por segundo e a poção não é removida se eu tiver 100 ela não desce para 99 ou se eu tiver 1 poção é infinita
Sobre erro, é porque eu escrevi errado o nome da função, digitei uma letra errada, troque o código por esse:
local function HealPerTurn(cid, health, effect, seconds, time) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, seconds, time - 1) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end
E sobre só curar uma vez, foi erro meu, eu havia esquecido de fazer recursão.
2 horas atrás, Yan18 disse:Sobre erro, é porque eu escrevi errado o nome da função, digitei uma letra errada, troque o código por esse:
local function HealPerTurn(cid, health, effect, seconds, time) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, seconds, time - 1) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12343] = {health = 1000, effect = 14}, -- full restore [12345] = {health = 3500, effect = 14}, -- hyper potion [12346] = {health = 5000, effect = 12}, -- ultra potion [12347] = {health = 8000, effect = 13}, -- super potion [12348] = {health = 10000, effect = 13}, -- great potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end
E sobre só curar uma vez, foi erro meu, eu havia esquecido de fazer recursão.
Agora a poção é infinita ... e só se regenera repentinamente, não por segundos ...
Eu não sei se você me entende
O que eu quero é que a poção regenere por segundo, por exemplo, a poção regenera você de 10.000 ... ela regenera você 1.000 por segundo dando um total de 10 segundos para regenerar 10.000
1 hora atrás, KaboFlow disse:
Agora a poção é infinita ... e só se regenera repentinamente, não por segundos ...
Eu não sei se você me entende
O que eu quero é que a poção regenere por segundo, por exemplo, a poção regenera você de 10.000 ... ela regenera você 1.000 por segundo dando um total de 10 segundos para regenerar 10.000
Sim, eu entendi o que você quer. É estranho, pois eu testei aqui e está funcionando normal. Troque o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true end
Já está configurado para curar o tanto de health que tem em cada potion na tabela das potions por 10 segundos.
6 minutos atrás, Yan18 disse:Sim, eu entendi o que você quer. É estranho, pois eu testei aqui e está funcionando normal. Troque o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) return true endJá está configurado para curar o tanto de health que tem em cada potion na tabela das potions por 10 segundos.
[02/04/2021 21:14:15] [Error - Action Interface]
[02/04/2021 21:14:15] In a timer event called from:
[02/04/2021 21:14:15] data/actions/scripts/potion/potion.lua:onUse
[02/04/2021 21:14:15] Description:
[02/04/2021 21:14:15] (luaDoPlayerSendCancel) Player not found
agora se puxar bem cura como está a cada segundo mas ainda não retira o item Eu quero que não seja infinito que é normal que a poção termine é infinito se eu tiver 1 posso usar infinito .. e me deu aquele erro agora
1 minuto atrás, KaboFlow disse:
[02/04/2021 21:14:15] [Error - Action Interface]
[02/04/2021 21:14:15] In a timer event called from:
[02/04/2021 21:14:15] data/actions/scripts/potion/potion.lua:onUse
[02/04/2021 21:14:15] Description:
[02/04/2021 21:14:15] (luaDoPlayerSendCancel) Player not found
agora se puxar bem cura como está a cada segundo mas ainda não retira o item Eu quero que não seja infinito que é normal que a poção termine é infinito se eu tiver 1 posso usar infinito .. e me deu aquele erro agora
Você precisa explicar melhor, pois quando falou que está usando infinito, eu entendi que a cura estava sendo infinita, e não o uso. E sim, realmente esqueci de remover o item.
Sobre esse erro, nos testes que fiz aqui não deu. Você está usando em summon ou player?
Arrumei e agora está removendo o item:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) doRemoveItem(item.uid, 1) return true end
7 minutos atrás, Yan18 disse:Você precisa explicar melhor, pois quando falou que está usando infinito, eu entendi que a cura estava sendo infinita, e não o uso. E sim, realmente esqueci de remover o item.
Sobre esse erro, nos testes que fiz aqui não deu. Você está usando em summon ou player?
Arrumei e agora está removendo o item:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) doCreatureSay(cid, "Healing...") addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) doRemoveItem(item.uid, 1) return true end
perfeito agora e não há nenhum erro, o único problema que vejo é que eu lanço a mensagem a cada segundo ..
21:27 Blastoise Brilhante: Cura ...
Você poderia colocá-lo para dizer apenas ao usá-lo e não repeti-lo por 10 segundos
1 minuto atrás, KaboFlow disse:
perfeito agora e não há nenhum erro, o único problema que vejo é que eu lanço a mensagem a cada segundo ..
21:27 Blastoise Brilhante: Cura ...
Você poderia colocá-lo para dizer apenas ao usá-lo e não repeti-lo por 10 segundos
Deixei a fala apenas por enfeite, mas é bem simples, troque o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) doRemoveItem(item.uid, 1) return true end
4 minutos atrás, Yan18 disse:
Deixei a fala apenas por enfeite, mas é bem simples, troque o código por esse:
local function HealPerTurn(cid, health, effect, time, seconds) local duration = seconds > 0 and math.floor(1000 * seconds) or math.floor(1000 * 1) -- EQUIVALENTE A 1 SEGUNDO (MILISSEGUNDOS) if not cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used only in creatures.") return true end if time <= 0 then return true else if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, "Your health is full.") end doCreatureAddHealth(cid, health > 0 and math.floor(health) or 1) doSendMagicEffect(getThingPos(cid), effect) addEvent(HealPerTurn, duration, cid, health, effect, time - 1, seconds) end end --- TABELA COM O ID DAS POTIONS, TANTO DE VIDA QUE CURA CADA UMA E EFEITO AO USAR A POÇÃO --- local potions = { [12347] = {health = 1000, effect = 13}, -- full restore [12348] = {health = 3500, effect = 13}, -- hyper potion [12346] = {health = 5000, effect = 13}, -- ultra potion [12345] = {health = 8000, effect = 13}, -- super potion } local vezes_repete = 10 -- QUANTAS VEZES VAI REPETIR O EFEITO local segundos = 1 -- TEMPO EM SEGUNDOS PARA REPETIR O EFEITO ---------------------------- CÓDIGO -------------------------------- function onUse(cid, item, toPos, itemEx, FromPos) local pokemon = getCreatureSummons(cid)[1] -- PEGA O PRIMEIRO SUMMON DO PLAYER (POKEMON) if not pokemon then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Potions can be used in a pokémon.") return true end if not isSummon(pokemon) or getCreatureMaster(pokemon) ~= cid then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use potion only in your own pokémon.") return doPlayerSendCancel(cid, "You can use potion only in your pokémon.") end if getPlayerStorageValue(cid, 52481) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do that while a duel.") return doPlayerSendCancel(cid, "You can't do that while a duel.") end if getPlayerStorageValue(cid, 990) >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use potion during gym battles.") return doPlayerSendCancel(cid, "You can't use potion during gym battles.") end HealPerTurn(pokemon, potions[item.itemid].health, potions[item.itemid].effect, vezes_repete, segundos) doRemoveItem(item.uid, 1) return true end
Talvez eu não me explique bem ou não sei o que é que quero se a mensagem sai, mas não se repete a cada segundo que cura ..
o que eu quero é que apareça a mensagem ao usar a poção mas não se repita mais
se você não pode, obrigado
Eu queria ver se você pode me ajudar com a poção de restauração para% que cura entre 50% da vida do pokémon, abro outra pergunta ou você pode me ajudar aqui, desculpe o transtorno