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

CreatureEvent [OTHire] Staged Skills

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,749
Solutions
30
Reaction score
1,534
That's it:

Code:
-- <event type="login" name="SkillStagesLogin" event="script" value="skills_stages_login.lua"/>
-- skills_stages_login.lua
function onLogin(cid)

    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end

    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid, true)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end

    registerCreatureEvent(cid, "SkillStagesAdvance")
    return true
end

-- <event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>
-- skills_stages_advance.lua
function onAdvance(cid, skill, oldLevel, newLevel)
   
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
   
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        local targetSkillStage = targetVocation[skill]
        if targetSkillStage then
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if newLevel >= level[1] and newLevel <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
   
    return true
end

-- add to global.lua
-- dofile(getDataDir() .. "lib/skills_stages.lua")

-- skills_stages.lua
skillStagesConfig = {
    -- base vocationId
    [0] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        }
    },
    [1] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [2] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [3] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_AXE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 8}] = 10,
            [{9, 13}] = 7,
            [{14, 16}] = 4,
            [{17, 18}] = 2,
            [{19, 90}] = 1
        }
    },
    [4] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_CLUB] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SWORD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_AXE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_DISTANCE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
                        [{0, 19}] = 12,
                        [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
                        [{0, 3}] = 10,
                        [{4, 4}] = 7,
                        [{5, 6}] = 4,
                        [{7, 8}] = 2,
                        [{9, 90}] = 1
        }
    }
}
 
Code:
Lua Script Error: [Weapon Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [Spell Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [Action Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [TalkAction Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [MoveEvents Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [CreatureScript Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [GlobalEvent Interface]
data/global.lua

data/lib/skills_stages.lua:13: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.
 
Cant login to the server and this error appears in the console

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/skillstageslogin.lua:onLogin

LuaScriptInterface::internalGetPlayerInfo(). Player not found. info = 3

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/skillstageslogin.lua:onLogin

data/creaturescripts/scripts/skillstageslogin.lua:20: attempt to compare number
with boolean
stack traceback:
        data/creaturescripts/scripts/skillstageslogin.lua:20: in function <data/
creaturescripts/scripts/skillstageslogin.lua:3>

This is the line 20

Lua:
if nowSkill >= level[1] and nowSkill <= level[2] then
 
Cant login to the server and this error appears in the console

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/skillstageslogin.lua:onLogin

LuaScriptInterface::internalGetPlayerInfo(). Player not found. info = 3

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/skillstageslogin.lua:onLogin

data/creaturescripts/scripts/skillstageslogin.lua:20: attempt to compare number
with boolean
stack traceback:
        data/creaturescripts/scripts/skillstageslogin.lua:20: in function <data/
creaturescripts/scripts/skillstageslogin.lua:3>

This is the line 20

Lua:
if nowSkill >= level[1] and nowSkill <= level[2] then


The event need to be registered in login.lua, my bad, in OTHire/login.lua at master · TwistedScorpio/OTHire · GitHub
add this line:
Code:
"SkillStagesAdvance", --Skills stage system
 
I have already registered it and it's the same error...
before line if nowSkill >= level[1] and nowSkill <= level[2] then
add this lines
Code:
print("now skill: " .. type(nowSkill))
print("skill level 1: " .. type(level[1]))
print("skill level 2: " .. type(level[2]))
It will print some lines in console when you try to login, copy it here.
 
This is what the console printed

Code:
now skill: number
skill level 1: number
skill level 2: number
 
I have already registered it and it's the same error...
You registered both Advance and Login events? I was checking the code, it's the same I have here working.

Maybe delete skill stages login and add it directly to login.lua, sort of like this one:
 

Attachments

That's it:

Code:
-- <event type="login" name="SkillStagesLogin" event="script" value="skills_stages_login.lua"/>
-- skills_stages_login.lua
function onLogin(cid)

    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end

    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid, true)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end

    registerCreatureEvent(cid, "SkillStagesAdvance")
    return true
end

-- <event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>
-- skills_stages_advance.lua
function onAdvance(cid, skill, oldLevel, newLevel)
  
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
  
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        local targetSkillStage = targetVocation[skill]
        if targetSkillStage then
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if newLevel >= level[1] and newLevel <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
  
    return true
end

-- add to global.lua
-- dofile(getDataDir() .. "lib/skills_stages.lua")

-- skills_stages.lua
skillStagesConfig = {
    -- base vocationId
    [0] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        }
    },
    [1] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [2] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [3] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_AXE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 8}] = 10,
            [{9, 13}] = 7,
            [{14, 16}] = 4,
            [{17, 18}] = 2,
            [{19, 90}] = 1
        }
    },
    [4] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_CLUB] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SWORD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_AXE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_DISTANCE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
                        [{0, 19}] = 12,
                        [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
                        [{0, 3}] = 10,
                        [{4, 4}] = 7,
                        [{5, 6}] = 4,
                        [{7, 8}] = 2,
                        [{9, 90}] = 1
        }
    }
}


can i edit this script to something like

[SKILL_FISHING] = {
[{0, 19}] = 12,
[{20, 29}] = 8
[{30, 39}] = 8
[{40, 41}] = 5
[{42, 50}] = 4
} for example?
 
can i edit this script to something like

[SKILL_FISHING] = {
[{0, 19}] = 12,
[{20, 29}] = 8
[{30, 39}] = 8
[{40, 41}] = 5
[{42, 50}] = 4
} for example?
That's how it works, don't forget the commas, since it's a table.
 
I did everything and im having console errors
creatureevents.xml
Code:
<event type="login" name="SkillStagesLogin" event="script" value="skills_stages_login.lua"/>
    <event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>

Skills_stages_login.lua
Code:
function onLogin(cid)
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid, true)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                print("now skill: " .. type(nowSkill))
                print("skill level 1: " .. type(level[1]))
                print("skill level 2: " .. type(level[2]))
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
    registerCreatureEvent(cid, "SkillStagesAdvance")
    return true
end
skills_stages_advance.lua
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
  
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
  
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        local targetSkillStage = targetVocation[skill]
        if targetSkillStage then
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if newLevel >= level[1] and newLevel <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
  
    return true
end
creaturescripts/login.lua
Code:
function onLogin(cid)

    local events = {
        "RemoveBlesses", --Register the kill/die event
        "Give_Bag_After_Death", --Register the Give_Bag_After_Death event
        "lootMessage", --Register loot message
        "SkillStagesAdvance", --Skills stage system
        "lookPlayer" -- Register on look player
    }

    -- Register events
    for i = 1, #events do
        registerCreatureEvent(cid, events[i])
    end

    sendLootMessage = true -- enable/disable
    if sendLootMessage == true then
        setPlayerStorageValue(cid, STORAGE_LOOTMESSAGE, 1)
    else
        setPlayerStorageValue(cid, STORAGE_LOOTMESSAGE, -1)
    end

    --Register the Stage event
    if getBooleanFromString(getConfigInfo("experience_stages"), false) then
        registerCreatureEvent(cid, "ExpStage")
        checkStageChange(cid)
    end

    -- Skills stage system
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
global.lua
Code:
-- Load skillsStages
dofile(getDataDir() .. 'lib/skills_stages.lua')

lib/skills_stages.lua
Code:
-- skills_stages.lua
skillStagesConfig = {
    -- base vocationId
    [0] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        }
    },
    [1] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [2] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [3] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_AXE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 8}] = 10,
            [{9, 13}] = 7,
            [{14, 16}] = 4,
            [{17, 18}] = 2,
            [{19, 90}] = 1
        }
    },
    [4] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_CLUB] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SWORD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_AXE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_DISTANCE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
                        [{0, 19}] = 12,
                        [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
                        [{0, 3}] = 10,
                        [{4, 4}] = 7,
                        [{5, 6}] = 4,
                        [{7, 8}] = 2,
                        [{9, 90}] = 1
        }
    }
}
 
I did everything and im having console errors
creatureevents.xml
Code:
<event type="login" name="SkillStagesLogin" event="script" value="skills_stages_login.lua"/>
    <event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>

Skills_stages_login.lua
Code:
function onLogin(cid)
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid, true)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                print("now skill: " .. type(nowSkill))
                print("skill level 1: " .. type(level[1]))
                print("skill level 2: " .. type(level[2]))
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
    registerCreatureEvent(cid, "SkillStagesAdvance")
    return true
end
skills_stages_advance.lua
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
  
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
  
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        local targetSkillStage = targetVocation[skill]
        if targetSkillStage then
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if newLevel >= level[1] and newLevel <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
  
    return true
end
creaturescripts/login.lua
Code:
function onLogin(cid)

    local events = {
        "RemoveBlesses", --Register the kill/die event
        "Give_Bag_After_Death", --Register the Give_Bag_After_Death event
        "lootMessage", --Register loot message
        "SkillStagesAdvance", --Skills stage system
        "lookPlayer" -- Register on look player
    }

    -- Register events
    for i = 1, #events do
        registerCreatureEvent(cid, events[i])
    end

    sendLootMessage = true -- enable/disable
    if sendLootMessage == true then
        setPlayerStorageValue(cid, STORAGE_LOOTMESSAGE, 1)
    else
        setPlayerStorageValue(cid, STORAGE_LOOTMESSAGE, -1)
    end

    --Register the Stage event
    if getBooleanFromString(getConfigInfo("experience_stages"), false) then
        registerCreatureEvent(cid, "ExpStage")
        checkStageChange(cid)
    end

    -- Skills stage system
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
global.lua
Code:
-- Load skillsStages
dofile(getDataDir() .. 'lib/skills_stages.lua')

lib/skills_stages.lua
Code:
-- skills_stages.lua
skillStagesConfig = {
    -- base vocationId
    [0] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        }
    },
    [1] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [2] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [3] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_AXE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 8}] = 10,
            [{9, 13}] = 7,
            [{14, 16}] = 4,
            [{17, 18}] = 2,
            [{19, 90}] = 1
        }
    },
    [4] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_CLUB] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SWORD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_AXE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_DISTANCE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
                        [{0, 19}] = 12,
                        [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
                        [{0, 3}] = 10,
                        [{4, 4}] = 7,
                        [{5, 6}] = 4,
                        [{7, 8}] = 2,
                        [{9, 90}] = 1
        }
    }
}
 
I did everything and im having console errors
creatureevents.xml
Code:
<event type="login" name="SkillStagesLogin" event="script" value="skills_stages_login.lua"/>
    <event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>

Skills_stages_login.lua
Code:
function onLogin(cid)
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid, true)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                print("now skill: " .. type(nowSkill))
                print("skill level 1: " .. type(level[1]))
                print("skill level 2: " .. type(level[2]))
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
    registerCreatureEvent(cid, "SkillStagesAdvance")
    return true
end
skills_stages_advance.lua
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
 
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
 
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        local targetSkillStage = targetVocation[skill]
        if targetSkillStage then
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if newLevel >= level[1] and newLevel <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
 
    return true
end
creaturescripts/login.lua
Code:
function onLogin(cid)

    local events = {
        "RemoveBlesses", --Register the kill/die event
        "Give_Bag_After_Death", --Register the Give_Bag_After_Death event
        "lootMessage", --Register loot message
        "SkillStagesAdvance", --Skills stage system
        "lookPlayer" -- Register on look player
    }

    -- Register events
    for i = 1, #events do
        registerCreatureEvent(cid, events[i])
    end

    sendLootMessage = true -- enable/disable
    if sendLootMessage == true then
        setPlayerStorageValue(cid, STORAGE_LOOTMESSAGE, 1)
    else
        setPlayerStorageValue(cid, STORAGE_LOOTMESSAGE, -1)
    end

    --Register the Stage event
    if getBooleanFromString(getConfigInfo("experience_stages"), false) then
        registerCreatureEvent(cid, "ExpStage")
        checkStageChange(cid)
    end

    -- Skills stage system
    local stagesVocation = getPlayerVocation(cid)
    if stagesVocation > 4 then
        stagesVocation = stagesVocation - 4
    end
    local targetVocation = skillStagesConfig[stagesVocation]
    if targetVocation then
        for skill, targetSkillStage in pairs(targetVocation) do
            if skill == SKILL_MAGLEVEL then
                nowSkill = getPlayerMagLevel(cid)
            else
                nowSkill = getPlayerSkill(cid, skill)
            end
            local skillRate = 1
            for level, rate in pairs(targetSkillStage) do
                if nowSkill >= level[1] and nowSkill <= level[2] then
                    skillRate = rate
                end
            end
            doPlayerSetRate(cid, skill, skillRate)
        end
    end
global.lua
Code:
-- Load skillsStages
dofile(getDataDir() .. 'lib/skills_stages.lua')

lib/skills_stages.lua
Code:
-- skills_stages.lua
skillStagesConfig = {
    -- base vocationId
    [0] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        }
    },
    [1] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [2] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_AXE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 14}] = 12,
            [{15, 21}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 19}] = 12,
            [{20, 26}] = 8
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 30}] = 10,
            [{31, 35}] = 8,
            [{36, 45}] = 6,
            [{46, 55}] = 4,
            [{56, 65}] = 2,
            [{66, 99}] = 1
        }
    },
    [3] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_CLUB] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SWORD] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_AXE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_DISTANCE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
            [{0, 19}] = 12,
            [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
            [{0, 8}] = 10,
            [{9, 13}] = 7,
            [{14, 16}] = 4,
            [{17, 18}] = 2,
            [{19, 90}] = 1
        }
    },
    [4] = {
        -- skillId
        [SKILL_FIST] = {
            -- [{skillLevel}] = skillRate
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_CLUB] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_SWORD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_AXE] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_DISTANCE] = {
            [{0, 30}] = 12,
            [{31, 40}] = 8
        },
        [SKILL_SHIELD] = {
            [{0, 40}] = 18,
            [{41, 50}] = 14,
            [{51, 60}] = 12,
            [{61, 75}] = 10,
            [{76, 85}] = 8,
            [{86, 90}] = 6,
            [{91, 95}] = 4,
            [{96, 150}] = 1
        },
        [SKILL_FISHING] = {
                        [{0, 19}] = 12,
                        [{20, 29}] = 8
        },
        [SKILL_MAGLEVEL] = {
                        [{0, 3}] = 10,
                        [{4, 4}] = 7,
                        [{5, 6}] = 4,
                        [{7, 8}] = 2,
                        [{9, 90}] = 1
        }
    }
}
Would be nice if you included the console errors aswell.
 
here is my console error can't edit my main post that's why i made double post
Code:
Lua Script Error: [Weapon Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [Spell Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [Action Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [TalkAction Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [MoveEvents Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [CreatureScript Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.

Lua Script Error: [GlobalEvent Interface]
data/global.lua

data/lib/skills_stages.lua:10: table index is nil
Warning: [LuaScriptInterface::initState] Can not load data/global.lua.
:: Loading Script Systems
:: Loading Weapons ...
Lua Script Error: [Weapon Interface]
data/weapons/scripts/poison_arrow.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Weapon Interface]
data/weapons/scripts/poison_arrow.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Weapon Interface]
data/weapons/scripts/poison_arrow.lua

LuaScriptInterface::luaAddDamageCondition(). Condition not found

Lua Script Error: [Weapon Interface]
data/weapons/scripts/poison_arrow.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Weapon Interface]
data/weapons/scripts/explosive_arrow.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
[done]
:: Loading Spells ...Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/stalagmite.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/holy_missile.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/icicle.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/avalanche.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/intense_healing_rune.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/light_magic_missile.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/ultimate_healing_rune.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/heavy_magic_missile.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/soulfire.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/soulfire.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/soulfire.lua

LuaScriptInterface::luaAddDamageCondition(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/soulfire.lua

LuaScriptInterface::luaAddDamageCondition(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/soulfire.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/fireball.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/great_fireball.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/explosion.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/sudden_death.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/envenom.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/paralyze_rune.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/paralyze_rune.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/paralyze_rune.lua

LuaScriptInterface::luaSetConditionFormula(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/paralyze_rune.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/purple.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/green.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/ethereal_spear.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/groundshaker.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/divine_caldera.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/divine_missile.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/divine_missile.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/ice_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/ice_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key

Lua Script Error: [Spell Interface]
data/spells/scripts/support/light.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/light.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/light.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/light.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/light.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/light_healing.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/intense_healing.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/energy_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/energy_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key

Lua Script Error: [Spell Interface]
data/spells/scripts/support/great_light.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/great_light.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/great_light.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/great_light.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/great_light.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/magic_shield.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/magic_shield.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/magic_shield.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/haste.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/haste.lua

LuaScriptInterface::luaSetConditionParam(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/haste.lua

LuaScriptInterface::luaSetConditionFormula(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/haste.lua

LuaScriptInterface::luaSetCombatCondition(). Condition not found
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/flame_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/flame_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/force_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/force_strike.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/fire_wave.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/ice_wave.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/terra_wave.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/heal_friend.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key
Combat::setCallback - Unknown callback type: 0

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/ultimate_healing.lua

LuaScriptInterface::luaSetCombatCallBack(). 0 is not a valid callback key

Lua Script Error: [Spell Interface]
data/spells/scripts/support/strong_haste.lua

LuaScriptInterface::luaCreateConditionObject(). Condition not found

Lua Script Error: [Spell Interface]
data/spells/scripts/support/strong_haste.lua
 
nvm i solved it XD i forgot that today i added new weapon to my sources
Feature - Fist weapons For othire or any ot svn // may works with others <<<by if someone want to add this feature to his server
so i did this at my global.lua a i thinks it's solved now
Code:
-- Weapon Types
WEAPON_NONE     = 0
WEAPON_SWORD    = 1
WEAPON_CLUB     = 2
WEAPON_AXE      = 3
WEAPON_SHIELD   = 4
WEAPON_DIST     = 5
WEAPON_WAND     = 6
WEAPON_AMMO     = 7
WEAPON_FIST     = 8
@HalfAway
 
not it's not solved :( i forgot that i removed the
Code:
-- Load skillsStages
dofile(getDataDir() .. 'lib/skills_stages.lua')
at my global lua i added it again and the error reappears also i removed my source editions and im still having the same console error
@HalfAway
 
i tried even with a cliean datapack it and followed every step that peonso menthioned removing skills_stages_login.lua
adding this code
Code:
print("now skill: " .. type(nowSkill))
                print("skill level 1: " .. type(level[1]))
                print("skill level 2: " .. type(level[2]))

maybe it's not working with OTHIRE 1.0
@Peonso
could you update this script please?
 
It works. I have no idea where you fucked up. Start it again.

To creaturescripts.xml add:
Code:
<event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>[code]

Create data/creaturescripts/scripts/skills_stages_advance.lua:
https://pastebin.com/xayhhFjD

Replace your data/creaturescripts/scripts/login.lua for this one:
https://pastebin.com/dheM7ATD

As the last line of your data/global.lua adds:
[code]dofile(getDataDir() .. "lib/skills_stages.lua")

Create data/lib/skills_stages.lua:
[Lua] skills_stages.lua - Pastebin.com

It works. I have no idea where you fucked up. Start it again.

To creaturescripts.xml add:
Code:
<event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>

Create data/creaturescripts/scripts/skills_stages_advance.lua:
[Lua] skills_stages_advance.lua - Pastebin.com

Replace your data/creaturescripts/scripts/login.lua for this one:
[Lua] login.lua - Pastebin.com

As the last line of your data/global.lua adds:
Code:
dofile(getDataDir() .. "lib/skills_stages.lua")

Create data/lib/skills_stages.lua:
[URL='https://pastebin.com/qw6cxWWn'][Lua] skills_stages.lua - Pastebin.com[/URL]
 
Last edited by a moderator:
It works. I have no idea where you fucked up. Start it again.

To creaturescripts.xml add:
Code:
<event type="advance" name="SkillStagesAdvance" event="script" value="skills_stages_advance.lua"/>

Create data/creaturescripts/scripts/skills_stages_advance.lua:
[Lua] skills_stages_advance.lua - Pastebin.com

Replace your data/creaturescripts/scripts/login.lua for this one:
[Lua] login.lua - Pastebin.com

As the last line of your data/global.lua adds:
Code:
dofile(getDataDir() .. "lib/skills_stages.lua")

Create data/lib/skills_stages.lua:
[Lua] skills_stages.lua - Pastebin.com
 
Back
Top