Ir para conteúdo
  • Cadastre-se

(Resolvido)Ajuda Dodge Ne Items


Ir para solução Resolvido por FlavioHulk,

Posts Recomendados

Bom dia galerinha do tk

 

 consegui achar um script de dodgem em items

mas tem um problema ele ta dano comflito com o upgrade system que tenho

quando uso a pedra dodg no item ele fica + 1 +2 +3 +4 e +5 

queria tirar issu deixar com que ele so add as % de dodge no item

 

pq tenho um sistema de upgrade que add no item +1 ate + 10

 

function isHandItem(uid) -- NW based on Mock
         uid = uid or 0
        if isInArray({1,2,3,4,5,6}, getItemWeaponType(uid)) then
             return true
         end
         return false
end


function getItemDodgePercent(itemuid)
return getItemAttribute(itemuid, "dodgePercent") or 0
end


function setItemDodgePercent(uid, percent)
doItemSetAttribute(uid, "description", "[Dodge: "..percent.."%]")
doItemSetAttribute(uid, "dodgePercent", percent)
end


function onUse(cid, item, fromPosition, itemEx, toPosition) 
level = 0
local upgrade = {
[1] = {min = 1, max = 5, chance = 100},
[2] = {min = 5, max = 10, chance = 80},
[3] = {min = 10, max = 20, chance = 60},
[4] = {min = 20, max = 40, chance = 40},
[5] = {min = 40, max = 50, chance = 20}
}


function isWearing(uid) -- NW based on Mock
         uid = uid or 0
        if isInArray({uid}, getPlayerSlotItem(cid, 1).uid) or isInArray({uid}, getPlayerSlotItem(cid, 4).uid) or isInArray({uid}, getPlayerSlotItem(cid, 7).uid) or isInArray({uid}, getPlayerSlotItem(cid, 8).uid) then
             return true
         end
         return false
end


if isHandItem(itemEx.uid) or isWearing(itemEx.uid) then 
local name = getItemName(itemEx.uid)
local atual = math.floor(getItemDodgePercent(itemEx.uid)*10)/10
for i = 1, #upgrade do
if string.find(tostring(name),"+".. i .."") then
level = i
end
end


if level >= #upgrade then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your item is already on max level, you can't upgrade it any further.")
return true
end


if math.random(0,100) <= upgrade[level + 1].chance then 
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You leveled your "..getItemNameById(itemEx.itemid).." to ".. level+1 ..".")
setItemDodgePercent(itemEx.uid, atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10)
doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1))
doSendMagicEffect(toPosition, math.random(28,30))
else
setItemDodgePercent(itemEx.uid, 0)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your "..getItemNameById(item.itemid).." has failed and destroyed the dodge of your "..getItemNameById(itemEx.itemid).." in the process")
doSendMagicEffect(toPosition, 4)
end


else
doPlayerSendTextMessage(cid, 24,"You cant refine this item.")
end
return true
end

Editado por mullino (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Respostas 13
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

apaga isso:   setItemDodgePercent(itemEx.uid, atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10)doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1))   e coloca isso:     local porcentagem = atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10 setItemDodgePercent(itemEx.uid, porcentagem)doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(porcentagem))  

doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1))

voce modifica aqui o texto

Toda terça-feira um tópico novo:

Descanso para curar mana (Spell): https://tibiaking.com/forums/topic/94615-spell-descanso-para-curar-mana/

Peça sua spell (Suporte):                https://tibiaking.com/forums/topic/84162-peça-sua-spell/                        

Chuva de flechas (Spell):                https://tibiaking.com/forums/topic/72232-chuva-de-flechas-spell/

Doom (Spell):                                https://tibiaking.com/forums/topic/51622-doom-spell/

Utilização do VS Code (Infra)       https://tibiaking.com/forums/topic/94463-utilizando-o-visual-studio-code-notepad-nunca-mais/

SD com Combo (Spell):                 https://tibiaking.com/forums/topic/94520-sd-modificada/

Alteração attack speed (C++):        https://tibiaking.com/forums/topic/94714-c-attack-speed-spells-itens-e-onde-você-quiser/  

Bônus de Speed (NPC)                  https://tibiaking.com/forums/topic/94809-npc-concede-bônus-aos-players/
 

Link para o post
Compartilhar em outros sites
  Em 09/06/2018 em 17:23, Reds disse:

doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1))

voce modifica aqui o texto

Mostrar mais  

no caso ficaria asim?

doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(Dodge+1))

?

Link para o post
Compartilhar em outros sites

 

 

apaga isso:

 

setItemDodgePercent(itemEx.uid, atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10)
doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1))

 

e coloca isso:

 

 

local porcentagem = atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10

setItemDodgePercent(itemEx.uid, porcentagem)
doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(porcentagem))

 

 

olhei bem por cima o código, se n der me avisa

Toda terça-feira um tópico novo:

Descanso para curar mana (Spell): https://tibiaking.com/forums/topic/94615-spell-descanso-para-curar-mana/

Peça sua spell (Suporte):                https://tibiaking.com/forums/topic/84162-peça-sua-spell/                        

Chuva de flechas (Spell):                https://tibiaking.com/forums/topic/72232-chuva-de-flechas-spell/

Doom (Spell):                                https://tibiaking.com/forums/topic/51622-doom-spell/

Utilização do VS Code (Infra)       https://tibiaking.com/forums/topic/94463-utilizando-o-visual-studio-code-notepad-nunca-mais/

SD com Combo (Spell):                 https://tibiaking.com/forums/topic/94520-sd-modificada/

Alteração attack speed (C++):        https://tibiaking.com/forums/topic/94714-c-attack-speed-spells-itens-e-onde-você-quiser/  

Bônus de Speed (NPC)                  https://tibiaking.com/forums/topic/94809-npc-concede-bônus-aos-players/
 

Link para o post
Compartilhar em outros sites
  Em 09/06/2018 em 18:19, Reds disse:

 

 

apaga isso:

 

setItemDodgePercent(itemEx.uid, atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10)
doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1))

 

e coloca isso:

 

 

local porcentagem = atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10

setItemDodgePercent(itemEx.uid, porcentagem)
doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(porcentagem))

 

 

olhei bem por cima o código, se n der me avisa

Expand   Mostrar mais  

vou testar aki

 

nao deu ele add 

You see a Supreme Shield +0.8 

 

ae quando uso a pedra de encantar focica asim

You see a Supreme Shield +0.5 +1 

se usar de novo fica asim

You see a Supreme Shield +0.5 +1 +1 

ae se eu usar a de dodge de novo fica asim

You see a Supreme Shield +0.8 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96850
    Tópicos
    519616
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo