Jump to content

[Help] Allow the player to gain XP even when he is at max


Ersir

Recommended Posts

Hi,

 

So I've been trying to find a way to still receive XP from a skill when that particular XP is already at its max level (e.g : get woodwork XP when building wooden floor while being a lvl 10 carpenter).

 

My original thoughts was to increase the max level, which I did, but as I suspected, that only had an effect on the GUI element (make sense considering I was modifying a GUI element/pane in the client directory, that file being /client/XpSystem/ISUIISSkillProgressBar.lua).

 

Then I though I could simply remove the 10th skill lvl from given character. But that doesn't seem to be working. I could'nt find a way to remove XP, wether I use the various functions with a negative value or tried to set it back to a certain lvl, that simply didn't seem to work (Current script below in spoiler).

 

If you have any idea regarding the feasibility of it, I'm all ears :D

 

Cheers !

 




local function doPrint(txt)
    print("-->ResetToLevelNineErsir::"..txt)
end

local function doPerkLimitation()
    local perkList = PerkFactory.PerkList
    local perkListSize = perkList:size()    

    doPrint("Perks to loop :"..perkListSize)

    for i = 0, perkListSize-1 do -- loop through PerkList
        local perk = perkList:get(i)
        local skill = perk:getType()
        local perkLevel = getPlayer():getPerkLevel(skill)
        if perkLevel > 9 then -- if maxed-out then put it to 9
            doPrint("Found a perk where max level is reached:"..tostring(skill))
            getPlayer():getXp():setXPToLevel(skill, 0) -- tried that
            getPlayer():getXp():AddXPNoMultiplier(skill, -5000) -- that too
            getPlayer():getXp():AddXP(Perks.Woodwork, -10000); -- and even the same function with the direct enum ref, just in case
            doPrint("Removed XP:")
            for i = 1,9 do -- then set it
                --player:LevelPerk(skill, false) -- though I would be lvl up back using that, but was never used because I couldn't get anywhere near removing XP/skill lvl
            end
        end
    end
    
end

Events.OnGameStart.Add(doPerkLimitation)

Edited by Ersir
additional details
Link to comment
Share on other sites

This would not be to bad an idea since say once you hit tenth level all skill book multipliers would be gone and you gain at regular level. But this still could be abused as it might be slower gains with carpentry it still is easy enough to do. Maybe once hit tenth drop it to normal skill level but at 0.25 percent gain.

 

Avg Skill Lvl / 4

 

Slow but it would still assist.

Link to comment
Share on other sites

I don't have any problem with that, and your suggestions are welcome, I just wanted to be sure I was expressing myself clearly ^^

Again, if anyone has an idea regarding the way to remove a skill level, that would be much appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...