• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Exp rate time changing event :D

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
Hello, i made easy script for funny exp event. Script changing exp ever 1 hour, changed exp is random lot. :)
configs in script.. ; )

in talkactions.xml
PHP:
<talkaction access="5" log="yes" words="/expevent" script="expevent.lua"/>
and talkactions/scripts/expevent.lua
PHP:
config = {
minExp = 5, -- lowest multiple of exp
maxExp = 20,  -- highest multiple of exp
changeTime = 60 -- how many time (minutes) for change
}

function changeExpRate(params)
	for i, pid in ipairs(params.players) do
            setPlayerExtraExpRate(pid, params.expRate)          
	end
	doBroadcastMessage("The exp rate set to "..params.expRate.." next exp rate update in next "..config.changeTime.." minutes!", MESSAGE_STATUS_WARNING)
	setGlobalStorageValue(55555, params.expRate)
	addEvent(changeExpRate,(config.changeTime*60*1000), {players=params.players, expRate=math.random(config.minExp, config.maxExp)})
end

function onSay(cid, words, param)
	changeExpRate({players=getPlayersOnline(), expRate=math.random(config.minExp, config.maxExp)})
end

and in creaturescripts to login.lua add:
PHP:
expRate = getGlobalStorageValue(55555) 
function onLogin(cid)
	if expRate > 0 then
	setPlayerExtraExpRate(cid, expRate)      
	doPlayerSendTextMessage(cid, 18, "The exp rate set to "..expRate.." next exp rate update in next 60 minutes!")
	end
	return TRUE
end

Yours,
azi.
 
Last edited:
First poster ;)


It roxs ffs ! you could maybe for premium ?


like 2-3x exp more it's chaning every hour...


rep++
 
[05/02/2009 18:21:29] Lua Script Error: [TalkAction Interface]
[05/02/2009 18:21:29] data/talkactions/scripts/expevent.lua: onSay

[05/02/2009 18:21:29] data/talkactions/scripts/expevent.lua:10: attempt to compare number with function
[05/02/2009 18:21:29] stack traceback:
[05/02/2009 18:21:29] data/talkactions/scripts/expevent.lua:10: in function 'changeExpRate'
[05/02/2009 18:21:29] data/talkactions/scripts/expevent.lua:22: in function <data/talkactions/scripts/expevent.lua:19>

Used on TFS 0.3 beta 3
 
#Your Master
try now. : )


#master-m
ye, but it's saving to storage, when player is online, and exp rate was been changed - when player login creaturescript set him/her exp rate to new, and send msg with exp rate. :p
 
Can you edit for me ?

Afte player login in character say msg, You used a Ticket Exp, and you have more 12(time left) minutes(OR HOURS ETC..), for back to normal experience.
 
doPlayerSendTextMessage(cid, 18, "The exp rate set to "..expRate.." next exp rate update in next 60 minutes!")

it's line of text which send on login, only replace

doPlayerSendTextMessage(cid, 18, "TEXT HERE")
 
doPlayerSendTextMessage(cid, 18, "The exp rate set to "..expRate.." next exp rate update in next 60 minutes!")

it's line of text which send on login, only replace

doPlayerSendTextMessage(cid, 18, "TEXT HERE")

alright, but i need show remaining time for back to xp normal..


example:

doPlayerSendTextMessage(cid, 18, "The exp rate set to "..expRate.." you have "timeleft" days(days or hours or minutes) remaining for finish")


the code itself:

doPlayerSendTextMessage(cid, 18, "The exp rate set to 5x you have 2 days 3hours and 25 minutes, remaining for finish")
 
It will do not work on TFS 0.3.1 patch 2 beacouse Elf changed setPlayerExtraExpRate to doPlayerSetExperienceRate and this 2 functions are different.
 
i need help
to erro:

Code:
[05/06/2010 21:59:28] data/talkactions/scripts/expevent.lua:onSay
[05/06/2010 21:59:28] Description: 
[05/06/2010 21:59:28] data/talkactions/scripts/expevent.lua:9: attempt to call global 'setPlayerExtraExpRate' (a nil value)
[05/06/2010 21:59:28] stack traceback:
[05/06/2010 21:59:28] 	data/talkactions/scripts/expevent.lua:9: in function 'changeExpRate'
[05/06/2010 21:59:28] 	data/talkactions/scripts/expevent.lua:17: in function <data/talkactions/scripts/expevent.lua:16>

my servidor is 8.54
 
i need help
to erro:

Code:
[05/06/2010 21:59:28] data/talkactions/scripts/expevent.lua:onSay
[05/06/2010 21:59:28] Description: 
[05/06/2010 21:59:28] data/talkactions/scripts/expevent.lua:9: attempt to call global 'setPlayerExtraExpRate' (a nil value)
[05/06/2010 21:59:28] stack traceback:
[05/06/2010 21:59:28] 	data/talkactions/scripts/expevent.lua:9: in function 'changeExpRate'
[05/06/2010 21:59:28] 	data/talkactions/scripts/expevent.lua:17: in function <data/talkactions/scripts/expevent.lua:16>

my servidor is 8.54
script is from 2009 ffs :p
 
Perhaps you could make a talkaction like
/exprate 2x
then it'll make it double exprate.. (for exp stages aswell).
Btw, I'm using Modern so let me know if it'll work there aswell
 
Back
Top