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

Action Extra exp rate scroll

Lua:
local item_id = 1958
local lvlReq = 100
local rate = 5
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos = getPlayerPosition(cid)
    if (item.itemid == item_id) then
	if getPlayerLevel(cid) >= lvlReq then
		setPlayerExtraExpRate(cid, rate)
		doSendAnimatedText(playerPos, "+[" .. rate .. "]", TEXTCOLOR_WHITE)
		doPlayerSendTextMessage(cid, 19, "You have now extra exp rate [".. getPlayerExtraExpRate(cid) .."]")
		doRemoveItem(item_id.uid)
	else
		doPlayerSendCancel(cid, "You must be atleast level " .. lvlReq .. " to use this item.")
	end
    end
    return true
end
 
Lua:
local item_id = 1958
local lvlReq = 100
local rate = 5
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos = getPlayerPosition(cid)
    if (item.itemid == item_id) then
	if getPlayerLevel(cid) >= lvlReq then
		setPlayerExtraExpRate(cid, rate)
		doSendAnimatedText(playerPos, "+[" .. rate .. "]", TEXTCOLOR_WHITE)
		doPlayerSendTextMessage(cid, 19, "You have now extra exp rate [".. getPlayerExtraExpRate(cid) .."]")
		doRemoveItem(item_id.uid)
	else
		doPlayerSendCancel(cid, "You must be atleast level " .. lvlReq .. " to use this item.")
	end
    end
    return true
end

PHP:
[30/10/2009 20:36:40] Lua Script Error: [Action Interface] 
[30/10/2009 20:36:41] data/actions/scripts/other/expitem.lua:onUse

[30/10/2009 20:36:41] data/actions/scripts/other/expitem.lua:8: attempt to call global 'setPlayerExtraExpRate' (a nil value)
[30/10/2009 20:36:41] stack traceback:
[30/10/2009 20:36:42] 	data/actions/scripts/other/expitem.lua:8: in function <data/actions/scripts/other/expitem.lua:4>
 
Lol Its Awsome Its Like Awsome Match :D I Love Then A Good Scripters Figting How To FIx That One Rep For Us :)
 
Lua:
local item_id = 1958
local storage = 2211
local rate = +5
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos = getPlayerPosition(cid)
    if (item.itemid == item_id) then
	if (getPlayerStorageValue(cid, storage) == -1) then
		doPlayerSetRate(cid, EXPERIENCE, rate)
		setPlayerStorageValue(cid, storage, 1)
		doRemoveItem(item_id.uid)
	else
		doPlayerSendCancel(cid, "You have already raised your experience rate.")
	end
    end
    return true
end
 
Last edited:
Lua:
local item_id = 1958
local storage = 2211
local rate = +5
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos = getPlayerPosition(cid)
    if (item.itemid == item_id) then
	if (getPlayerStorageValue(cid, storage) == -1) then
		doPlayerSetRate(cid, EXPERIENCE, rate)
		setPlayerStorageValue(cid, storage, 1)
		doRemoveItem(item_id.uid)
	else
		doPlayerSendCancel(cid, "You have already raised your experience rate.")
	end
    end
    return true
end

So if there is 100 exp and you use the scroll your new exp will be x5? Nice dude! :thumbup: ( retired noob shiet! )
 
So if there is 100 exp and you use the scroll your new exp will be x5? Nice dude! :thumbup: ( retired noob shiet! )

Isn't that the whole point of "extra exp.." :huh:

Your the one who is a noob, atleast I am trying to help and not flaming threads.
 
Isn't that the whole point of "extra exp.." :huh:

Your the one who is a noob, atleast I am trying to help and not flaming threads.

If I've understood everything right what happends when you use a exp item you will get 5x MORE experience than before? Like before I had 20x and when I used the item I would have 25x?
 
If I've understood everything right what happends when you use a exp item you will get 5x MORE experience than before? Like before I had 20x and when I used the item I would have 25x?

Yeah But i Think it should have limit...
 
Isn't that the whole point of "extra exp.." :huh:

Your the one who is a noob, atleast I am trying to help and not flaming threads.

You are just angry because your script don't work :peace:.
 
Great Job ! =) Tested And Fully Working

Regards,

// Zarby
 
So, there are some bugs in this script still.

Anyone can have a look on the released scripts?
 
Not Tested

Lua:
 ---
 
Last edited:
creaturescripts/scripts/scroll_login.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: " .. os.date("%X", getPlayerStorageValue(cid, storage)))
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
	end
        return true
end

actions/scripts/Scroll.lua
Lua:
local config = {
	rate = 2.0, -- 2x More Experience
	time = 60, -- Minutes of Exp Time
	storage = 20011
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local tid = itemEx.uid or cid
	if(isPlayer(tid) ~= TRUE) then
		return false
	end
	if(getPlayerStorageValue(tid, config.storage) == 1) then
		doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(tid, config.storage)))
		return true
	end
	doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate has been activated! It is now: " .. config.rate .. ".")
	doPlayerSetRate(tid, SKILL__LEVEL, config.rate)
	setPlayerStorageValue(tid, config.storage, os.time() + config.time * 60 * 1000)
	addEvent(endExpRate, config.time * 60 * 1000, tid)
	doRemoveItem(item.uid, 1)
	return true
end

local function endExpRate(tid)
	doPlayerSetRate(tid, SKILL__LEVEL, 1.0) --config.lua rate
	setPlayerStorageValue(tid, config.storage, -1)
	doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end

login.lua or creaturescripts.xml? Anything?

Like:

<event type="login" name="expscroll" event="script" value="scroll_login.lua"/>
Login.lua
registerCreatureEvent(cid, "expscroll")

Correct?
 
creaturescripts/scripts/scroll_login.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: " .. os.date("%X", getPlayerStorageValue(cid, storage)))
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
	end
        return true
end

actions/scripts/Scroll.lua
Lua:
local config = {
	rate = 2.0, -- 2x More Experience
	time = 60, -- Minutes of Exp Time
	storage = 20011
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local tid = itemEx.uid or cid
	if(isPlayer(tid) ~= TRUE) then
		return false
	end
	if(getPlayerStorageValue(tid, config.storage) == 1) then
		doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(tid, config.storage)))
		return true
	end
	doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate has been activated! It is now: " .. config.rate .. ".")
	doPlayerSetRate(tid, SKILL__LEVEL, config.rate)
	setPlayerStorageValue(tid, config.storage, os.time() + config.time * 60 * 1000)
	addEvent(endExpRate, config.time * 60 * 1000, tid)
	doRemoveItem(item.uid, 1)
	return true
end

local function endExpRate(tid)
	doPlayerSetRate(tid, SKILL__LEVEL, 1.0) --config.lua rate
	setPlayerStorageValue(tid, config.storage, -1)
	doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end

Installed it correctly, when i login i get the message:

Code:
06:15 You do not have any extra experience time.

But i can't use the item? When i right click nothing happends, not even "you cannot use this item"
 
creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "expRate")

creaturescripts/scripts/expRateCheck.lua
Code:
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: " .. os.date("%X", getPlayerStorageValue(tid, config.storage)).")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
	setPlayerStorageValue(cid, storage, -1)
    end
    return true
end
 
Last edited:
Back
Top