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

Offline Training Fast Up

Tibianos

New Member
Joined
Oct 24, 2018
Messages
3
Reaction score
0
Hello guys. Can anyone help me?
I have a 10.98 server, tfs 1.2 and the players reported the fast up of the offline training.
In config.lua, the skills are 5x and magic 3x, not easy. But, in a turn offline, the magic level up 1 to 60, absurd. It's possible leave the same exp rate of the config lua?

My offlinetraining.lua in creature scripts:
function onLogin(player)
local lastLogout = player:getLastLogout()
local offlineTime = lastLogout ~= 0 and math.min(os.time() - lastLogout, 86400 * 21) or 0
local offlineTrainingSkill = player:getOfflineTrainingSkill()
if offlineTrainingSkill == -1 then
player:addOfflineTrainingTime(offlineTime * 1000)
return true
end

player:setOfflineTrainingSkill(-1)

if offlineTime < 600 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be logged out for more than 10 minutes to start offline training.")
return true
end

local trainingTime = math.max(0, math.min(offlineTime, math.min(43200, player:getOfflineTrainingTime() / 1000)))
player:removeOfflineTrainingTime(trainingTime * 1000)

local remainder = offlineTime - trainingTime
if remainder > 0 then
player:addOfflineTrainingTime(remainder * 1000)
end

if trainingTime < 60 then
return true
end

local text = "During your absence you trained for"
local hours = math.floor(trainingTime / 3600)
if hours > 1 then
text = string.format("%s %d hours", text, hours)
elseif hours == 1 then
text = string.format("%s 1 hour", text)
end

local minutes = math.floor((trainingTime % 3600) / 60)
if minutes ~= 0 then
if hours ~= 0 then
text = string.format("%s and", text)
end

if minutes > 1 then
text = string.format("%s %d minutes", text, minutes)
else
text = string.format("%s 1 minute", text)
end
end

text = string.format("%s.", text)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, text)

local vocation = player:getVocation()
local promotion = vocation:getPromotion()
local topVocation = not promotion and vocation or promotion

local updateSkills = false
if isInArray({SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE}, offlineTrainingSkill) then
local modifier = topVocation:getAttackSpeed() / 1000
updateSkills = player:addOfflineTrainingTries(offlineTrainingSkill, (trainingTime / modifier) / (offlineTrainingSkill == SKILL_DISTANCE and 4 or 2))
elseif offlineTrainingSkill == SKILL_MAGLEVEL then
local gainTicks = topVocation:getManaGainTicks() * 2
if gainTicks == 0 then
gainTicks = 1
end

updateSkills = player:addOfflineTrainingTries(SKILL_MAGLEVEL, trainingTime * (vocation:getManaGainAmount() / gainTicks))
end

if updateSkills then
player:addOfflineTrainingTries(SKILL_SHIELD, trainingTime / 4)
end

return true
end

Thanks!
 
Lua:
updateSkills = player:addOfflineTrainingTries(SKILL_MAGLEVEL, trainingTime * (vocation:getManaGainAmount() / gainTicks))

Maybe try to multiply that by 0.8 or something like that

Lua:
updateSkills = player:addOfflineTrainingTries(SKILL_MAGLEVEL, (trainingTime * (vocation:getManaGainAmount() / gainTicks) * 0.8))

This way it will be 80% of what is right now.

Also, I don't think from 1 to 60 is a lot with magic 3x given that in rl tibia you would probably get around 1 to 20 in 12 hours of training mag level, from there it gets harder.
 
Back
Top