Dodge System
Introdução:
- Fiz esse sistema pra ajuda um cara aqui no xtibia
- Desculpa deu um erro na hora que eu fui posta.
O que ele faz:
local storagedodge = 98798644 -- storage do dodge
local cor = 35 -- cor do texto
local effect = 30 -- id do magic effect
local msg = "DODGE!" -- msg
local dodge = {
{min = 1, max = 2, chance = 10}, -- se o dodge tiver entre 1 e 2 tem 10% de chance de da dodge.
{min = 3, max = 4, chance = 20}, -- podem ser configurada portanto que não passe do limite
{min = 5, max = 6, chance = 30}, -- vocês pode adicionar mas se quiserem
{min = 7, max = 8, chance = 40},
{min = 9, max = 10, chance = 45},
{min = 11, max = math.huge, chance = 50}
}
function onStatsChange(cid, attacker, type, combat, value)
if not isCreature(cid) then
return false
end
for _, tudo in pairs(dodge) do
if getPlayerStorageValue(cid, storagedodge) >= tudo.min and getPlayerStorageValue(cid, storagedodge) <= tudo.max then
local chancex = math.random(1, 100)
if chancex <= tudo.chance then
if combat ~= COMBAT_HEALING then
doSendMagicEffect(getCreaturePosition(cid), effect)
doSendAnimatedText(getCreaturePosition(cid), msg, cor)
return false
end
end
end
end
return true
end<event type="StatsChange" name="CombatDodge" event="script" value="CombatDodge.lua"/>
registerCreatureEvent(cid, "CombatDodge")
local limite = 100 -- limite de dodge
local storagedodge = 98798644 -- storage do dodge
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, storagedodge) == -1 then
doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 2)
doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].")
elseif getPlayerStorageValue(cid, storagedodge) >= -1 and getPlayerStorageValue(cid, storagedodge) <= limite then
doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 1)
doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].")
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "Voce ja chego no maximo.DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."]")
end
return true
end<action itemid="8302" event="script" value="dodgestone.lua"/>









