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

exp scroll 2x

mimus

New Member
Joined
Mar 14, 2012
Messages
168
Reaction score
2
hello everybody!!! well i have this script but i need 2 things

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(16101) >= os.time() then
        return true
    end
  
    player:setStorageValue(16101, os.time() + 86400)
    Item(item.uid):remove(1)
    return true
end

function Player:onGainExperience(source, exp, rawExp)
    if self:getStorageValue(16101) >= os.time() then
        exp = exp * 2
    end
    return exp
end


1) know if the doble exp expire in 1 hour... so in os.time() + 86400 how can i set it to 3 mins?, and second one
2) how to make the scroll says "Doble EXP for 1 Hour"



tank u so much for reeding! see u
 
hello everybody!!! well i have this script but i need 2 things

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(16101) >= os.time() then
        return true
    end

    player:setStorageValue(16101, os.time() + 86400)
    Item(item.uid):remove(1)
    return true
end

function Player:onGainExperience(source, exp, rawExp)
    if self:getStorageValue(16101) >= os.time() then
        exp = exp * 2
    end
    return exp
end


1) know if the doble exp expire in 1 hour... so in os.time() + 86400 how can i set it to 3 mins?, and second one
2) how to make the scroll says "Doble EXP for 1 Hour"



tank u so much for reeding! see u

Now it's 24 hours?
86400 / 60 / 60.
1 = 1 second.

To set it to 3 minutes you just change 86400 to 3*60 or to 180

Message types
: https://github.com/otland/forgotten...c250eb46e0a56c02487e6/src/luascript.cpp#L1473

Add this below "player:setStorageValue~"
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Double EXP for one hour")

 
tank u so much the second issue works perfect, but now i cant make that the doble exp works i edit my events player.lua like this

Code:
  [3] = 1.50, -- +50%
   [4] = 1.90 -- +90%
}

function Player:onGainExperience(source, exp, rawExp)
   if self:getStorageValue(1234) >= os.time() then
  exp = exp * 2
  end
  return exp
end

function Player:onLoseExperience(exp)
    return exp
end



which could be the error?
 
Try this
Code:
function Player:onLoseExperience(source, exp, rate, storage)
    return self:onGainExperience(source, exp, rate, storage)
end

function Player:setExperienceRate(rate)
    return rate * configManager.getNumber(configKeys.RATE_EXPERIENCE)
end

function Player:onGainExperience(source, exp, rate, storage)
    if self:getStorageValue(storage) > os.time() then
        return exp * self:setExperienceRate(rate)
    end
    return exp
end
 
still not working U.U !server info says the same exp amount and the exp gained is not doubled what could be? the log dot show any errors, the item just disapear and says "double exp for 1 hour" but no doble exp lol
 
In your events.xml file, have you changed enabled from 0 to 1?

Code:
<event class="Player" method="onGainExperience" enabled="1" />
 
Back
Top