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

amulet of experience!

ItsMeMagic

Old Tibia Player.
Joined
Sep 11, 2008
Messages
318
Reaction score
25
Location
exiva "Magic~
8TWxUec.png


Error when using the amulet....

This are my scripts.

scroll.lua

Code:
  local config = {
    rate = 1.6, -- 4x More Experience
    time = 5, -- Hours of Exp Time
    storage = 20011
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerStorageValue(cid, config.storage) == -1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
        doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
        setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600 * 1000)
        addEvent(endExpRate, config.time * 3600 * 1000, cid)
        doRemoveItem(item.uid, 1)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
    end
    return true
end
local function endExpRate(cid)
    doPlayerSetRate(cid, SKILL__LEVEL, 6.0) --config.lua rate
    setPlayerStorageValue(cid, config.storage, -1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end

I'm using tfs 1.2
 
Try it.

local config = {
rate = 2.0, -- 2.0 = 2x faster than normal.
un_equip = 2131, -- Item ID of the UN-Equipped ring.
equip = 2130, -- Item ID of the Equipped ring.


}
function onDeEquip(cid, item, slot)
doPlayerSetExperienceRate(cid, 1.0)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.")
doTransformItem(item.uid, config.un_equip)
return true
end
function onEquip(cid, item, slot)
if getConfigValue("experienceStages") == "yes" then
doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid))*2)

else
doPlayerSetExperienceRate(cid, getConfigValue("rateExperience")*2)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate is now " .. config.rate .. "x doubled your former experience rate.")
doTransformItem(item.uid, config.equip)
doDecayItem(item.uid)
return true
end

<movevent type="Equip" itemid="2130" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="Equip" itemid="2131" slot="necklace" event="script" value="amulet.lua"/>
<movevent type="DeEquip" itemid="2130" slot="necklace" event="script" value="amulet.lua"/>

For me works perfectly ^^
 
I don't believe there is a function named "doPlayerSetRate" available for TFS 1.2.

Instead for 1.2, perhaps take a look at the following thread where someone had a similar problem Solved - EXP scroll not working TFS 1.2

Correct

8TWxUec.png


Error when using the amulet....

This are my scripts.

scroll.lua

Code:
  local config = {
    rate = 1.6, -- 4x More Experience
    time = 5, -- Hours of Exp Time
    storage = 20011
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerStorageValue(cid, config.storage) == -1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
        doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
        setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600 * 1000)
        addEvent(endExpRate, config.time * 3600 * 1000, cid)
        doRemoveItem(item.uid, 1)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
    end
    return true
end
local function endExpRate(cid)
    doPlayerSetRate(cid, SKILL__LEVEL, 6.0) --config.lua rate
    setPlayerStorageValue(cid, config.storage, -1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end

I'm using tfs 1.2

Refer to this; Solved - EXP scroll not working TFS 1.2
And this; forgottenserver/player.lua at master · otland/forgottenserver · GitHub
 
Back
Top