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

Lua LUA doubt

sasuke.maria

New Member
Joined
Nov 19, 2016
Messages
17
Reaction score
0
i was making one script for check if target sorcerer or druid then elite knight hit more.
I changed my vocations.xml from LUA for make this.

So, i want put meleeDamage based in target, but idk how make this check
i think need make

local target = xxx

But idk how i can make it.
u can help-me it this?
thanks for read at now!
 
Solution
Something like

Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker ~= creature then
        local tmpPlayer = attacker:getPlayer()
        local againstPlayer = creature:getPlayer()

        if tmpPlayer and againstPlayer then
            if isInArray({4, 8}, tmpPlayer:getVocation():getId()) then -- if is knight
                if isInArray({1, 2, 5, 6}, againstPlayer:getVocation():getId()) then -- if againstPlayer is mage
                    local extraDamage = primaryDamage + secondaryDamage * 0.50
                    return primaryDamage + secondaryDamage, primaryType, extraDamage, COMBAT_DROWNDAMAGE
                end
            end...
Something like

Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker ~= creature then
        local tmpPlayer = attacker:getPlayer()
        local againstPlayer = creature:getPlayer()

        if tmpPlayer and againstPlayer then
            if isInArray({4, 8}, tmpPlayer:getVocation():getId()) then -- if is knight
                if isInArray({1, 2, 5, 6}, againstPlayer:getVocation():getId()) then -- if againstPlayer is mage
                    local extraDamage = primaryDamage + secondaryDamage * 0.50
                    return primaryDamage + secondaryDamage, primaryType, extraDamage, COMBAT_DROWNDAMAGE
                end
            end
        end
    end

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end
 
Solution
Back
Top