Change in PvP system

icekis

Member
Joined
Jan 18, 2018
Messages
83
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?
 

Apollos

Dude who does stuff
Joined
Apr 22, 2009
Messages
722
Reaction score
442
Location
United States
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
 
Top