• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 1.2] Set exp rate in game

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
313
Solutions
3
Reaction score
67
Hello,

I noticed that it was possible to change the exp rate using the function
doPlayerSetExperienceRate.
Is it still possible to do it in TFS 1.2? I don't use stages.


Thanks in advance.
 
What exactly do you want to do?

This will add %50 more exp if player is in party

Code:
    -- Party Bonus
    if self:getParty() then
        exp = exp * 0.5
    end
 
I want to increase the exp for the players during two days of the week.
I'll change the exp on login.lua and will implement a global event to reset the experience rate back to normal to all online players when the day is over.

The problem is, the function doPlayerSetExperienceRate is not on TFS 1.2, so, I don't know how to change the exp gain.
 
Depending on what type of server you're running, there are various ways of encountering this "issue". If you simply want all players to have an increased amount of earned exp from the day you decide until you decide it should end, then the easiest way to do so is by doing with Raxon said in the above post. However, like I said you can encounter this issue with other solutions, such as making a talkaction script for every player on the server to freely enable it if it's available and then it gets automatically disabled after a set period of time. Although the easiest method of solving this issue is by doing what @Raxon said. That is if I understood your question correctly.
 
Code:
local config =  {
  ["Monday"] = 1.0,
   ["Tuesday"] = 1.0,
   ["Wednesday"] = 1.0,
   ["Thursday"] = 1.0,
   ["Friday"] = 1.0,
   ["Saturday"] = 1.5,
   ["Sunday"] = 2.0
}

function Player:onGainExperience(source, exp, rawExp)
  return exp = exp * config[os.date("%A")]
end
also an easy table w/ functions inside could be made for each day
 
Code:
local config =  {
  ["Monday"] = 1.0,
   ["Tuesday"] = 1.0,
   ["Wednesday"] = 1.0,
   ["Thursday"] = 1.0,
   ["Friday"] = 1.0,
   ["Saturday"] = 1.5,
   ["Sunday"] = 2.0
}

function Player:onGainExperience(source, exp, rawExp)
  return exp = exp * config[os.date("%A")]
end
dont work for me :/
 

Similar threads

Back
Top