Ir para conteúdo

Featured Replies

Postado

Fala galera preciso de uma script que mostra a porcentagem de dodge no Look e que o máximo seja 50%, tipo ele vai pegar a porcentagem que tem de dodge por item e somar tudo, quero que o máximo que aparece seja 50%.

Exemplo: [Dodge]: 50% (MAX)

 

Minha Script De Dodge:

 

unction 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) 
dodge = 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 = 25, max = 35, chance = 40},
[5] = {min = 35, max = 50, chance = 30}
}


function isWearing(uid) -- NW based on Mock
         uid = uid or 0
        if isInArray({uid}, getPlayerSlotItem(cid, 1).uid) or isInArray({uid},  -- HELMET --
        getPlayerSlotItem(cid, 2).uid) or isInArray({uid}, -- Aol -- 
        getPlayerSlotItem(cid, 4).uid) or isInArray({uid}, -- ARMOR --
        getPlayerSlotItem(cid, 9).uid) or isInArray({uid}, -- RING --
        getPlayerSlotItem(cid, 7).uid) or isInArray({uid}, -- LEGS --
        getPlayerSlotItem(cid, 8).uid) then -- BOOTS --
             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),"Dodge: " .. i .."") then
dodge = i
end
end


if dodge >= #upgrade then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Este item ja esta no maximo de Dodge possivel!")
return true
end


if math.random(0,100) <= upgrade[dodge + 1].chance then 
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Sucesso ao usar sua Dodge Stone!")
setItemDodgePercent(itemEx.uid, atual + (math.random(upgrade[dodge+1].min,upgrade[dodge+1].max))/10)
doItemSetAttribute(itemEx.uid,'name', getItemNameById(itemEx.itemid)..' [Dodge: ' ..dodge+1 .."/5]")
doSendMagicEffect(toPosition, math.random(28,30))
else
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Sua Dodge Stone Falhou :(")
doSendMagicEffect(toPosition, 4)
end


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

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.7k

Informação Importante

Confirmação de Termo