Postado Junho 6, 2018 7 anos 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 Junho 6, 2018 7 anos por mullino (veja o histórico de edições)
Postado Junho 9, 2018 7 anos 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/
Postado Junho 9, 2018 7 anos Autor 49 minutos atrás, Reds disse: doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(level+1)) voce modifica aqui o texto no caso ficaria asim? doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' +'..(Dodge+1)) ?
Postado Junho 9, 2018 7 anos 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/
Postado Junho 9, 2018 7 anos Autor 4 minutos atrás, 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 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
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.