• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved otx 2.16 based on 0.3.7 ---dodge reflect --- every hit is reflect

tuduras

Well-Known Member
Joined
Jun 4, 2017
Messages
340
Solutions
2
Reaction score
58
Hello Otlanders,
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
 
in player.cpp
BlockType_t Player::blockHit
after
damage -= blocked;
add
LUA:
if(reflect)
    {
        std::string value;
        getStorage("722640", value);
        int32_t tmp = (int32_t)(atoi(value.c_str()));
        if(tmp > 0)
        {
            reflected += (int32_t)std::ceil((double)damage * 0.03.);
            g_game.addMagicEffect(attacker->getPosition(), 57);
        }   
    }
 
the same that still is reflect. I used source edit. It's necessary to use script in data/creaturescript ?
 
yes I have anydesk .
U know maybe when I've used dodge earlier it doesn't work. I made new character and I see dodge mirror

PS:provide your details and I will send you an invitation
 
Back
Top