tuduras
Well-Known Member
- Joined
- Jun 4, 2017
- Messages
- 340
- Solutions
- 2
- Reaction score
- 58
Hello Otlanders,
I've got script dodge
and every hit is reflected. I don't get injured. how to change it? best regards
I've got script dodge
LUA:
local storagedodge = 98798644 -- storage del dodge
local cor = 250 -- color del texto
local effect = 31 -- efecto mágico
local msg = "Esquivou." -- texto
-- tabla opcional si algún día quieres sistema por rangos (ahora no se usa)
local dodge = {
{min = 1, max = 10, chance = 4},
{min = 11, max = 20, chance = 5},
{min = 21, max = 40, chance = 6},
{min = 41, max = 50, chance = 7},
{min = 51, max = 70, chance = 8},
{min = 71, max = 90, chance = 9},
{min = 91, max = 100, chance = 12},
}
function onStatsChange(cid, attacker, type, combat, value)
if not isPlayer(cid) then
return true
end
if combat == COMBAT_HEALING then
return true
end
local sto_doge = tonumber(getPlayerStorageValue(cid, storagedodge))
if sto_doge == nil then
sto_doge = 0
end
-- Si tiene dodge activo
if sto_doge >= 1 then
-- Bonus extra si tiene este storage
if getCreatureStorage(cid, 722640) == 1 then
sto_doge = sto_doge + 10
end
-- Chance escalado
local chance = (sto_doge / 6) >= 1 and math.ceil(sto_doge / 6) or 1
local random = math.random(100)
if random <= chance then
local pos = getCreaturePosition(cid)
doSendMagicEffect(pos, effect)
doSendAnimatedText(pos, msg, cor)
return false -- esquiva el golpe
end
end
-- Reducción de daño si tiene este storage activo
if getCreatureStorage(cid, 722640) == 1 then
value = value - (value * 0.03)
doTargetCombatHealth(attacker, cid, COMBAT_PHYSICALDAMAGE, -value, -value, effect)
return false -- ya aplicamos el daño manual
end
return true
end
and every hit is reflected. I don't get injured. how to change it? best regards




