Ir para conteúdo

Featured Replies

  • Respostas 61
  • Visualizações 11.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Mais bonito que isso só o VittinG! Excelente lindão, continue sempre assim, reputado.

  • function getItemDodgePercent(itemuid) return getItemAttribute(itemuid, "dodgePercent") or 0 end function setItemDodgePercent(uid, percent) doItemSetAttribute(uid, "description", "[Dodge: "..percent.

  • 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

Posted Images

Postado
  • Autor
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}
}




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
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your "..getItemNameById(item.itemid).." has failed in the process")
doSendMagicEffect(toPosition, 4)
end


return true
end


edite aqui 
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}
}

[level] = {minimo que adiciona de dodge, maximo que adiciona, chance de dar certo e avançar de nivel}, << NÃO ESQUECER DA VIRGULA!!

Se eu to nv 4 tem 20% de chance de eu ir pro nv 5 e ganhar de 4% a 5% de dodge a mais no item. Lembrando que se vcs forem criar leveis novos precisa colocar a virgula no final, só o ultimo que não precisa de virgula.

em actions coloca: 

<action itemid="8306" script="other/upgraderock.lua"/>

e vc pode sair por aí usando a pedra 8306 pra colocar dodge noque quiser.

Esse script tá bugado porque ele permite que vc coloque dodge até na backpack e nos items ao redor do mapa, eu tenho a versão arrumada dele mas preciso fazer alguns testes a mais antes de liberar

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Postado

 

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}
}




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
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your "..getItemNameById(item.itemid).." has failed in the process")
doSendMagicEffect(toPosition, 4)
end


return true
end


edite aqui 

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}

}

[level] = {minimo que adiciona de dodge, maximo que adiciona, chance de dar certo e avançar de nivel}, << NÃO ESQUECER DA VIRGULA!!

Se eu to nv 4 tem 20% de chance de eu ir pro nv 5 e ganhar de 4% a 5% de dodge a mais no item. Lembrando que se vcs forem criar leveis novos precisa colocar a virgula no final, só o ultimo que não precisa de virgula.

em actions coloca: 

<action itemid="8306" script="other/upgraderock.lua"/>

e vc pode sair por aí usando a pedra 8306 pra colocar dodge noque quiser.

Esse script tá bugado porque ele permite que vc coloque dodge até na backpack e nos items ao redor do mapa, eu tenho a versão arrumada dele mas preciso fazer alguns testes a mais antes de liberar

 

Pois vou esperar pela atualização , REP+ QUANDO LIBERAR ATUALIZAÇÃO.

Postado
  • Autor

eu testei aqui e infelizmente não tem como haha daria pra colocar mas necessitaria de source editing... por lua oque dá pra fazer é criar um script que use a função que eu expliquei de criar itens já com o dodge pré definido ou então usar o script da pedra de dodge.. eu dei uma mexida nele e consegui quebrar uns galhos, ele tem muito que melhorar mas por ora ele tá 99% pronto pra ser colocado em algum server que utilize o dodge system.
 

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
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your "..getItemNameById(item.itemid).." has failed and destroyed your "..getItemNameById(itemEx.itemid).." in the process")
doSendMagicEffect(toPosition, 4)
end


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


Note que pra colocar dodge num item ele tem que: Estar equipado se for qualquer tipo de armadura (legs, boots, helmet, armor) ou livremente (se for weapon/shield).. Necklaces, rings e pendants não são possíveis de colocar dodge.. se vc quiser que seja edita essa função dentro do script pros slots de ring e necklace mas eu não aconselharia a fazer isso.

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

 e no xml coloque: 

<action itemid="8306" script=upgraderock.lua"/>

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

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