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

[TFS1.2]How do you turn off the exp stamina hour bonus?

Haskys

Member
Joined
Jul 19, 2019
Messages
97
Reaction score
8
Location
Poland
Hello,
How do you turn off the exp stamina hour bonus?
Or modify the number of hours for which the bonus falls?

TFS 1.2

stamina.png
 
Solution
S
Lua:
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5     -- 1 = 0% bonus , 1.5 =50% bonus so the 1 is 100% and the 1.5 is 150% = 100% the normal and 50% the bonus
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
this can be found in player.lua
function Player:eek:nGainExperience(source, exp, rawExp)
dont forget to open events.xml and change this
Code:
    <event class="Player" method="onGainExperience" enabled="0" />
to this just enabled it from 0 to 1
Code:
    <event class="Player"...
Events.xml
and in events/scripts/player.lua
this functions
Code:
local function useStamina(player)
    local staminaMinutes = player:getStamina()
    if staminaMinutes == 0 then
        return
    end

    local playerId = player:getId()
    local currentTime = os.time()
    local timePassed = currentTime - nextUseStaminaTime[playerId]
    if timePassed <= 0 then
        return
    end

    if timePassed > 60 then
        if staminaMinutes > 2 then
            staminaMinutes = staminaMinutes - 2
        else
            staminaMinutes = 0
        end
        nextUseStaminaTime[playerId] = currentTime + 120
    else
        staminaMinutes = staminaMinutes - 1
        nextUseStaminaTime[playerId] = currentTime + 60
    end
    player:setStamina(staminaMinutes)
end

and in config.lua
-- Stamina
staminaSystem = false
 
I have configured it identically. So..
1. At PACC I will receive 50% more experience all the time? If not, how many hours? And where can you see it in the code?
2. Where does the 50% value come from?
3. Why "XP Gain Rane" doesn't change the value at PACC?

Bez tytułu1.png
 
Lua:
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5     -- 1 = 0% bonus , 1.5 =50% bonus so the 1 is 100% and the 1.5 is 150% = 100% the normal and 50% the bonus
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
this can be found in player.lua
function Player:eek:nGainExperience(source, exp, rawExp)
dont forget to open events.xml and change this
Code:
    <event class="Player" method="onGainExperience" enabled="0" />
to this just enabled it from 0 to 1
Code:
    <event class="Player" method="onGainExperience" enabled="1" />
 
Solution
Thank you! Everything in the thread has been clarified so I mark it resolved.

But maybe you know ... Everything works as it should (gets more experience) but why doesn't it display in "XP Gain Rate"?


In addition, after changing to "1" which means no bonus for pacc players, a 50% bonus is still displayed:

Bez tytułu2.png
 
Last edited:
Thank you! Everything in the thread has been clarified so I mark it resolved.

But maybe you know ... Everything works as it should (gets more experience) but why doesn't it display in "XP Gain Rate"?


In addition, after changing to "1" which means no bonus for pacc players, a 50% bonus is still displayed:

View attachment 38938
Thats native in the client I think.
 
Back
Top