• 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!

Dodge System OTX 3.1

Wanheda

New Member
Joined
Feb 17, 2016
Messages
44
Solutions
2
Reaction score
4
Hello, someone would have to make available some dodge system, where he defends% of the damage received.

I have a system, but it is not working, if someone can help me to correct the problem.
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not isPlayer(creature) then return false end
    if (creature:getDodgeLevel() * 3) >= math.random (0, 1000) and isCreature(attacker) then
        if isInArray({ORIGIN_MELEE, ORIGIN_RANGED, ORIGIN_SPELL}, origin) and primaryType ~= COMBAT_HEALING then
            primaryDamage = primaryDamage - math.ceil(primaryDamage * DODGE.PERCENT)
            creature:say("DODGE!", TALKTYPE_MONSTER_SAY)
            creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end
 
Back
Top