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

Exp rate rune

sibbe

New Member
Joined
Oct 28, 2007
Messages
51
Reaction score
0
Looking for a script similar to this:

When player uses a rune, the player will gain 50 % more exp for one hour.
 
Good question.
If a player says "utani hur" and dies, the spell goes away when the player logs in.
I think it should be the same with the rune.
If he dies, all effects are gone from the rune.
 
Action script:
Code:
-- Credits: Slawkens
local config = {
	rate = 2.0, -- 2.0 = 2x faster than normal
	time = 60, -- in minutes
	storage = 20532
}

local function experienceEnd(cid)
	if isPlayer(cid) then
		doPlayerSetExperienceRate(cid, 1.0)
		setPlayerStorageValue(tid, config.storage, -1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has passed.")
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local tid = itemEx.uid or cid
	if(not isPlayer(tid)) then
		return false
	end

	local status = getPlayerStorageValue(tid, config.storage)
	if(status ~= -1) then
		doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, "Your extra experience rate is already activated! It will expire at: " .. os.date("%X", status))
		return true
	end

	doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, "Your extra experience rate has been activated! It is now: " .. config.rate .. ".")
	doPlayerSetExperienceRate(tid, config.rate)
	setPlayerStorageValue(tid, config.storage, os.time() + config.time * 60 * 1000)
	doRemoveItem(item.uid, 1)
	addEvent(experienceEnd, config.time * 60 * 1000, tid)
	return true
end
Merge with existing login.lua or create new login creaturescript:
Code:
local config = {
	storage = 20532
}

function onLogin(cid)
	if(getPlayerStorageValue(cid, config.storage) ~= -1) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has gone.")
		setPlayerStorageValue(cid, config.storage)
	end
	return true
end
 
Last edited:
Awesome, it seems to work just fine.

I do get an error message in the console though.

[25/11/2009 17:32:54] Lua Script Error: [Action Interface]
[25/11/2009 17:32:54] data/actions/scripts/exp.lua:eek:nUse

[25/11/2009 17:32:54] luaAddEvent(). Callback parameter should be a function.
 
Back
Top Bottom