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

Change in PvP system

icekis

Member
Joined
Jan 18, 2018
Messages
91
Reaction score
5
I'm looking for a way to modify the PvP system.

If target is same level or higher, attacker receives a % of the total XP of the target's death.

Can anybody help me?
 
Solution
I'm looking for a way to modify the PvP system.

If target is same level or higher, attacker receives a % of the total XP of the target's death.

Can anybody help me?
Like this? Register in login.lua.
Lua:
local exp_percent = 2

function onKill(creature, target)
    if creature:isPlayer() and target:isPlayer() then
        if target:getLevel() >= creature:getLevel() then
            creature:addExperience(math.floor(target:getExperience() * (exp_percent / 100)))
        end
    end
    return true
end
I'm looking for a way to modify the PvP system.

If target is same level or higher, attacker receives a % of the total XP of the target's death.

Can anybody help me?
Like this? Register in login.lua.
Lua:
local exp_percent = 2

function onKill(creature, target)
    if creature:isPlayer() and target:isPlayer() then
        if target:getLevel() >= creature:getLevel() then
            creature:addExperience(math.floor(target:getExperience() * (exp_percent / 100)))
        end
    end
    return true
end
 
Solution
Back
Top