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

TFS 0.X Add 3 skills

gmstrikker

Well-Known Member
Joined
Jul 30, 2014
Messages
458
Solutions
1
Reaction score
50
Is it possible to do
Code:
doPlayerAddSkillTry(cid, SKILL_DISTANCE, XXX)

And this XXX is the am mount needed for 2,3,5 skills or how many i decide?
 
Solution
/ getConfigInfo('rateMagic')
Lua:
function doPlayerAddMagLevels(cid, amount)
local amount = amount or 1
   for i = 1, amount do
     doPlayerAddSpentMana(cid,math.ceil((getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic')))
     end
   return true
end
doPlayerAddMagLevels(cid, 5)
why not just use doPlayerAddSkill(cid, skill, amount, round) ?

for example, add 5 distance:

doPlayerAddSkill(cid, SKILL_DISTANCE, 5)

Imagine if i have skill 59, 1% to 60...
this 1% will count as one :/

And if i want to add 0.5?
I think i should need doPlayerAddSkillTry, i'm wrong?
 
Lua:
local skill = SKILL_DISTANCE
doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill'))
 
Lua:
local skill = SKILL_DISTANCE
doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill'))

This +1 is the amount?
I tried to put +3 and just add one skill...

--

What about ML, what is the formula?
 
Lua:
function doPlayerAddMagLevel(cid, amount)
    for i = 1, amount do
        doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic'))
    end
    return true
end

edit, working on
 
Last edited:
you can use this one
Lua:
function doPlayerAddSkills(cid, skill, amount, round)
   local str = "Doing doPlayerAddSkill(cid, "..skill..", "..amount..")/n"
   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
  
   str = str.."Starting Skill Level: "..getPlayerSkillLevel(cid, skill)..""
   for i = 1, amount do
     local currentSkill = getPlayerSkillLevel(cid, skill)
     local nextSkill = currentSkill+1
     local requiredTries = getPlayerRequiredSkillTries(cid, skill, nextSkill)
     local currentTries = getPlayerSkillTries(cid, skill)
     local neededTries = requiredTries - currentTries
     str = str.."/nAdding "..neededTries.." skill tries to "..currentTries.." current tries..."
     doPlayerAddSkillTry(cid, skill, neededTries, false)
     if getPlayerSkillLevel(cid, skill) == nextSkill then
       str = str.."SUCCESS!"
     else
       str = str.."FAILURE! Player Skill: "..getPlayerSkillLevel(cid, skill)..""
     end
   end

   return true
end
doPlayerAddSkills(cid, SKILL_NAME, x)
for example
doPlayerAddSkills(cid, SKILL_SWORD, 5)
found in old data
 
Lua:
function doPlayerAddMagLevel(cid, amount)
    for i = 1, amount do
        doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic'))
    end
    return true
end

What i'm doing wrong here:
Code:
                local ml_add = 0
                if (getPlayerMagLevel(cid) >= 1 and getPlayerMagLevel(cid) <= 40 ) then
                    ml_add = 3
                elseif (getPlayerMagLevel(cid) >= 41 and getPlayerMagLevel(cid) <= 50 ) then
                    ml_add = 2
                elseif (getPlayerMagLevel(cid) >= 51 and getPlayerMagLevel(cid) <= 60 ) then
                    ml_add = 1
                end
                if ml_add == 0 then
                    selfSay(limitStr, cid)
                    return false
                else
                    function doPlayerAddMagLevel(cid, amount)
                        for i = 1, amount do
                            local nextSkill = getPlayerMagLevel(cid, true) + 1
                            local requiredTries = getPlayerRequiredMana(cid, nextSkill) - getPlayerSpentMana(cid)
                            doPlayerAddSpentMana(cid, requiredTries)
                        end
                        return true
                    end
                    doPlayerAddMagLevel(cid, ml_add)
                end
???

In my last test for example, i got from ml 56 to ml 61
it is adding 5 mls
it should add 1
 
/ getConfigInfo('rateMagic')
Lua:
function doPlayerAddMagLevels(cid, amount)
local amount = amount or 1
   for i = 1, amount do
     doPlayerAddSpentMana(cid,math.ceil((getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic')))
     end
   return true
end
doPlayerAddMagLevels(cid, 5)
 
Solution
Back
Top