Hultin
Member
- Joined
- Dec 2, 2008
- Messages
- 262
- Reaction score
- 17
This code is simple, and replace the already existing code in \events\scripts\player.lua (at the very bottom) but it allows you to do all lua skill stages, this is extremly useful on servers where the level/skills offset is way off of normal tibia or where there are no trainers (or both!) as is the case on my server.
Edit: Forgot to add :getBase() to voc, this allows this to work on both promoted and unpromoted characters.
Code cleanup
Code:
function Player:onGainSkillTries(skill, tries)
local lowMuliplier = 2 -- Multiplier if your skill is lower than lowSkill/lowMagic
local lowSkill, lowMagic = 60, 40 -- Level which the muliplier stops being active, set to 0 to disable.
if APPLY_SKILL_MULTIPLIER == false then
return tries
end
local voc = self:getVocation():getBase():getId()
if skill == SKILL_MAGLEVEL then
if self:getMagicLevel() < lowMagic and (voc == 1 or voc == 2) then
return tries * (configManager.getNumber(configKeys.RATE_MAGIC)*lowMuliplier)
end
return tries * configManager.getNumber(configKeys.RATE_MAGIC)
end
if self:getSkillLevel(skill) < lowSkill and (voc == 3 or voc == 4) then
return tries * (configManager.getNumber(configKeys.RATE_SKILL)*lowMuliplier)
end
return tries * configManager.getNumber(configKeys.RATE_SKILL)
end
Edit: Forgot to add :getBase() to voc, this allows this to work on both promoted and unpromoted characters.
Code cleanup
Last edited: