• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

EXP RATE defined by storage value?

Oneda

Aspiring Spriter
Joined
Dec 3, 2013
Messages
159
Solutions
2
Reaction score
104
Location
Brazil
Is there a way to define the EXP RATE by a storage value?

I mean, if you have 5 of that storage value, then set rate to 500, else if 6 of that storagevalue, then set rate to 400, else if 7.... etc
 
Yeah, something like that! I tried through creatureevents, BUT... server kept crashing and didnt let me log in, no one could log in, I'm kinda newbie with scripting, I tried doing it with lots of IFs, something like this way:

Code:
function onLogin(cid)
if getPlayerResets(cid) >= 1 and getPlayerResets(cid) <= 12 then
    doPlayerSetExperienceRate(cid, 800)
    return true
end
if getPlayerResets(cid).....

And it wouldn't work, any tips?
 
Cause your defining your values wrong. Everything needs a storagevalue if your gonna make it count somehow, getPlayerResets would need its own function. If your thinking about prestige system you would have to do it like this
Code:
function onLogin(cid)
if getPlayerStorageValue(cid, 85987) >= 1 then -- The 85987 number is the number defining your storage value
doPlayerSetExtraExpRate(cid, 300) -- Change the 300 with the number you want the player to have at that number
doCreatureSay(cid, "You new exp rate is now: ".. getPlayerExtraExpRate(cid) ..".", 19)
elseif getPlayerStorageValue(cid, 85987) >= 12 then
doPlayerSetExtraExpRate(cid, 800)
doCreatureSay(cid, "You new exp rate is now: ".. getPlayerExtraExpRate(cid) ..".", 19)
end
return true
end
@Oneda
 
Yeah, I got the function tho.
I had tried with something like this earlier, but probably had a wrong syntax..

Thanks, will try this and edit the topic.

--EDIT:

Well, the only error I got is:
Code:
[16/04/2014 12:30:07] [Error - CreatureScript Interface]
[16/04/2014 12:30:07] data/creaturescripts/scripts/resetstages.lua:onLogin
[16/04/2014 12:30:07] Description:
[16/04/2014 12:30:07] data/creaturescripts/scripts/resetstages.lua:3: attempt to call global 'doPlayerSetExtraExpRate' (a nil value)
[16/04/2014 12:30:07] stack traceback:
[16/04/2014 12:30:07]    data/creaturescripts/scripts/resetstages.lua:3: in function <data/creaturescripts/scripts/resetstages.lua:1>

Not sure what to do now tho
 
Last edited:
Yeah, I got the function tho.
I had tried with something like this earlier, but probably had a wrong syntax..

Thanks, will try this and edit the topic.
If your trying to edit a rebirth system you probably already have a storage value, or you should atleast
 
I'm not editing it, I just made a new function to get the value from that single storage, pretty simple one.
Also, edited the post above yours

Code:
function getPlayerResets(cid)
return getCreatureStorage(cid, 85987)
end

@DestinationSer
 
Yeah, I got the function tho.
I had tried with something like this earlier, but probably had a wrong syntax..

Thanks, will try this and edit the topic.

--EDIT:

Well, the only error I got is:
Code:
[16/04/2014 12:30:07] [Error - CreatureScript Interface]
[16/04/2014 12:30:07] data/creaturescripts/scripts/resetstages.lua:onLogin
[16/04/2014 12:30:07] Description:
[16/04/2014 12:30:07] data/creaturescripts/scripts/resetstages.lua:3: attempt to call global 'doPlayerSetExtraExpRate' (a nil value)
[16/04/2014 12:30:07] stack traceback:
[16/04/2014 12:30:07]    data/creaturescripts/scripts/resetstages.lua:3: in function <data/creaturescripts/scripts/resetstages.lua:1>

Not sure what to do now tho
Nil value means the function does not exist in your 050-lib folder or your (sources?) post your LUA_FUNCTIONS file in doc. If you dont have one try
doPlayerSetExpRate instead
 
Same error with doPlayerSetExpRate.
Tried this:

Code:
function onLogin(cid)
if getPlayerStorageValue(cid, 85987) >= 1 then -- The 85987 number is the number defining your storage value
doPlayerSetExperienceRate(cid, 300) -- Change the 300 with the number you want the player to have at that number
doCreatureSay(cid, "RATE: 300X.", 19)
elseif getPlayerStorageValue(cid, 85987) >= 12 then
doPlayerSetExperienceRate(cid, 800)
doCreatureSay(cid, "RATE: 800x.", 19)
end
return true
end

Shows the message when the player logs in, but wont change his rate as it looks like, now im not sure if its my /serverinfo command or if its the Prestige Rates script.
Wont give any error on console with this one.


--EDIT 2: ACTUALLY, NVM! It works with one player I got testing it for me, altho with the other one it doesnt works...
 
Last edited:
This one now:
Code:
[16/04/2014 13:08:09] [Error - CreatureScript Interface]
[16/04/2014 13:08:09] data/creaturescripts/scripts/resetstages.lua:onLogin
[16/04/2014 13:08:09] Description:
[16/04/2014 13:08:10] (luaDoPlayerSetRate) Player not found

Gettin better :P
 
Huh, now doesnt gives a single error, but wont change dem rates too.

Maybe my /serverinfo command is getting the rate from the config lua instead of the player rate? I think thats why

Edit:
Thats exactly why,
on serverinfo script:
Code:
local exp = config.rateExperience

So yeah, I think it worked. Now just gotta make a command to check the real rate.

Thank you dude, so much. ♥


Final script if someone needs it:

Code:
function onLogin(cid)
if getPlayerStorageValue(cid, 85987) >= 1 then -- The 85987 number is the number defining your storage value
    doPlayerSetRate(cid, SKILL__LEVEL, 1000) -- Change the 300 with the number you want the player to have at that number
    doCreatureSay(cid, "RATE: 1000X.", 19)
elseif getPlayerStorageValue(cid, 85987) >= 3 then
    doPlayerSetRate(cid, SKILL__LEVEL, 800)
    doCreatureSay(cid, "RATE: 800x.", 19)
    end
  return true
end
 
Last edited:
Back
Top