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

Regeneration System Level

snuckles

New Member
Joined
Apr 4, 2009
Messages
11
Reaction score
1
Location
Hong Kong
Hello I have never published help but today if I want to ask everyone for help because these things really tire me a little, this system is old so I never had problems until today. If someone could help me transform it for my version: TFS 1.X,
I would greatly appreciate it and give REP + (Note: This is a "Creature Events" script)

Lua:
local function heal(uid, info, mana)
    if not isCreature(uid) then
        return true
    end

    local level = getPlayerLevel(uid)
    for _, v in ipairs(info) do
        if level >= v.level.min and level <= v.level.max then
            if mana then
                if not getTileInfo(getThingPos(uid)).protection then
                    doCreatureAddMana(uid, v.mana.reg)
                end

                addEvent(heal, v.mana.interval * 1000, uid, info, true)
            else
                if not getTileInfo(getThingPos(uid)).protection then
                    doCreatureAddHealth(uid, v.hp.reg)
                end

                addEvent(heal, v.hp.interval * 1000, uid, info)
            end

            break
        end
    end
  
    return true
end

function onLogin(cid)

local vocations = {
    [1] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [2] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [3] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [4] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [5] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [6] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [7] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [8] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [9] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [10] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [11] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [12] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [13] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [14] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [15] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [16] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    }
}

    if vocations[getPlayerVocation(cid)] then
        heal(cid, vocations[getPlayerVocation(cid)], true)
        heal(cid, vocations[getPlayerVocation(cid)], true)
        heal(cid, vocations[getPlayerVocation(cid)], true)
        heal(cid, vocations[getPlayerVocation(cid)], true)
        heal(cid, vocations[getPlayerVocation(cid)])
    end
  
    return true
end
 
Solution
Lua:
function doRegen(playerId, cfg, regType)
  local player = Player(playerId)
  if not player then
    return
  end
  local tile = Tile(player:getPosition())
  if tile and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
    if regType == "hp" then
      doTargetCombatHealth(0, player, COMBAT_HEALING, cfg.reg, cfg.reg)
    elseif regType == "mp" then
      doTargetCombatMana(0, player, cfg.reg, cfg.reg)
    end
  end
  addEvent(doRegen, cfg.interval * 1000, playerId, cfg, regType)
end

function onLogin(player)
  local vocations = {
    [1] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval =...

jacqen

Well-Known Member
Joined
Jul 10, 2017
Messages
37
Solutions
7
Reaction score
50
Lua:
function doRegen(playerId, cfg, regType)
  local player = Player(playerId)
  if not player then
    return
  end
  local tile = Tile(player:getPosition())
  if tile and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
    if regType == "hp" then
      doTargetCombatHealth(0, player, COMBAT_HEALING, cfg.reg, cfg.reg)
    elseif regType == "mp" then
      doTargetCombatMana(0, player, cfg.reg, cfg.reg)
    end
  end
  addEvent(doRegen, cfg.interval * 1000, playerId, cfg, regType)
end

function onLogin(player)
  local vocations = {
    [1] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [2] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [3] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [4] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [5] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [6] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [7] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [8] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [9] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [10] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [11] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [12] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [13] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [14] = {
        {level = {min = 1, max = 1}, hp = {reg = 0, interval = 10}, mana = {reg = 2, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 0, interval = 10}, mana = {reg = 3, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 0, interval = 10}, mana = {reg = 4, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 0, interval = 10}, mana = {reg = 5, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 0, interval = 10}, mana = {reg = 6, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 0, interval = 10}, mana = {reg = 7, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 0, interval = 10}, mana = {reg = 8, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 0, interval = 10}, mana = {reg = 9, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 0, interval = 10}, mana = {reg = 10, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 0, interval = 10}, mana = {reg = 11, interval = 10}},
    },
    [15] = {
        {level = {min = 1, max = 1}, hp = {reg = 4, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 12, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 20, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 28, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 36, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
    },
    [16] = {
        {level = {min = 1, max = 1}, hp = {reg = 8, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 2, max = 2}, hp = {reg = 16, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 3, max = 3}, hp = {reg = 24, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 4, max = 4}, hp = {reg = 32, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 5, max = 5}, hp = {reg = 40, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 6, max = 6}, hp = {reg = 48, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 7, max = 7}, hp = {reg = 56, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 8, max = 8}, hp = {reg = 64, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 9, max = 9}, hp = {reg = 72, interval = 10}, mana = {reg = 0, interval = 10}},
        {level = {min = 10, max = 10}, hp = {reg = 80, interval = 10}, mana = {reg = 0, interval = 10}},
    }
  }
  local regenConfig = vocations[player:getVocation():getId()]
  for _,v in pairs(regenConfig) do
    if player:getLevel() >= v.level.min then
      regenConfig = v
      break
    end
  end
  if regenConfig then
    if regenConfig.hp then
      doRegen(player:getId(), regenConfig.hp, "hp")
    end
    if regenConfig.mana then
      doRegen(player:getId(), regenConfig.mana, "mp")
    end
  end

  return true
end
 
Solution
OP
OP
snuckles

snuckles

New Member
Joined
Apr 4, 2009
Messages
11
Reaction score
1
Location
Hong Kong
It works perfect but it has a problem that I am still trying to solve, it only regenerates the configuration of the first level, that is, level 1 and then the following levels do not regenerate.
Post automatically merged:

mark it as solution ( his answer )
I know but it is not resolved because the script does not work 100% has an error.
 
Last edited:
Top