• 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 1.X+ Adding Magic Level points to the player

.Smile

Member
Joined
Jan 27, 2019
Messages
29
Reaction score
11
I'm using TFS 1.3 and I'm trying to add the player's Magic Level with the function

player: addSkillTries (SKILL_MAGLEVEL, 2)

but the Magic Level does not increase, what is the correct way to add Magic Level to the player?
 
Solution
You're supposed to use manaSpent for this.
Try this out (I am unable to test atm):
LUA:
function Player.addMagicLevel(self, amt)
    local new = self:getBaseMagicLevel() + amt
    local manaSpent = self:getManaSpent()
    self:addManaSpent(self:getVocation():getRequiredManaSpent(new + 1) - manaSpent)
end

Usage:
LUA:
player:addMagicLevel(3) -- add 3 magic levels to player
I'm using TFS 1.3 and I'm trying to add the player's Magic Level with the function

player: addSkillTries (SKILL_MAGLEVEL, 2)

but the Magic Level does not increase, what is the correct way to add Magic Level to the player?
Hi,
Try this:

LUA:
local magicLevelAmount = 10 --Amount to gain
local skillTypeToGain = SKILL_MAGLEVEL --Skill type
local requiredTries = player:getVocation():getRequiredSkillTries(skillTypeToGain, magicLevelAmount) --get required tries to reach skill level
player:addSkillTries(skillTypeToGain, requiredTries) --give needed tries
 
Hi,
Try this:

LUA:
local magicLevelAmount = 10 --Amount to gain
local skillTypeToGain = SKILL_MAGLEVEL --Skill type
local requiredTries = player:getVocation():getRequiredSkillTries(skillTypeToGain, magicLevelAmount) --get required tries to reach skill level
player:addSkillTries(skillTypeToGain, requiredTries) --give needed tries

Unfortunately it didn't work = /
 
You're supposed to use manaSpent for this.
Try this out (I am unable to test atm):
LUA:
function Player.addMagicLevel(self, amt)
    local new = self:getBaseMagicLevel() + amt
    local manaSpent = self:getManaSpent()
    self:addManaSpent(self:getVocation():getRequiredManaSpent(new + 1) - manaSpent)
end

Usage:
LUA:
player:addMagicLevel(3) -- add 3 magic levels to player
 
Solution
You're supposed to use manaSpent for this.
Try this out (I am unable to test atm):
LUA:
function Player.addMagicLevel(self, amt)
    local new = self:getBaseMagicLevel() + amt
    local manaSpent = self:getManaSpent()
    self:addManaSpent(self:getVocation():getRequiredManaSpent(new + 1) - manaSpent)
end

Usage:
LUA:
player:addMagicLevel(3) -- add 3 magic levels to player

Unfortunately it didn't work and didn't return any errors
 
Back
Top