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

[MOD]Experience Scroll with time expire!

TomCrusher

Jeg er ingenting
Joined
Dec 31, 2008
Messages
663
Reaction score
19
Location
Norway
Hi, it work with 0.4 and should work with 0.3.6 (not tested)
~~then go to your "mods" folder and create file expscroll.xml with contest:

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Experience Stages Scroll" version="1.0" author="TomCrusher" contact="otland.net" enabled="yes">
    <action itemid="9004" event="script" value="expstagescroll.lua"/>
    <creatureevent type="think" name="ExpStage" event="script" value="expstagescroll.lua"/>
    <creatureevent type="login" name="ExpStageLogin" event="script" value="expstagescroll.lua"/>
</mod>

~~so go to folder mods/scripts and create file expstagescroll.lua with content:

PHP:
local config = { 
    rate = 2,
    storage = 1000,
    expstorage = 1100,
    register = 1200,
    time = 14400,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, config.storage) <= 0 then
        local rates = getPlayerRates(cid)
        setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
        setPlayerStorageValue(cid, config.register, 1)
        itemEx=itemid == 9004
        doCreatureSay(cid, "Your extra experience rate has been activated! It now is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
        setPlayerStorageValue(cid, config.storage, os.time()+config.time)
        doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]*config.rate)
        doRemoveItem(item.uid,1)
        registerCreatureEvent(cid, "ExpStage")
    else
        doCreatureSay(cid, "You must finish first exp condition to start other exp condition !", TALKTYPE_ORANGE_1, true, cid)
    end
return true
end
function onThink(cid, interval)
    if getPlayerStorageValue(cid, config.register) == 1 then
        if getPlayerStorageValue(cid, config.storage) <= os.time() then
            doCreatureSay(cid, "Your extra experience rate has finished! It is now normaly experience rate.", TALKTYPE_ORANGE_1, true, cid)
            setPlayerStorageValue(cid, config.storage, 0)
            setPlayerStorageValue(cid, config.register, 0)
            local oldexp = getPlayerStorageValue(cid, config.expstorage)
            doPlayerSetExperienceRate(cid, oldexp)
            unregisterCreatureEvent(cid, "ExpStage")
        end
    end
return true
end
function onLogin(cid)
    if getPlayerStorageValue(cid, config.register) == 1 then
        registerCreatureEvent(cid, "ExpStage")
        local rates = getPlayerRates(cid)
        doCreatureSay(cid, "Your extra experience rate is still here! It is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
        if getPlayerStorageValue(cid, config.storage) > os.time() then
        local oldexp = getPlayerStorageValue(cid, config.expstorage)
        doPlayerSetExperienceRate(cid, oldexp+config.rate)
        end
    end  
return true
end

How it work? It set experience stage to player with rate added in config, after use a scroll. Scroll disappear after using but rate experience work in time you decide in config. Work also after reloging.

Configuration:

rate = 2, --number how many time is multiple player experience rate (can be also 1.5 or 10.1) example: player basicaly rate is 1x you adding 2x then player got 3x experience rate
storage = 1000, --storage to set time
expstorage = 1100, --storage were is player exists rate
register = 1200, --registration storage
time = 14400, --time with scroll expiring (in seconds 14400=4 hours)

That all :)
 
Last edited:
Thanks, it's nice!
I'll try it lather, thanks :D!
 
how do i fix the time for the new tfs .4? because that time u have above isnt right. it lasts like 3 hrs or something
 
1. If player logout and login will him lose his bonus?

If (question1 = 'no') then
2. Will the time continue where it left off?
end

:D
 
Im getting this:
Code:
[8:38:46.673] [Error - CreatureScript Interface]
[8:38:46.673] mods/scripts/expstagescroll.lua:onThink
[8:38:46.673] Description:
[8:38:46.673] (luaGetCreatureStorage) Creature not found
 
The onThink event isn't working.

Also doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+config.rate) will add 1+2 = 3 => 300% more of experience... If you want to add 25%, it should be doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]*config.rate) having config.rate = 1.25 otherwise you will ask why you are not getting the amount you spect. This happens because if you use doPlayerSetExperienceRate(cid, 1.73) it will raise player experience in a 73% percent.
 
This mod works on 8.6 server? Global tfs 0.4.0.0 ??
whole process and did not work can someone help me?
 
The onThink event isn't working.

Also doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+config.rate) will add 1+2 = 3 => 300% more of experience... If you want to add 25%, it should be doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]*config.rate) having config.rate = 1.25 otherwise you will ask why you are not getting the amount you spect. This happens because if you use doPlayerSetExperienceRate(cid, 1.73) it will raise player experience in a 73% percent.
Thanks kito2 corrected first post with: doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]*config.rate) and time = 14400, --time with scroll expiring (in seconds 14400=4 hours).
 
Back
Top