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

Experience Rate

ExibeR

Lua/C++/PHP Programmer
Joined
Aug 15, 2007
Messages
986
Reaction score
8
Location
Tromso/Norway
Greetings,

I'm requesting a script which increases the experience rate of a player by 2x.

So a item which upon use increases the experience rate of a player for 4 hours. Item will be removed on use.

The script should work for TFS v0.2.2 with experience stages.
So:
onUse Remove Item
getCurrent experience rate/stage
add double experience
 
@Leiken

I don't know, because this I asked.

Script:

goto data/actions/actions.xml
Lua:
	<action itemid="YOUR ITEM ID" script="double_exp.lua"/>

Then data/actions/scripts/double_exp.lua

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local config = {
        newExp = 2,   -- exp * 2 / double exp  // 3 = 3x exp
	value = 8765, -- don't touch
	text = "Now you get double exp.", -- text on use item
	text_havealready = "You already get double exp."
        }

	if getPlayerStorageValue(cid,config.value) == FALSE then
		setPlayerStorageValue(cid,config.value,1)
		setPlayerExtraExpRate(cid,config.newExp)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.text_havealready)
	end
	doRemoveItem(itemEx.uid)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.text)
	return TRUE
end

After that goto data/creaturescripts/creaturescripts.xml

Lua:
	<event type="login" name="Double_Exp" event="script" value="double_exp.lua"/>

Then goto data/creaturescripts/scripts/doube_exp.lua

Lua:
function onLogin(cid)

local value = 8765  -- don't touch

	if getPlayerStorageValue(cid,value) == TRUE then
		setPlayerExtraExpRate(cid,1)
		setPlayerStorageValue(cid,value,0)
	end
	return TRUE
end

Warning: If you relog or die, you don't get double exp anymore.

I think it work only for TFS 0.3+ ;).
Post Errors on theard, Thanks :).

Regards,
Shawak
 
Last edited:
Back
Top