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

Addskill

Mera Mero

Guess Who?
Joined
Dec 27, 2014
Messages
417
Reaction score
86
Hello otlanders I've got problem with addskill command , When i use this command with skills like Magic/Distance etc it doesn't level up it full i mean it only give me like 60,80,90% And i can't use this command again until i pass this level
Code:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local t = string.explode(param, ",")
    if(not t[2]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params.")
        return true
    end

    local pid = getPlayerByNameWildcard(t[1])
    if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
        return true
    end

    t[2] = t[2]:lower()
    local skill = SKILL_IDS[t[2]]
    if(not skill) then
        local tmp = t[2]:sub(1, 1)
        if(tmp == 'l' or tmp == 'e') then
            skill = SKILL__LEVEL
        elseif(tmp == 'm') then
            skill = SKILL__MAGLEVEL
        else
            skill = tonumber(t[2])
            if(not skill or skill < SKILL_FIRST or SKILL > SKILL__LAST) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such skill does not exists.")
                return true
            end
        end
    end

    local amount = tonumber(t[3])
    if(not amount or amount == 0) then
        amount = 1
    end

    doPlayerAddSkill(pid, skill, amount, true)
    return true
end
 
It's because of Skill Multiplier in vocations.xml

If you pass for every skill for every voc value 1.0, you can add more than 180 of skill, the higher multiplier is the lower max value of skill you can get.
 
It's because of Skill Multiplier in vocations.xml

If you pass for every skill for every voc value 1.0, you can add more than 180 of skill, the higher multiplier is the lower max value of skill you can get.
Yes for example this skill of pally its got more than 1.0 but i still can't understand what can i do to make it work good when i use command :(
Code:
<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
 
Lets do some research! No one knows everything, but everyone has all the tools they need to fix any problem.

So open TFS 0.3.6 source and lets search for "doPlayerAddSkill"

Then you notice... HMMM it doesn't exist maybe its an lua added function, so you search the lib folder.
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
So the part here that is for distance is:
Code:
   for i = 1, amount do
     doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
   end

Ok, so it's only giving you 90% of a distance level, instead of 100%. So maybe that formula is not correct for some reason.
Code:
getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)

so to test this? lets just do this.
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
     local requiredTries = getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1)
     local currentTries = getPlayerSkillTries(cid, skill)), 1)
     local neededTries = requiredTries - currentTries
     doCreatureSay(cid, "Skill to next level: "..requiredTries.." Current Skill Tries: "..currentTries.." Difference: "..neededTries, 1)
     doPlayerAddSkillTry(cid, skill, neededTries, false)
   end

   return true
end

Change the above function in 050-functions.lua in the lib folder, and then try to add distance again.
Then post what your creature says outloud here, and we will know what it is trying to add.
 
Lets do some research! No one knows everything, but everyone has all the tools they need to fix any problem.

So open TFS 0.3.6 source and lets search for "doPlayerAddSkill"

Then you notice... HMMM it doesn't exist maybe its an lua added function, so you search the lib folder.
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
So the part here that is for distance is:
Code:
   for i = 1, amount do
     doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
   end

Ok, so it's only giving you 90% of a distance level, instead of 100%. So maybe that formula is not correct for some reason.
Code:
getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)

so to test this? lets just do this.
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
     local requiredTries = getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1)
     local currentTries = getPlayerSkillTries(cid, skill)), 1)
     local neededTries = requiredTries - currentTries
     doCreatureSay(cid, "Skill to next level: "..requiredTries.." Current Skill Tries: "..currentTries.." Difference: "..neededTries, 1)
     doPlayerAddSkillTry(cid, skill, neededTries, false)
   end

   return true
end

Change the above function in 050-functions.lua in the lib folder, and then try to add distance again.
Then post what your creature says outloud here, and we will know what it is trying to add.
Its my old addskill script on lua function
Code:
function doPlayerAddSkill(cid, skill, amount, round)
    if(skill == SKILL__LEVEL) then
        return doPlayerAddLevel(cid, amount, round)
    elseif(skill == SKILL__MAGLEVEL) then
        return doPlayerAddMagLevel(cid, amount)
    end

    return doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill'))
end
And i changed it with your script after then started my server and guess what i found everything not working on my server o_O and got like 200 errors cuz of this symbol
Code:
[04/03/2015 13:54:17] [Error - LuaScriptInterface::loadFile] data/lib/050-function.lua:385: unexpected symbol near ')'
[04/03/2015 13:54:18] [Warning - LuaScriptInterface::initState] Cannot load data/lib/
And this is some of errors
Code:
[04/03/2015 13:52:03] data/spells/scripts/attack/hells core.lua:4: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:03] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/hells core.lua)
[04/03/2015 13:52:03] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:03] [Error - Spell Interface]
[04/03/2015 13:52:03] data/spells/scripts/attack/divine caldera.lua
[04/03/2015 13:52:03] Description:
[04/03/2015 13:52:03] data/spells/scripts/attack/divine caldera.lua:4: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:03] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/divine caldera.lua)
[04/03/2015 13:52:03] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:04] [Error - Spell Interface]
[04/03/2015 13:52:04] data/spells/scripts/attack/eternal winter.lua
[04/03/2015 13:52:04] Description:
[04/03/2015 13:52:04] data/spells/scripts/attack/eternal winter.lua:4: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:04] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/eternal winter.lua)
[04/03/2015 13:52:04] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:04] [Error - Spell Interface]
[04/03/2015 13:52:04] data/spells/scripts/attack/ice winter.lua
[04/03/2015 13:52:04] Description:
[04/03/2015 13:52:04] data/spells/scripts/attack/ice winter.lua:4: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:05] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/ice winter.lua)
[04/03/2015 13:52:05] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:05] [Error - Spell Interface]
[04/03/2015 13:52:05] data/spells/scripts/attack/ice wave.lua
[04/03/2015 13:52:05] Description:
[04/03/2015 13:52:05] data/spells/scripts/attack/ice wave.lua:5: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:05] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/ice wave.lua)
[04/03/2015 13:52:05] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:06] [Error - Spell Interface]
[04/03/2015 13:52:06] data/spells/scripts/attack/terra wave.lua
[04/03/2015 13:52:06] Description:
[04/03/2015 13:52:06] data/spells/scripts/attack/terra wave.lua:5: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:06] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/terra wave.lua)
[04/03/2015 13:52:06] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:06] [Error - Spell Interface]
[04/03/2015 13:52:06] data/spells/scripts/attack/wrath of nature.lua
[04/03/2015 13:52:06] Description:
[04/03/2015 13:52:07] data/spells/scripts/attack/wrath of nature.lua:4: attempt to call global 'setAttackFormula' (a nil value)
[04/03/2015 13:52:07] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/wrath of nature.lua)
[04/03/2015 13:52:07] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:07] [Error - Spell Interface]
[04/03/2015 13:52:07] data/spells/scripts/healing/light healing.lua
[04/03/2015 13:52:07] Description:
[04/03/2015 13:52:07] data/spells/scripts/healing/light healing.lua:6: attempt to call global 'setHealingFormula' (a nil value)
[04/03/2015 13:52:07] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/healing/light healing.lua)
[04/03/2015 13:52:07] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:08] [Error - Spell Interface]
[04/03/2015 13:52:08] data/spells/scripts/healing/intense healing.lua
[04/03/2015 13:52:08] Description:
[04/03/2015 13:52:08] data/spells/scripts/healing/intense healing.lua:6: attempt to call global 'setHealingFormula' (a nil value)
[04/03/2015 13:52:08] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/healing/intense healing.lua)
[04/03/2015 13:52:08] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:08] [Error - Spell Interface]
[04/03/2015 13:52:08] data/spells/scripts/healing/heal friend.lua
[04/03/2015 13:52:08] Description:
[04/03/2015 13:52:08] data/spells/scripts/healing/heal friend.lua:6: attempt to call global 'setHealingFormula' (a nil value)
[04/03/2015 13:52:09] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/healing/heal friend.lua)
[04/03/2015 13:52:09] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:09] [Error - Spell Interface]
[04/03/2015 13:52:09] data/spells/scripts/healing/ultimate healing.lua
[04/03/2015 13:52:09] Description:
[04/03/2015 13:52:09] data/spells/scripts/healing/ultimate healing.lua:6: attempt to call global 'setHealingFormula' (a nil value)
[04/03/2015 13:52:09] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/healing/ultimate healing.lua)
[04/03/2015 13:52:10] data/lib/050-function.lua:385: unexpected symbol near ')'

[04/03/2015 13:52:10] [Error - Spell Interface]
[04/03/2015 13:52:10] data/spells/scripts/healing/mass healing.lua
[04/03/2015 13:52:10] Description:
[04/03/2015 13:52:10] data/spells/scripts/healing/mass healing.lua:7: attempt to call global 'setHealingFormula' (a nil value)
[04/03/2015 13:52:10] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/healing/mass healing.lua)
[04/03/2015 13:52:10] data/lib/050-function.lua:385: unexpected symbol near ')'
 
Sorry had a parathesis off.

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
local requiredTries = getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1)
local currentTries = getPlayerSkillTries(cid, skill), 1)
local neededTries = requiredTries - currentTries
doCreatureSay(cid, "Skill to next level: "..requiredTries.." Current Skill Tries: "..currentTries.." Difference: "..neededTries, 1)
doPlayerAddSkillTry(cid, skill, neededTries, false)
end

return true
end
 
Sorry had a parathesis off.

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
local requiredTries = getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1)
local currentTries = getPlayerSkillTries(cid, skill), 1)
local neededTries = requiredTries - currentTries
doCreatureSay(cid, "Skill to next level: "..requiredTries.." Current Skill Tries: "..currentTries.." Difference: "..neededTries, 1)
doPlayerAddSkillTry(cid, skill, neededTries, false)
end

return true
end
Aff same errors :(
Code:
[04/03/2015 13:54:17] [Error - LuaScriptInterface::loadFile] data/lib/050-function.lua:385: unexpected symbol near ')'
[04/03/2015 13:54:18] [Warning - LuaScriptInterface::initState] Cannot load data/lib/
 
Yea i'm still stupid.

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
local requiredTries = getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1)
local currentTries = getPlayerSkillTries(cid, skill)
local neededTries = requiredTries - currentTries
doCreatureSay(cid, "Skill to next level: "..requiredTries.." Current Skill Tries: "..currentTries.." Difference: "..neededTries, 1)
doPlayerAddSkillTry(cid, skill, neededTries, false)
end

return true
end

THAT should work and give you a message when using the talkaction, just paste what your character says back here.
 
Yea i'm still stupid.

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
local requiredTries = getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1)
local currentTries = getPlayerSkillTries(cid, skill)
local neededTries = requiredTries - currentTries
doCreatureSay(cid, "Skill to next level: "..requiredTries.." Current Skill Tries: "..currentTries.." Difference: "..neededTries, 1)
doPlayerAddSkillTry(cid, skill, neededTries, false)
end

return true
end

THAT should work and give you a message when using the talkaction, just paste what your character says back here.
Same percents 99% with magic level and with distance found these messages
Code:
23:44 Wars [3001]: Skill to next level: 30 Current Skill Tries: 0 Difference: 30
23:45 Shaggy[3001]: Skill to next level: 53 Current Skill Tries: 0 Difference: 53
23:47 Shaggy[3001]: Skill to next level: 97 Current Skill Tries: 0 Difference: 97
23:47 Shaggy[3001]: Skill to next level: 174 Current Skill Tries: 0 Difference: 174
23:47 Shaggy[3001]: Skill to next level: 314 Current Skill Tries: 0 Difference: 314
23:47 Shaggy[3001]: Skill to next level: 566 Current Skill Tries: 0 Difference: 566
23:47 Shaggy[3001]: Skill to next level: 1020 Current Skill Tries: 0 Difference: 1020
23:47 Shaggy[3001]: Skill to next level: 1836 Current Skill Tries: 0 Difference: 1836
And when i tried to level my axe found these messages
Code:
23:50 Shaggy[3001]: Skill to next level: 50 Current Skill Tries: 0 Difference: 50
23:50 Shaggy[3001]: Skill to next level: 89 Current Skill Tries: 0 Difference: 89
23:50 Shaggy[3001]: Skill to next level: 161 Current Skill Tries: 0 Difference: 161
23:50 Shaggy[3001]: Skill to next level: 291 Current Skill Tries: 0 Difference: 291
EDITED
but its gave me 1 skill with distance/axe
 
Last edited:
What are you typing in? and what happens?

For example are you doing like "/addskill shaggy, distance, 5000" but then you only get 1 skill?

To me it looks like it may be working.
 
What are you typing in? and what happens?

For example are you doing like "/addskill shaggy, distance, 5000" but then you only get 1 skill?

To me it looks like it may be working.
I typed /addskill shaggy,distance,1 and got these message after every one btw i tried to make up level for distance and this distance was 170 i found like
Skill to next level: 2341652 Current Skill Tries: 0 Difference: 21646543
but with these errors which i posted before my distance was 10 only
 
Ok I have an idea, since it's hard to understand what you are saying, i'll just make a total debug information thing...

Code:
function doPlayerAddSkill(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
   
   doCreatureSay(cid, str, 1)
   return true
end
 
Ok I have an idea, since it's hard to understand what you are saying, i'll just make a total debug information thing...

Code:
function doPlayerAddSkill(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
  
   doCreatureSay(cid, str, 1)
   return true
end
Ah sorry for my bad English Btw Its working good with all skills instead of magic :p i mean its give 99.9 only and i needed to use spell to pass level of it
 
Back
Top