• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

in need of script!

Oldschool'er

Tibia since 1998'
Joined
Dec 14, 2010
Messages
2,198
Reaction score
149
Location
United States
Hello and im in need of a script for double exp script

I want it to work on Golden Newspaper and give's 2 hour's of double exp

Anyone? :D

Will Rep++
 
Hello and im in need of a script for double exp script

I want it to work on Golden Newspaper and give's 2 hour's of double exp

Anyone? :D

Will Rep++

I'm sorry but I don't have the ID of the golden newspaper, but you can change it, I'll tell you how..

go to data/actions/scripts and create a new lua file and name it doubleexp
here is the code:
LUA:
function onUse(cid, item, frompos, item2, topos)

local interval = 7200000
local text = 'You have 2 hours of double exp.'
finaltext = 'The effect is over.'
local exp = 2 
finalexp = 1

if item.itemid == xxx then
doRemoveItem(item.uid,1)
doPlayerSetExperienceRate(cid,exp)
doSendMagicEffect(frompos,13)
doPlayerSendTextMessage(cid,22,text)
addEvent(potion,interval,cid)
end
end



function potion(pos, cid)
doPlayerSetExperienceRate(pos,finalexp)
doPlayerSendTextMessage(pos,22,finaltext)
end
now on
Code:
if item.itemid == xxx
change the xxx to the id of the news paper..

no go to data/actions open the actions.xml and place this code:
LUA:
<action itemid="xxx" script="doubleexp.lua" />

change
Code:
itemid="xxx"
to the ID of the news paper!
Hope this helps, any problem just ask ^^


---EDIT
Alright, that script is bugged, addevent stop working if the player logs out... So, if the player log out he will get 2x exp for ever...

I found this script though, it works 100% just tested it... it is NOT mine, the guy who did it is MatheusMkalo... Also, it´s a mod, so it is even better...

go to mods and create a .xml file and name it doubleexp
here is the code:
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">

<!-- Configs and Functions -->
<config name="PotionExpConfigs"><![CDATA[

------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 120, ---- TIME IN MINUTES
needpa = TRUE,
needlvl = {TRUE, level = 1},
costmana = {TRUE, mana = 50},
addrate = 100, -- Exp que vai adicionar em %
removeonuse = TRUE
}

function getTime(s)
    local n = math.floor(s / 60)
    s = s - (60 * n)
    return n, s
end

CreatureEventChecker = function(event, ...) -- Colex
    if isCreature(arg[1]) then
        event(unpack(arg))
    end
end

creatureEvent = function(event, delay, ...) -- Colex
    addEvent(CreatureEventChecker, delay, event, unpack(arg))
end

function getPlayerExtraExpRate(cid) -- By MatheusMkalo
    return (getPlayerRates(cid)[8]-1)*100
end
]]></config>

<!-- exppotion.lua -->
<action itemid="12625" event="script"><![CDATA[
domodlib('PotionExpConfigs')
if getPlayerStorageValue(cid, 62164) >= 1 then
    return doPlayerSendCancel(cid, "You are already taking effect from this item.")
end

if configs.needpa and not isPremium(cid) then
    return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.")
end

if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
    return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.")
end

if configs.costmana[1] then
if getCreatureMana(cid) < configs.costmana.mana then
    return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.")
else
doCreatureAddMana(cid, -configs.costmana.mana)
end
end

if configs.removeonuse then
    doRemoveItem(item.uid, 1)
end
 
for i = configs.time*60, 1, -1 do
local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
if #a < 4 then
a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
end
if i == configs.time*60 then
creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "The effect of the exp potion end.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "The effect of the exp potion will end in "..a..".")
end

doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
doPlayerSendTextMessage(cid, 22, "You now have 2 hours of double exp.")
setPlayerStorageValue(cid, 62164, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0)
return TRUE
]]></action>

<creaturescript type="login" name="ExpPotion" event="script"><![CDATA[
domodlib('PotionExpConfigs')
local time = configs.time 
    if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then
       doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
       creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
       creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0)

       for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do
       local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
       if #a < 4 then
       a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
       end
       if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then
       creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "The effect of the exp potion end.")
       end
       creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "The effect of the exp potion will end in "..a..".")
       end
    end
return TRUE
]]></creaturescript>
</mod>

now, there is this on the sript:
Code:
<!-- exppotion.lua -->
<action itemid="xxx" event="script"><![CDATA[
domodlib('PotionExpConfigs')
change the xxx to the news paper ID...
IMPORTANT: if you use this mod, the id you use to with it can NOT be on actions.xml, or it will not work!
 
Last edited:
Here You go! Remember by login out during the exprience powers, the exp rate will be set back to old exp rate.

Goto actions/actions.xml and add this line:
LUA:
<action itemid="2403" event="script" value="expscroll.lua" allowfaruse="1"/>

Now goto actions/scripts and create new lua and name it expscroll then add this script below:
LUA:
local otswe = {
storage = 10000, -- Put Unused Storage Here
time_end = 2*60*1000, -- Edit Time Here
text_onrecived = "You have gained powers from the gods! You will gain twice faster exprience now.", -- Editable Text
end_text = "The powers of the gods has expired.", -- Editable Text
cancel_text = "Sorry, but you already effected by the gods.", -- Editable Text
text_onuse = "2X", -- Editable Magic Text Max 8 letters
exp_rate = 2.0, -- New Exprience Rate
old_rate = 1.0 -- Old Exprience Rate
}

function onUse(cid, item, frompos, item2, topos)  
if getPlayerStorageValue(cid,otswe.storage) == 1 then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, otswe.cancel_text)
return false
end 
if isPlayer(cid) then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, otswe.text_onrecived)
doSendAnimatedText(getCreaturePosition(cid), otswe.text_onuse ,TEXTCOLOR_RED)
doSendMagicEffect(getCreaturePosition(cid), math.random(28, 30))
doPlayerSetRate(cid, SKILL__LEVEL, 2)
addEvent(otswe_exp_scroll,otswe.time_end,cid)
setPlayerStorageValue(cid, otswe.storage, 1)
doRemoveItem(item.uid, 1)
end
return true
end  

function otswe_exp_scroll(rate, cid) 
if isPlayer(rate) then
doPlayerSetRate(rate, SKILL__LEVEL, otswe.old_rate)
doPlayerSendTextMessage(rate,MESSAGE_STATUS_CONSOLE_RED, otswe.end_text)
setPlayerStorageValue(rate, otswe.storage, 0)
end
end

Now goto creaturescripts/scripts/login.lua
and add this under function onLogin(cid)

LUA:
local storage = 10000

if getPlayerStorageValue(cid,storage) == 1 then
setPlayerStorageValue(cid,storage,0)
end

Now you are done!
 
Back
Top