• 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 Amulet of Experience Stage

Status
Not open for further replies.

frankfarmer

who'r ninja now
Premium User
Joined
Aug 5, 2008
Messages
1,581
Reaction score
80
Hello! Thank you JDB who created this wonderful script, but i have a problem with it. Also players on my server have started to complain.

Here is the script: actions.xml
Lua:
	<action itemid="2196" event="script" value="scroll.lua"/>

scroll.lua

Lua:
  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

and the creaturescript: creaturescript.xml

Lua:
	<event type="login" name="expRate" event="script" value="extraExpRate.lua"/>

login.lua
Lua:
	registerCreatureEvent(cid, "expRate")

and the script: ExtraExpRate.lua

Lua:
local storage = 20011
function onLogin(cid)
    if(getPlayerStorageValue(cid, storage) == 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at:")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
	setPlayerStorageValue(cid, storage, -1)
    end
    return true
end

1. Players have complained that if they die, they loose the exprate bonus.

2. If players relog their character they loose the extra experience bonus.

3. Is it possible to make some kinda lifering function? Meaning; They have a ring they wear, with 300minutes/5 hours and when it wears off the experience bonus is lost?

4. Is it possible the amulet to save the extra experience rate even if they logout or relog their character?

Once again, someone who is nice enough to have a look at this editing my scripts. I am willing to give 5 euros to, if you have paypal.

Thanks in advance!
 
Nothing wrong with it either. You haven't changed anything except for the tabbing that got screwed.
 
Nothing wrong with it either. You haven't changed anything except for the tabbing that got screwed.

Code:
[01/12/2009 03:28:44] Lua Script Error: [CreatureScript Interface] 
[01/12/2009 03:28:44] data/creaturescripts/scripts/extraExpRate.lua:onLogin

[01/12/2009 03:28:44] data/creaturescripts/scripts/extraExpRate.lua:16: attempt to concatenate a nil value
[01/12/2009 03:28:44] stack traceback:
[01/12/2009 03:28:44] 	data/creaturescripts/scripts/extraExpRate.lua:16: in function <data/creaturescripts/scripts/extraExpRate.lua:12>
[01/12/2009 03:28:44] GM Real has logged out.


Still getting the same error. Nobody can login on the server.

meaning, there is something wrong with the OnLogin value

I am using 0.3.5 distro.

Sure you dont find any problems?

Maybe i have to add something to functions.lua? or.. anything ?:O
 
Testing...

Works now! I'll post bugs here if there is any..

03:54 Your extra exp rate will expire at: 08:54:18

Closing thread until then!

Thanks alot! Appreciated. Rep+ (spread first) '-.-
 
Last edited:
Status
Not open for further replies.
Back
Top