Ir para conteúdo
  • 0

Potion de Pokemon Certa Porcentagem HP


KaboFlow

Pergunta

Posts Recomendados

  • 0
Agora, KaboFlow disse:

 

[06/04/2021 22:42:12] [Error - Action Interface] 
[06/04/2021 22:42:12] In a timer event called from: 
[06/04/2021 22:42:12] data/actions/scripts/potion/Potion2021.lua:onUse
[06/04/2021 22:42:12] Description: 
[06/04/2021 22:42:12] (luaGetCreatureMaxHealth) Creature not found

[06/04/2021 22:42:12] [Error - Action Interface] 
[06/04/2021 22:42:12] In a timer event called from: 
[06/04/2021 22:42:12] data/actions/scripts/potion/Potion2021.lua:onUse
[06/04/2021 22:42:12] Description: 
[06/04/2021 22:42:12] (luaDoPlayerSendCancel) Player not found

Quando esse erro acontece? Ao puxar o pokémon quando está realizando a cura?

Link para o comentário
Compartilhar em outros sites

  • 0
Em 06/04/2021 em 22:43, Yan18 disse:

Quando esse erro acontece? Ao puxar o pokémon quando está realizando a cura?

 

 

[01/05/2021 11:27:33] [Error - Action Interface] 
[01/05/2021 11:27:33] data/actions/scripts/potion.lua:onUse
[01/05/2021 11:27:33] Description: 
[01/05/2021 11:27:33] data/actions/scripts/potion.lua:30: attempt to call global 'getThingFromPosWithProtect' (a nil value)
[01/05/2021 11:27:33] stack traceback:
[01/05/2021 11:27:33]     data/actions/scripts/potion.lua:30: in function <data/actions/scripts/potion.lua:29>

 

 

ache outra mais tenhe error...

 

 

Spoiler

function doHealOverTime(cid, heal, 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 onPokeHealthChange(getCreatureMaster(cid))
elseif getCreatureHealth(cid) + heal/10 >= getCreatureMaxHealth(cid) then
   doSendAnimatedText(getThingPos(cid), "+"..getCreatureMaxHealth(cid) - getCreatureHealth(cid), 65)
   doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
   doSendMagicEffect(getThingPos(cid), 12)
   return onPokeHealthChange(getCreatureMaster(cid))
end

doSendAnimatedText(getThingPos(cid), "+"..heal/10, 65)
doCreatureAddHealth(cid, heal/10)
doSendMagicEffect(getThingPos(cid), 12)
onPokeHealthChange(getCreatureMaster(cid))
addEvent(doHealOverTime, 1000, cid, heal, turn - 1, effect)
end

local potions = {
[2272] = {health = 400, animate = "SMALL POT", collor = 140},
[2274] = {health = 1500, animate = "GREAT POT", collor = 140},       
[2271] = {health = 4000, animate = "ULTRA POT", collor = 140},
[2270] = {health = 10000, animate = "HYPER POT", collor = 140},
[7588] = {health = 30000, animate = "ULTIMATE POT", collor = 140},
}

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
 
doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_SAY)
doSendAnimatedText(getThingPos(pid), potions[item.itemid].animate, potions[item.itemid].collor)
setPlayerStorageValue(pid, 173, 1)
doRemoveItem(item.uid, 1)

doHealOverTime(pid, potions[item.itemid].health, 10, 12)

return true
end

 

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...