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

Solved Reborn system help

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,267
Solutions
5
Reaction score
183
Location
Sweden
Hello guys im working with my reborn system, and i want the exp to get lower and lower for each rebirth.
I thought that i do anything like this on login:
Code:
if getPlayerRebirth(cid, 1) then
doPlayerSetExtraExpRate(cid, 0,9)

elseif getPlayerRebirth(cid, 2) then
doPlayerSetExtraExpRate(cid, 0,8)
But then i got it, i cant reely use a "," once again, how shuld i do this the most effective way?
 
Cmon anyone? i cant figure it out, im shure someone know how -.-

Bring
Up

My
Post
 
you can something like this in creaturescript in login
Code:
if getPlayerRebirth(cid) == 1 then
doPlayerSetRate(cid, SKILL__LEVEL, 0.9)
elseif getPlayerRebirth(cid) == 2 then
doPlayerSetRate(cid, SKILL__LEVEL, 0.8)
Or
Code:
local rates = {
[1] = {rate = 0.9},
[2] = {rate = 0.8}
}
for i,v in pairs(rates) do
if getPlayerRebirth(cid) == i then
    doPlayerSetRate(cid, SKILL__LEVEL, v.rates)

If you don't like those codes i can make you a c++ code
 
Btw, is it hard to make different exp stages in like rebirth 1-10 and then another one 10-20, so that it doesnt only change the rate?
 
Code:
    local t = {
        [{1, 10}] = {-- something},
        [{11, 20}] = {-- something}
    }
   
    for k, v in pairs(t) do
        if getPlayerRebirth(cid) >= k[1] and getPlayerRebirth(cid) <= k[2] then
            -- do something
        end
    end
 
@tetra20 Hey, i got your script work a while but now it dont seems to work anymore idk why thow,
can you check, cant figure it out.

Login.lua:
Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    local a = 0
    local limitAM = 20
    if getCreatureName(cid):lower() == "account manager" then
        for _, pid in ipairs(getPlayersOnline()) do
            if getCreatureName(pid):lower() == "account manager" and pid ~= cid then
                a = a + 1
            end
        end

        if a >= limitAM then
            return false
        end

        return true
    end

    if (getCreatureName(cid) == "Account Manager") then
        return doRemoveCreature(cid, true)
    end

    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doCreatureSetDropLoot(cid, false)
        doChangeSpeed(cid, 999)
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
        doPlayerSendTextMessage(cid, 21, "Welcome Back To Volentera!")
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
       
    local rates = {
    [1] = {rate = 10.0},
    [2] = {rate = 9.75},
    [3] = {rate = 9.5},
    [4] = {rate = 9.25},
    [5] = {rate = 9.0},
    [6] = {rate = 8.75}
    }
    for i,v in pairs(rates) do
    if getPlayerRebirth(cid) == i then
    doPlayerSetRate(cid, SKILL__LEVEL, v.rates)
    end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Rebirth")

    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end

    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    return true
end

Error:
Code:
[7/12/2013 16:35:51] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/login.lua:60: 'end' expected (to close 'for' at line 54) near 'elseif'
[7/12/2013 16:35:51] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/login.lua)
[7/12/2013 16:35:51] data/creaturescripts/scripts/login.lua:60: 'end' expected (to close 'for' at line 54) near 'elseif'
 
Back
Top