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

Change Exp Rate of Server by Talkaction

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
Hello,
how can I change Global exprate by talkaction (talkaction only used by GM).
PS.: I'm using exp stages.
 
In data/lib/ "200-data" or "050-function" add:

LUA:
_Exp_Event = {
storage = 96138,
rate = 0.10 -- 10%
}


data/creaturescript/script

script name.lua
LUA:
function onKill(cid, target)
if getGlobalStorageValue(_Exp_Event.storage) ~= -1 and isMonster(target) == true then
local percent,exp = _Exp_Event.rate,getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier)
local count = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent))
doPlayerAddExperience(cid, count)
addEvent(doSendAnimatedText, 500, getCreaturePosition(cid), '+'..count, math.random(50,60))
end
return true
end

creaturescript.xml
Code:
<event type="kill" name="ExpEvent" event="script" value="script name.lua"/>

data/creaturescript/script/login.lua add

Code:
registerCreatureEvent(cid, "ExpEvent")


data/talkactions/script

script name.lua
LUA:
function onSay(cid, words, param)
setGlobalStorageValue(_Exp_Event.storage, getGlobalStorageValue(_Exp_Event.storage) == -1 and 1 or -1)
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"O evento de Exp foi "..(getGlobalStorageValue(_Exp_Event.storage) == -1 and "finalizado" or "aberto e o bônus é de "..((_Exp_Event.rate - 0)*100).."%."))
end

talkactions.xml
Code:
<talkaction log="yes" words="/expevent" access="5" event="script" value="script name.lua"/>

in data/globalevents/start.lua add before "return true"

LUA:
setGlobalStorageValue(_Exp_Event.storage, -1)
 
Back
Top