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

Lua Where do I add a 2x exp boost script

Soul Baker

New Member
Joined
Dec 8, 2015
Messages
16
Reaction score
0
hi i found a script for a 2x EXP boost that lasts 24 hours. but i don't know where to put these codes, Ive never tried this before so here are the scripts i was given. i tried to put in folders they said but i didn't have those folders. not sure where to put all this. if someone could solve this for me I'd be Very happy
#1
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(1234) >= os.time() then
player:say('You already have double exp!', TALKTYPE_MONSTER_SAY)
return true
end

player:setStorageValue(1234, os.time() + 86400)
Item(item.uid):remove(1)
player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY)
return true
end


#2
Code:
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end


and #3
Code:
-- 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
elseif staminaMinutes <= 840 then
exp = exp * 0.5
end
end
 
Last edited by a moderator:
1: go into data/actions/actions.xml and add this line:
Code:
<action itemid="2110" script="expdoll.lua" />

2: go into data/actions/scripts and create a new file, name it expdoll.lua and add following to file:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(1234) >= os.time() then
        player:say('You already have double exp!', TALKTYPE_MONSTER_SAY)
        return true
    end

    player:setStorageValue(1234, os.time() + 86400)
    Item(item.uid):remove(1)
    player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY)
    return true
end

3: go into data/events/scripts/player.lua, if it is a original TFS copy and you don't have any custom modifications, then just replace:
Code:
function Player:onGainExperience(source, exp, rawExp)
....
end
to
Code:
function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
        return exp
    end

    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end

    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())

    -- 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
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end

    if self:getStorageValue(1234) >= os.time() then
        exp = exp * 2
    end

    return exp
end

Good luck.
 
this is the part im on.. i dont have that event folder your talking about what do i do
3: go into data/events/scripts/player.lua, if it is a original TFS copy and you don't have any custom modifications, then just replace:
 
this is the part im on.. i dont have that event folder your talking about what do i do
3: go into data/events/scripts/player.lua, if it is a original TFS copy and you don't have any custom modifications, then just replace:

Then you are probably using an old TFS. What version are you using? :)
 
Then you are probably using an old TFS. What version are you using? :)
how do i check

is this it? [20/12/2015 12:45:13] The Forgotten Server - Edited By Cyko V8, version 0.3.6 - Edited By Cyko V8 (Crying Damson - Edited By Cyko V8)
 
Last edited:
how do i check

is this it? [20/12/2015 12:45:13] The Forgotten Server - Edited By Cyko V8, version 0.3.6 - Edited By Cyko V8 (Crying Damson - Edited By Cyko V8)

Yeah, this script is made for TFS 1.0. I do not know how 0.3.6 scripting works, so I cannot help you convert it.
You can always create a new thread at the request board and wait for someone to help you. :) GL
 
Back
Top