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

Lua Adding Exactly 1 skill level

slavi

#define SLAVI32 _WIN32
Senator
Joined
Sep 9, 2015
Messages
681
Solutions
11
Reaction score
560
GitHub
slavidodo
Someone here has idea on how to do a such thing?

Tfs 1.2
 
Last edited:
tfs 1.2 @mdwilliams any idea?
Code:
  local vocation = player:getVocation()
  local level = player:getSkillLevel(SKILL_SWORD)
  local reqtries = vocation:getRequiredSkillTries(SKILL_SWORD, level+1)
  local curtries = player:getSkillTries(SKILL_SWORD)
  if reqtries-curtries > 0 then
      player:addSkillTries(SKILL_SWORD, reqtries-curtries)
  end
 
Last edited:
Code:
  local vocation = player:getVocation()
  local level = player:getSkillLevel(SKILL_SWORD)
  local reqtries = vocation:getRequiredSkillTries(SKILL_SWORD, level+1)
  local curtries = player:getSkillTries(SKILL_SWORD)
  if reqtries-curtries > 0 then
      player:addSkillTries(SKILL_SWORD, reqtries-curtries)
  end
Thanks, but that's not what I mean exactly.

I mean if I am 50 % of sword skill at lvl 40, I should be 50% of lvl 41% not just completing the level!
 
Thanks, but that's not what I mean exactly.

I mean if I am 50 % of sword skill at lvl 40, I should be 50% of lvl 41% not just completing the level!
Code:
function Player:addLevel(skillId)
    local curSkill = self:getSkillLevel(skillId)
    local curTries = self:getSkillTries(skillId)
    local voc = self:getVocation()
    local nextTries = voc:getRequiredSkillTries(skillId, curSkill + 1)
    self:addSkillTries(skillId, nextTries - curTries + curTries / nextTries * voc:getRequiredSkillTries(skillId, curSkill + 2))
end

It will decrease some of the percentage if you add it too many times (not much.)
 
Back
Top