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

Exp for war servers HELP

wafuboe

Active Member
Joined
Dec 24, 2010
Messages
884
Solutions
2
Reaction score
26
Im new to war servers so im in a hurry,

How can i set the exp for killing players its at x115 exp right now but if the player you kill it has less level you dont gain exp..

Im new to war servers and somebody help me?
 
This follow information is collected from this thread http://otland.net/threads/every-changes-you-need-to-a-hardcore-war-server.132897/

No level difference restriction on kills
In players.cpp change:

PHP:
double attackerLevel = (double)attackerPlayer->getLevel(), min = g_config.getDouble(
        ConfigManager::EFP_MIN_THRESHOLD), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
    if((min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 &&
        level > (uint32_t)std::floor(attackerLevel * max)))
        return 0;

to

PHP:
double attackerLevel = (double)attackerPlayer->getLevel(), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
    if(max > 0 && level > (uint32_t)std::floor(attackerLevel * max))
        return 0;

Next time try to use the search tool.

If you dont know how to compile a server take a travel to the tutorials section in the forum.
 
Im new to war servers so im in a hurry,

How can i set the exp for killing players its at x115 exp right now but if the player you kill it has less level you dont gain exp..

Im new to war servers and somebody help me?

Easier in lua;

By @Ninja
Code:
function onKill(cid, target, lastHit)
    local attackPlayer = Player(target)
    if not attackPlayer then
        return true
    end

    for id, damage in pairs(attackPlayer:getDamageMap()) do
        local player = Player(id)
        if player then
            if attackPlayer:getLevel() >= player:getLevel() then
                local experience = attackPlayer:getExperience()
                local expFormula = ((experience / 100) * 0.75)
                player:addExperience(math.floor(expFormula), true)
            end
        end
    end
end
 
well i got a problem, for example if a lvl 100 kills a lvl 100.. itss ok it gains 1 and half level

but when a lvl 100 kills a 250 it gains a lot of level how can i fix this?
 
I also like that you need to create a script with stages exp
well i got a problem, for example if a lvl 100 kills a lvl 100.. itss ok it gains 1 and half level

but when a lvl 100 kills a 250 it gains a lot of level how can i fix this?

Code:
function onKill(cid, target, lastHit)
    local attackPlayer = Player(target)
    if not attackPlayer then
        return true
    end

    for id, damage in pairs(attackPlayer:getDamageMap()) do
        local player = Player(id)
        if player then
            if attackPlayer:getLevel() >= player:getLevel()
                if player:getLevel() < 300 then
                local experience = attackPlayer:getExperience()
                local expFormula = ((experience / 100) * 0.75)
                player:addExperience(math.floor(expFormula), true)
                else
                local experience = attackPlayer:getExperience()
                local expFormula = ((experience / 100) * 0.25)
                player:addExperience(math.floor(expFormula), true)
                end
            end
        end
    end
end

Not sure if works but it should be something like that.
Right now it should be if player is less than 300 he will get experience 0.75
else (hes over 300)
he will get experience X 0.25

You could continue that list with "elseif" e,g //if player:getLevel() < 150 and player:getLevel() > 100
 
I found one of my old script, see if you can do something with it

PHP:
        local percent = config.percentExp -- you get 5% experience from enemys total exp
        local xp = getPlayerExperience(cid) -- fetch enemy experience
        local calc = ((xp/100) * percent) -- calculate 1% of enemy experience, and multiply it with configured "percent"
        local gain = math.floor(calc) -- Make sure the value is integer (etc 230 instead of 230,123123123)
        doPlayerAddExperience(lastHit, gain) -- gives you the calculated experience
        doCreatureSetStorage(lastHit, config.lastKillerStorage, getPlayerIp(cid))
    end
 
Code:
function onKill(cid, target, lastHit)
config = {
    percentExp = 4,
}
        local percent = config.percentExp -- you get 5% experience from enemys total exp
        local xp = getPlayerExperience(cid) -- fetch enemy experience
        local calc = ((xp/100) * percent) -- calculate 1% of enemy experience, and multiply it with configured "percent"
        local gain = math.floor(calc) -- Make sure the value is integer (etc 230 instead of 230,123123123)
        doPlayerAddExperience(lastHit, gain) -- gives you the calculated experience
    end

have one error need fix

Code:
(luaDoPlayerAddExperience) Player not found
 
pacos_zps1ee29707.png
[/URL]

this is whats is happening :s
killing a high lvl character gives a massive amount of experiencie plzz help!
 
this one?

The exp rate in config.lua is fine, a lvl 100 kills another 100 player he gains one level,
but this.. i think its like a bonus for killing high lvl players, i dont want that heheh

How about this formula in player.cpp

Code:
/*
        Formula
        a = attackers level * 0.9
        b = victims level
        c = victims experience

        result = (1 - (a / b)) * 0.05 * c
        Not affected by special multipliers(!)
    */
    uint32_t a = (uint32_t)std::floor(attackerLevel * 0), b = level;
    uint64_t c = getExperience();
    return (double)std::max((uint64_t)0, (uint64_t)std::floor(getDamageRatio(attacker)
        * std::max((double)0, ((double)(1 - (((double)a / b))))) * 0.01 * c)) * rate;
 
uint64_t c = is the victim experience, maybe for that you are getting alot experience, test this if works

PHP:
return (double)std::max((uint64_t)0, (uint64_t)std::floor(getDamageRatio(attacker)
        * std::max((double)0, ((double)(1 - (((double)a / b))))) * 0.01 * (c * 10 / 100))) * rate;
 
Back
Top