function Player.addMagicLevel(self, amt)
local new = self:getBaseMagicLevel() + amt
local manaSpent = self:getManaSpent()
self:addManaSpent(self:getVocation():getRequiredManaSpent(new + 1) - manaSpent)
end
player:addMagicLevel(3) -- add 3 magic levels to player
Hi,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?
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
Any errors?Unfortunately it didn't work = /
Any errors?
function Player.addMagicLevel(self, amt)
local new = self:getBaseMagicLevel() + amt
local manaSpent = self:getManaSpent()
self:addManaSpent(self:getVocation():getRequiredManaSpent(new + 1) - manaSpent)
end
player:addMagicLevel(3) -- add 3 magic levels to player
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
Where are you using it? There's no way nothing happens at all.