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

Is there any way to eliminate FREEZ while using doPlayerAddMagLevel/doPlayerAddSkill?

arbuzzo

New Member
Joined
Dec 11, 2012
Messages
22
Reaction score
0
Just like the tittle says. I've got two those functions working, however they lag. They lag because If I want to add 60 ml to some1, its using loop from 1 to 60 and it's retarded. Isn't there some simpler way to do that? doPlayerAddLevel is not lagging at all because it's just a 1 command. AddingLevel is using getExperienceForLevel so it doesn't has to count it all over again, just once.

What do you guys think about it? Is there somewhere an already written script that can help me? :P
 
As with just about everything, it all depends on what distribution and version you are running.
In TFS 0.3.6 there is no great way to do what you want with those functions -- I had the same problem the war server I created and released - Simple War OT.
It actually sounds like you are trying to use my horribly inefficient script!
0.3.7-preview and 0.4x both have updated functions to handle this.

In the meantime, you do have a few options.
You can source edit the account manager to give appropriate skills when the character is created if you are set on using an in game account manager.
You can try to change the way the function works in 050-function.lua
Otherwise overcoming this is very easy using a web ACC. Probably no explanation required here.

050-function.lua extract taken from 0.3.7-preview.
I am unsure if this will work straight off if you just replace the same functions from you file, though.
Code:
function doPlayerAddSkill(cid, skill, amount, round)
        local amount = amount or 1
        if(skill == SKILL__LEVEL) then
                return doPlayerAddLevel(cid, amount, round)
        elseif(skill == SKILL__MAGLEVEL) then
                return doPlayerAddMagLevel(cid, amount)
        end

        for i = 1, amount do
                doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
        end

        return true
end

...

function doPlayerAddMagLevel(cid, amount)
        local amount = amount or 1
        for i = 1, amount do
                doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false)
        end

        return true
end
 
Last edited:
Back
Top