• 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 [Nekiro / TFS 1.4 7.72] - help need Double EXP item

VagosClubTM

Active Member
Joined
Aug 16, 2019
Messages
219
Reaction score
32
Location
Chile
Hello friends, I am trying to search in Otland for a double experience system through a specific item, so I have not found anything about it

I use the TFS 1.4 NEKIRO 7.72 distribution

If someone has a link or has a script that can help me, it would be of great help, I thank you in advance for those who take the time to help me
 
Solution
Action:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(11223) >= os.time() then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already have an active XP Boost")
        return true
    end

    player:setStorageValue(11223, os.time() + 3600)
    Item(item.uid):remove(1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your double XP hour has started")
    return true
end

Add this to onGainExperience function inside events/scripts/player.lua:

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

So it should look like this:

Lua:
function Player:onGainExperience(source, exp, rawExp)
    if not source or...
Action:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(11223) >= os.time() then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already have an active XP Boost")
        return true
    end

    player:setStorageValue(11223, os.time() + 3600)
    Item(item.uid):remove(1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your double XP hour has started")
    return true
end

Add this to onGainExperience function inside events/scripts/player.lua:

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

So it should look like this:

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 > 2340 and self:isPremium() then
            exp = exp * 1.5
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
 
    if self:getStorageValue(11223) >= os.time() then
        exp = exp * 2
    end

    return EventCallback.onGainExperience and EventCallback.onGainExperience(self, source, exp, rawExp) or exp
end

Do not forget to register the action into an item id in actions.xml
 
Last edited:
Solution
Back
Top