Ir para conteúdo

Featured Replies

Postado

Olá tem uma boost stone em meu servidor que está com um bug e espero que vocês me ajudem 

 

eu tenho uma stone que uso no pokémon , ela está funcionando normal o único problema é que não importa onde eu der use no item , tipo se eu clicar no item e der use no chão o efeito vai funcionar no pokemon que estiver no slot. 

 

Mais eu queria que o efeito da stone só funcionasse se eu usasse o item na ball e não como está que eu posso usar em qualquer coisa que o efeito funciona no pokemon que está no slot principal 

 

script da boost stone

 

function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10
 
    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end
 
    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
 
if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
end
 
 
        boosts = boosts
        local pokemon = getItemAttribute(myball.uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
local def = pokes[pokemon].defense * boost_rate * boosts
local agi = pokes[pokemon].agility * boosts
local spatk = pokes[pokemon].specialattack * boost_rate * boosts
local vit = pokes[pokemon].vitality * boost_rate * boosts
newBoost = boost + boosts
 
if newBoost > 70 then
newBoost = 70
end
 
        doSetItemAttribute(myball.uid, "boost", newBoost)
doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(item2.uid), 103)
doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true 
end
 

 

quando estou usando em qualquer lugar e não tem pokemon no slot principal dar esse erro ai 

[31/07/2015 18:29:45] [Error - Action Interface] 
[31/07/2015 18:29:45] data/actions/scripts/booststone.lua:onUse
[31/07/2015 18:29:45] Description: 
[31/07/2015 18:29:45] (luaGetItemAttribute) Item not found
 
[31/07/2015 18:29:54] [Error - Action Interface] 
[31/07/2015 18:29:54] data/actions/scripts/booststone.lua:onUse
[31/07/2015 18:29:54] Description: 
[31/07/2015 18:29:54] (luaGetItemAttribute) Item not found

rep+ para quem me ajudar

Editado por Neymar jr (veja o histórico de edições)

Postado
  • Autor

Resolvido graças ao Zipter98 ^^

 

solução: 

 

function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    if myball.uid < 1 or item2.uid ~= myball.uid then
        return doPlayerSendCancel(cid, "Use this item on a pokeball in the pokeball slot.")
    end
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10
 
    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
        return true
    end
 
    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
 
    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end
 
 
    boosts = boosts
    local pokemon = getItemAttribute(myball.uid, "poke")
    local off = pokes[pokemon].offense * boost_rate * boosts
    local def = pokes[pokemon].defense * boost_rate * boosts
    local agi = pokes[pokemon].agility * boosts
    local spatk = pokes[pokemon].specialattack * boost_rate * boosts
    local vit = pokes[pokemon].vitality * boost_rate * boosts
    newBoost = boost + boosts
 
    if newBoost > 70 then
        newBoost = 70
    end
 
    doSetItemAttribute(myball.uid, "boost", newBoost)
    doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
    doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
    doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
    doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
    doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
    doRemoveItem(item.uid, 1)
    doSendMagicEffect(getThingPos(item2.uid), 103)
    doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
    doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
    doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
    return true 

end

Editado por Neymar jr (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo