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

[REQUEST] With x player in the party, more EXP

RaioX

New Member
Joined
Mar 1, 2009
Messages
9
Reaction score
0
I would like to encourage the group hunting in my server. Example, if my party has 2 members, more 10%, if has 3 members, more 20%, if has 4 members 30%, and just. The TFS is 1.0, there's no one option in the config.lua. What can I do?
 
If you're using tfs 1.1 you can use onGainExperience to do that. (events)
Assuming you're using tfs version which already has onGainExperience on lua.

Something like this: (added "additional party member count bonus")
I didn't test it, but tell me if it doesn't work.
Code:
function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
        return exp
    end

    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end

    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())
   
    -- Additional party member count bonus
    if self:getParty() ~= nil then
        local memberCount = party:getMemberCount()
        if memberCount == 1 then
            exp = exp*1.1 -- 10%
        elseif memberCount == 2 then
            exp = exp*1.2
        elseif memberCount >= 3 then
            exp = exp*1.3
        end
    end

    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 then
            exp = exp * 1.5
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
    return exp
end
 
I will update to TFS 1.1, but, by now I can't. Please, don't erase your message above, I'll try in the future. I was searching and I think it only can be changed in the source. I found this on party.cpp. Can you calculate?

Code:
voidParty::shareExperience(uint64_t experience){
   uint32_t shareExperience =(uint64_t)std::ceil((((double)experience /(memberList.size()+1))+((double)experience *0.05)));
   for(Player* member : memberList){
     member->onGainSharedExperience(shareExperience);
   }
   leader->onGainSharedExperience(shareExperience);}
 
Back
Top