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

TFS 0.X Convert SKILLS/ML when change vocation Dawnport

samandriel

Active Member
Joined
Oct 19, 2016
Messages
242
Solutions
1
Reaction score
46
I'm trying to bring Dawnport to 8.6 on my 0.4 (https://github.com/Fir3element/3777/blob/master/src/luascript.cpp)

It's already changing vocation, give items...

But there is only one thing it not working:
When players change vocation i want to convert skills, i mean a mage ml 10, change to knight he cant still with ml 10, same to knight shielding 40, cant be mage shielding 40

What i tried so far? zxmatzx gave me the idea to use:
getPlayerSkillTries(cid, skill) and getPlayerRequiredSkillTries(cid, skillId, skillLevel)
Code:
    -- | skills convert |
    -- get skill points
    local SKILL_SHIELD_POINTS = getPlayerSkillTries(cid, SKILL_SHIELD)
    local SKILL_DISTANCE_POINTS = getPlayerSkillTries(cid, SKILL_DISTANCE)
    local SKILL_AXE_POINTS = getPlayerSkillTries(cid, SKILL_AXE)
    local SKILL_SWORD_POINTS = getPlayerSkillTries(cid, SKILL_SWORD)
    local SKILL_CLUB_POINTS = getPlayerSkillTries(cid, SKILL_CLUB)
    -- reset skills
    doPlayerSetMagicLevel(cid, 0)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    -- set skill points back
    doPlayerAddSkillTry(cid, SKILL_SHIELD, SKILL_SHIELD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, SKILL_DISTANCE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_AXE, SKILL_AXE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_SWORD, SKILL_SWORD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_CLUB, SKILL_CLUB_POINTS)

But its not working at all, when players change vocation it always reseting skills to the start
Why?

Full code:
Code:
-- olhar o cap changing

local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

function onStepIn(cid, item, position, fromPosition)
    local r = tile[item.actionid]
    if not r then
        return true
    end
    local townid = 7
    local pos = {x= 392, y=929, z=6}
    local needcap
    local extralvls = getPlayerLevel(cid) - 1
    local vocation
    local cap
    local hp
    local mp
    -- get skill points in current vocation
    local SKILL_SHIELD_POINTS = getPlayerRequiredSkillTries(cid, SKILL_SHIELD, getPlayerSkillLevel(cid, SKILL_SHIELD, true))
    local SKILL_DISTANCE_POINTS = getPlayerRequiredSkillTries(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE, true))
    local SKILL_AXE_POINTS = getPlayerRequiredSkillTries(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE, true))
    local SKILL_SWORD_POINTS = getPlayerRequiredSkillTries(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD, true))
    local SKILL_CLUB_POINTS = getPlayerRequiredSkillTries(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB, true))
    if item.actionid == 65530 then -- sorc
        if getPlayerVocation(cid) == 1 then --already sorc
            doTeleportThing(cid, fromPosition)
            doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
            return true
        end
        doPlayerSetVocation(cid, 1)
        needcap = 88
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        ---
    elseif item.actionid == 65529 then -- druid
        if getPlayerVocation(cid) == 2 then --already druid
            doTeleportThing(cid, fromPosition)
            doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
            return true
        end
        doPlayerSetVocation(cid, 2)
        needcap = 91
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        ---
    elseif item.actionid == 65528 then -- pally
        if getPlayerVocation(cid) == 3 then --already pally
            doTeleportThing(cid, fromPosition)
            doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
            return true
        end
        doPlayerSetVocation(cid, 3)
        needcap = 122
        hp = (185) + (extralvls * 10)
        mp = (35) + (extralvls * 15)
        cap = (400) + (extralvls * 20)
        ---
    elseif item.actionid == 65527 then -- kina
        if getPlayerVocation(cid) == 4 then --already knight
            doTeleportThing(cid, fromPosition)
            doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
            return true
        end
        doPlayerSetVocation(cid, 4)
        needcap = 44
        hp = (185) + (extralvls * 15)
        mp = (35) + (extralvls * 5)
        cap = (400) + (extralvls * 25)
        ---
    end

    -- add stuff
    setCreatureMaxHealth(cid, hp)
    setCreatureMaxMana(cid, mp)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
    -- cap convert
    doPlayerSetMaxCapacity(cid, cap)
    -- | skills convert |
    -- reset skills
    doPlayerSetMagicLevel(cid, 0)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    -- set skill points back
    doPlayerAddSkillTry(cid, SKILL_SHIELD, SKILL_SHIELD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, SKILL_DISTANCE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_AXE, SKILL_AXE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_SWORD, SKILL_SWORD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_CLUB, SKILL_CLUB_POINTS)
    -- | add items |
    -- already recived
    local queststatus = getPlayerStorageValue(cid, item.actionid)
    if queststatus ~= -1 then
        return true
    end
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return true
    end
    -- add items
    -- weapon first
    if r.weaponID then
        doPlayerAddItem(cid, r.weaponID, 1)
    end
    -- other stuffs
    if r.extraItems then
        for i=1,#r.extraItems do
            local item,count = r.extraItems[i].itemID, r.extraItems[i].count
            doPlayerAddItem(cid, item, count)
        end
    end
    setPlayerStorageValue(cid,item.actionid,1)
    return true
end
 
Solution
I'll try it one last time.

Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        extraItems = {
            {itemID = 2190, count = 1}, -- wand of vortex
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        extraItems = {
            {itemID = 2182, count = 1}, -- snakebite rod
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}...
Im not familiar to lua, but imo the positioning of the following is upside down:

Lua:
    -- reset skills
    doPlayerSetMagicLevel(cid, 0)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    -- set skill points back
    doPlayerAddSkillTry(cid, SKILL_SHIELD, SKILL_SHIELD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, SKILL_DISTANCE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_AXE, SKILL_AXE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_SWORD, SKILL_SWORD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_CLUB, SKILL_CLUB_POINTS)

What is the "set skill points back" for? I thought you want to revert the skill level progress to 10 in fighting skills and 0 to mlvl.
Maybe just delete the skill points back section?
 
Im not familiar to lua, but imo the positioning of the following is upside down:

Lua:
    -- reset skills
    doPlayerSetMagicLevel(cid, 0)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    -- set skill points back
    doPlayerAddSkillTry(cid, SKILL_SHIELD, SKILL_SHIELD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, SKILL_DISTANCE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_AXE, SKILL_AXE_POINTS)
    doPlayerAddSkillTry(cid, SKILL_SWORD, SKILL_SWORD_POINTS)
    doPlayerAddSkillTry(cid, SKILL_CLUB, SKILL_CLUB_POINTS)

What is the "set skill points back" for? I thought you want to revert the skill level progress to 10 in fighting skills and 0 to mlvl.
Maybe just delete the skill points back section?

The idea there was:
1- Get skills exp require to player skill
2- Reset skills to 10 and ml to 0
3- Add that exp require to player old skill (but now the exp should gave a different result, since now player have a new vocation)
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
   
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
   
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
   
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
   
    setPlayerSkillLevel(cid, SKILL_CLUB, 10)
    setPlayerSkillLevel(cid, SKILL_AXE, 10)
    setPlayerSkillLevel(cid, SKILL_SWORD, 10)
    setPlayerSkillLevel(cid, SKILL_SHIELDING, 10)
    setPlayerSkillLevel(cid, SKILL_DISTANCE, 10)
   
    local extraLevels = getPlayerLevel(cid) - 1
   
    setPlayerVocation(cid, TILE.vocid)
   
    --Add skill tries back to player--
    doPlayerAddSkillTries(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTries(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTries(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTries(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTries(cid, SKILL_DISTANCE, distanceTries)
   
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
 
Last edited by a moderator:
Code:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
   
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
   
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
   
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
   
    setPlayerSkillLevel(cid, SKILL_CLUB, 10)
    setPlayerSkillLevel(cid, SKILL_AXE, 10)
    setPlayerSkillLevel(cid, SKILL_SWORD, 10)
    setPlayerSkillLevel(cid, SKILL_SHIELDING, 10)
    setPlayerSkillLevel(cid, SKILL_DISTANCE, 10)
   
    local extraLevels = getPlayerLevel(cid) - 1
   
    setPlayerVocation(cid, TILE.vocid)
   
    --Add skill tries back to player--
    doPlayerAddSkillTries(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTries(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTries(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTries(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTries(cid, SKILL_DISTANCE, distanceTries)
   
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end

oh man, thank you so much to try to help me
but it's not working:
Code:
[1:56:36.342] [Error - MoveEvents Interface] 
[1:56:36.342] data/movements/scripts/dawnport_tiles.lua:onStepIn
[1:56:36.342] Description: 
[1:56:36.342] data/movements/scripts/dawnport_tiles.lua:89: attempt to call global 'setPlayerSkillLevel' (a nil value)
[1:56:36.342] stack traceback:
[1:56:36.342]     data/movements/scripts/dawnport_tiles.lua:89: in function <data/movements/scripts/dawnport_tiles.lua:57>
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
    
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
    
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
    
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
    
   
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    
    local extraLevels = getPlayerLevel(cid) - 1
    
    doPlayerSetVocation(cid, TILE.vocid)
    
    --Add skill tries back to player--
    doPlayerAddSkillTries(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTries(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTries(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTries(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTries(cid, SKILL_DISTANCE, distanceTries)
    
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
maybe?
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
   
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
   
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
   
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
   
  
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
   
    local extraLevels = getPlayerLevel(cid) - 1
   
    doPlayerSetVocation(cid, TILE.vocid)
   
    --Add skill tries back to player--
    doPlayerAddSkillTries(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTries(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTries(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTries(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTries(cid, SKILL_DISTANCE, distanceTries)
   
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
maybe?

Code:
[16:4:19.776] [Error - MoveEvents Interface] 
[16:4:19.776] data/movements/scripts/dawnport_tiles.lua:onStepIn
[16:4:19.776] Description: 
[16:4:19.776] data/movements/scripts/dawnport_tiles.lua:101: attempt to call global 'doPlayerAddSkillTries' (a nil value)
[16:4:19.776] stack traceback:
[16:4:19.776]     data/movements/scripts/dawnport_tiles.lua:101: in function <data/movements/scripts/dawnport_tiles.lua:57>

:( :( :( :( :(
 
Looks like you need to bind it to a storage value or collect the skilltries from db i guess 😣

Why? How?

I have no idea what to do now...

I tried to print the values and some why its returning 0

Code:
shielding 1: 0
shielding 2: 0

[4:20:40.369] [Error - MoveEvents Interface] 
[4:20:40.370] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:20:40.370] Description: 
[4:20:40.370] data/movements/scripts/dawnport_tiles.lua:105: attempt to call global 'doPlayerAddSkillTries' (a nil value)
[4:20:40.370] stack traceback:
[4:20:40.370]     data/movements/scripts/dawnport_tiles.lua:105: in function <data/movements/scripts/dawnport_tiles.lua:57>

Code:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
    
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
    
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
    
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)

    print("shielding 1: " .. swordTries)
    
   
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)

    print("shielding 2: " .. swordTries)
    
    local extraLevels = getPlayerLevel(cid) - 1
    
    doPlayerSetVocation(cid, TILE.vocid)
    
    --Add skill tries back to player--
    doPlayerAddSkillTries(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTries(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTries(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTries(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTries(cid, SKILL_DISTANCE, distanceTries)

    print("shielding 3: " .. swordTries)
    
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
    
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
    
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
    
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
    
  
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    
    local extraLevels = getPlayerLevel(cid) - 1
    
    doPlayerSetVocation(cid, TILE.vocid)
    
    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)
    
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end

Try this :rolleyes:
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
   
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
   
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
   
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
   
 
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
   
    local extraLevels = getPlayerLevel(cid) - 1
   
    doPlayerSetVocation(cid, TILE.vocid)
   
    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)
   
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.hp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, cap + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end

Try this :rolleyes:

Code:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
    
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
    
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
    
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELDING)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
    
    print(shieldingTries)
  
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    
    local extraLevels = getPlayerLevel(cid) - 1
    
    doPlayerSetVocation(cid, TILE.vocid)
    
    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELDING, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)
    
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end

Strange thing, it still priting 0

Code:
0

[1:1:03.343] [Error - MoveEvents Interface] 
[1:1:03.343] data/movements/scripts/dawnport_tiles.lua:onStepIn
[1:1:03.343] Description: 
[1:1:03.343] (luaDoPlayerAddItem) Item not found

But the shielding skill is not changing..
 
Code:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
  
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
  
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
  
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELD)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
  
    print(shieldingTries)

    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
  
    local extraLevels = getPlayerLevel(cid) - 1
  
    doPlayerSetVocation(cid, TILE.vocid)
  
    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELD, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)
  
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end

maybe this will work for shielding

also check that all the item id's exist in-game
 
Code:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
 
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
 
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
 
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELD)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
 
    print(shieldingTries)

    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
 
    local extraLevels = getPlayerLevel(cid) - 1
 
    doPlayerSetVocation(cid, TILE.vocid)
 
    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELD, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)
 
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end

maybe this will work for shielding

also check that all the item id's exist in-game

Code:
[13:9:13.877] [Error - MoveEvents Interface] 
[13:9:13.877] data/movements/scripts/dawnport_tiles.lua:onStepIn
[13:9:13.877] Description: 
[13:9:13.877] data/movements/scripts/dawnport_tiles.lua:58: attempt to index global 'tiles' (a nil value)
[13:9:13.877] stack traceback:
[13:9:13.877]     data/movements/scripts/dawnport_tiles.lua:58: in function <data/movements/scripts/dawnport_tiles.lua:57>

but line 58 (local TILE = tiles[item.actionid]) is exactly like was before
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]
 
    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end
 
    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end
 
    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELD)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)
 
    print(shieldingTries)

    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
 
    local extraLevels = getPlayerLevel(cid) - 1
 
    doPlayerSetVocation(cid, TILE.vocid)
 
    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELD, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)
 
    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
?
 
You can do this "reset" via npc and sql querys. Dunno if I can link stuff from other forums but there's a reseter npc that can get you back to a certain level with certain hp/mana, you can do some edits and reset or set the skills in any way you want to
You can also transform the npc's script in an action script or wathever
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]

    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end

    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end

    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELD)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)

    print(shieldingTries)

    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELDING, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)

    local extraLevels = getPlayerLevel(cid) - 1

    doPlayerSetVocation(cid, TILE.vocid)

    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELD, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)

    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
?


player knight shielding 21
enter to change to sorcerer: shielding still 21
print it: 226

player enter on knight tile to become knight again
shielding become 26
print it: 678


(weaponID is dropping on ground it isnt adding on backpack)
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        needcap = 88,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        needcap = 91,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        needcap = 91,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        needcap = 122,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]

    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end

    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < TILE.needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. TILE.needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end

    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELD)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)

    print(shieldingTries)

    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)

    local extraLevels = getPlayerLevel(cid) - 1

    doPlayerSetVocation(cid, TILE.vocid)

    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELD, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)

    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
Maybe this will work :eek:
Not sure I got the cap correctly set up but you can change that if you know the sum of all the items on the different vocations.
I think this will fix the Shielding issue
 
Lua:
local vocation_stats = {
    [1] = {hp = 5, mp = 30, cap = 10},
    [2] = {hp = 5, mp = 30, cap = 10},
    [3] = {hp = 10, mp = 15, cap = 20},
    [4] = {hp = 15, mp = 5, cap = 25}
}

local tiles = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        needcap = 88,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        needcap = 91,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2260, count = 50}, -- blank rune
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        needcap = 91,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2260, count = 10}, -- blank rune
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2389, count = 3}, -- spear
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 5} -- FIREBALL
        }
   },
   [65527] = {
        vocid = 4,
        needcap = 122,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1}, -- club
            {itemID = 2265, count = 10}, -- IH
            {itemID = 2287, count = 5}, -- LMM
            {itemID = 2302, count = 3} -- FIREBALL
        }
   }
}

local townId = 7
local pos = {x = 392, y = 929, z = 6}

function onStepIn(cid, item, position, fromPosition)
    local TILE = tiles[item.actionid]

    if not TILE then return true end
    -- Check Vocation
    if getPlayerVocation(cid) == TILE.vocid then
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    return false
    end

    -- Give items if never recieved before
    if getPlayerStorageValue(cid, item.actionid) == -1 then
    -- dont have cap
    if getPlayerFreeCap(cid) < TILE.needcap then
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
        doPlayerPopupFYI(cid, 'You need '.. TILE.needcap ..' OZ CAP to recive the items!')
        return false
    end
        for i = 1, #TILE.extraItems do
            doPlayerAddItem(cid, TILE.extraItems[i].itemID, TILE.extraItems[i].count)
        end
        setPlayerStorageValue(cid, item.actionid, 1)
    end

    local clubTries = getPlayerSkillTries(cid, SKILL_CLUB)
    local axeTries = getPlayerSkillTries(cid, SKILL_AXE)
    local swordTries = getPlayerSkillTries(cid, SKILL_SWORD)
    local shieldingTries = getPlayerSkillTries(cid, SKILL_SHIELD)
    local distanceTries = getPlayerSkillTries(cid, SKILL_DISTANCE)

    print(shieldingTries)

    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
    doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)

    local extraLevels = getPlayerLevel(cid) - 1

    doPlayerSetVocation(cid, TILE.vocid)

    --Add skill tries back to player--
    doPlayerAddSkillTry(cid, SKILL_CLUB, clubTries)
    doPlayerAddSkillTry(cid, SKILL_AXE, axeTries)
    doPlayerAddSkillTry(cid, SKILL_SWORD, swordTries)
    doPlayerAddSkillTry(cid, SKILL_SHIELD, shieldingTries)
    doPlayerAddSkillTry(cid, SKILL_DISTANCE, distanceTries)

    local STATS = vocation_stats[TILE.vocid]
    setCreatureMaxHealth(cid, 185 + (STATS.hp * extraLevels))
    setCreatureMaxMana(cid, 40 + (STATS.mp * extraLevels))
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
    doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
    doPlayerSetMaxCapacity(cid, 400 + (STATS.cap * extraLevels))
    doPlayerAddItem(cid, TILE.weaponID, 1)
    doTeleportThing(cid, pos)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSetTown(cid, townid)
return true
end
Maybe this will work :eek:
Not sure I got the cap correctly set up but you can change that if you know the sum of all the items on the different vocations.
I think this will fix the Shielding issue

Hey thank you to trying to help me, np bro, the others problems i think i can fix myself...

The main problem is this convert skills problem, i have no idea what to do...

I've test your last script, that whats happen:

start with a knight skills 26
36% to 27

enter on tile to become sorcerer:
and recive skills 13
66% to 14

so enter on tile become back to knight
and recive skills 12
84% to 13

:(

It was print on console:
Code:
295
115
 
Back
Top