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

X % more exp after completing quest TFS [1.2]

liqeen

Active Member
Joined
Nov 26, 2014
Messages
150
Solutions
1
Reaction score
30
Location
Poland
Hello,
Is it even possible to do something like that? For example when u finish a quest and you click on a chest you get rewarded with +20% experience more from monsters permanently. Base Monster Exp (1000) + Bonus Exp from monster (200)
 
Solution
I already show you the file, TFS has an event called onGainExperience, here: otland/forgottenserver (https://github.com/otland/forgottenserver/blob/master/data/events/scripts/player.lua#L235-L263)
That event is active by default, you should add the part I told you, this one.
Lua:
local questValue = self:getStorageValue(2030)     -- our value from the quest (2030)
if questValue > 0 then                             -- check if our value is greater than 0, because its 1 :P
    exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
end
to the function I already linked, as I did it before.
Assuming that you using tfs1.2 I would guess that you have the experience event, so.
If your quest give you x storage...
Assuming that you using tfs1.2 I would guess that you have the experience event, so.
If your quest give you x storage (let use 12345), you can do something like.

Lua:
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

    local questValue = self:getStorageValue(12345)     -- our value from the quest
    if questValue > 0 then                             -- check if our value is greater than 0
        exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
    end
    return exp
end
 
Assuming that you using tfs1.2 I would guess that you have the experience event, so.
If your quest give you x storage (let use 12345), you can do something like.

Lua:
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

    local questValue = self:getStorageValue(12345)     -- our value from the quest
    if questValue > 0 then                             -- check if our value is greater than 0
        exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
    end
    return exp
end
Okey now, how and where I can implement this xD
 
Like the way I show you, you said that you have a quest for this experience bonus so use the quest storage.
Naaah I don't have anything (tried to do something that you posted up but i'm not that good : D), I just said is there any chance to do quest like, click chest | get x storage and by that storage get 20% more xp from monsters.
 
Last edited:
You need to set the storage to the player ofc, quest.lua (chest quest based) gives you the unique id as storage if you set the 2000 as action id, so if you have a chest (uniqueid: 2030, actionid: 2000) you will receive the 2030 storage and set it as 1.
check here: otland/forgottenserver (https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua#L34)
so with that quest you can edit the part I show you with our new value.

Lua:
local questValue = self:getStorageValue(2030)     -- our value from the quest (2030)
if questValue > 0 then                             -- check if our value is greater than 0, because its 1 :P
    exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
end
 
You need to set the storage to the player ofc, quest.lua (chest quest based) gives you the unique id as storage if you set the 2000 as action id, so if you have a chest (uniqueid: 2030, actionid: 2000) you will receive the 2030 storage and set it as 1.
check here: otland/forgottenserver (https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua#L34)
so with that quest you can edit the part I show you with our new value.

Lua:
local questValue = self:getStorageValue(2030)     -- our value from the quest (2030)
if questValue > 0 then                             -- check if our value is greater than 0, because its 1 :P
    exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
end
Okey I get it how to set the storage but what about the exp function? I mean how to execute that 1.2 multipler when a player already has storage (2030) It should be as a globalevent, creaturescripts, events or what? I don't think that I can put it in an action script and it will works everytime when player with X storage kill monster and gets 20% more xp.
 
I already show you the file, TFS has an event called onGainExperience, here: otland/forgottenserver (https://github.com/otland/forgottenserver/blob/master/data/events/scripts/player.lua#L235-L263)
That event is active by default, you should add the part I told you, this one.
Lua:
local questValue = self:getStorageValue(2030)     -- our value from the quest (2030)
if questValue > 0 then                             -- check if our value is greater than 0, because its 1 :P
    exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
end
to the function I already linked, as I did it before.
Assuming that you using tfs1.2 I would guess that you have the experience event, so.
If your quest give you x storage (let use 12345), you can do something like.

Lua:
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

    local questValue = self:getStorageValue(12345)     -- our value from the quest
    if questValue > 0 then                             -- check if our value is greater than 0
        exp = exp * 1.2                             -- multiply it by 1.2 (20% more)
    end
    return exp
end
 
Solution
Back
Top