• 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 1.X+ Convert SKILLS/ML when change vocation Dawnport

bill psy

New Member
Joined
Jan 17, 2011
Messages
5
Reaction score
0
I'm trying to make Dawnport possible on my server, it's already working, changing vocation, giving items, changing hp, mana and cap ... But there is a big problem, the player can switch to a sorcerer, get high ML and return to the knight and become an OP, the same as for wizards, he can get great protection and can change his vocation. Does anyone know how to convert ML / SKILLS when players change their vocation in the dawnport block?

Lua:
local function givePlayerItem(player, item, slot)
    local ret = player:addItemEx(item, false, sot)
    if not ret then
        player:addItemEx(item, false, INDEX_WHEREEVER, 0)
    end
end

local function getFirstItems(player)
    local firstItems = {
        storage = 4687,

        slots = {
            [CONST_SLOT_HEAD] = Game.createItem(2461),
            [CONST_SLOT_ARMOR] = Game.createItem(2651),
            [CONST_SLOT_LEGS] = Game.createItem(2649),
            [CONST_SLOT_FEET] = Game.createItem(2643)
        }
    }
    
    local backpack = player:getSlotItem(CONST_SLOT_FEET)
    if player:getStorageValue(firstItems.storage) < 1 then
        for slot, item in pairs(firstItems.slots) do
            givePlayerItem(player, item, slot)
        end
        player:setStorageValue(firstItems.storage, 1)       
    end
end

local function changeVocation(player, fromVocation, toVocation)
    local vocationsItems = {
        -- sorcerer
        [1] = {
            [CONST_SLOT_LEFT] = {23719, 1, true}, -- the scorcher
            [CONST_SLOT_RIGHT] = {23771, 1, true}, -- spellbook of the novice
            [11] = {8704, 2, true, limitStorage = 10030, limit = 1}, -- potion
            [12] = {7620, 10, true, limitStorage = 10031, limit = 1}, -- potion
            [13] = {23723, 2, true, limitStorage = 10032, limit = 1}, -- 2 lightest missile runes
            [14] = {23722, 2, true, limitStorage = 10033, limit = 1} -- 2 light stone shower runes
        },
        -- druid
        [2] = {
            [CONST_SLOT_LEFT] = {23721, 1, true}, -- the chiller
            [CONST_SLOT_RIGHT] = {23771, 1, true}, -- spellbook of the novice
            [11] = {8704, 2, true, limitStorage = 10034, limit = 1}, -- potion
            [12] = {7620, 10, true, limitStorage = 10035, limit = 1}, -- potion
            [13] = {23723, 2, true, limitStorage = 10036, limit = 1}, -- 2 lightest missile runes
            [14] = {23722, 2, true, limitStorage = 10037, limit = 1} -- 2 light stone shower runes
        },
        -- paladin
        [3] = {
            [CONST_SLOT_LEFT] = {2456, 1, true}, -- bow
            [CONST_SLOT_AMMO] = {23839, 100, true}, -- 100 arrows
            [11] = {8704, 7, true, limitStorage = 10038, limit = 1}, -- potion
            [12] = {7620, 5, true, limitStorage = 10039, limit = 1}, -- potion
            [13] = {23723, 1, true, limitStorage = 10040, limit = 1}, -- 1 lightest missile rune
            [14] = {23722, 1, true, limitStorage = 10041, limit = 1} -- 1 light stone shower rune
        },
        -- knight
        [4] = {
            [CONST_SLOT_LEFT] = {2379, 1, true}, -- dagger
            [CONST_SLOT_RIGHT] = {2512, 1, true}, -- wooden shield
            [11] = {8704, 10, true, limitStorage = 10042, limit = 1}, -- potion
            [12] = {7620, 2, true, limitStorage = 10043, limit = 1}, -- potion
            [13] = {23723, 1, true, limitStorage = 10044, limit = 1}, -- 1 lightest missile rune
            [14] = {23722, 1, true, limitStorage = 10045, limit = 1} -- 1 light stone shower rune
        }
    }
 
    local vocationsOutfits = {
           -- sorcerer
        [1] = {
            lookBody = 109,
            lookAddons = 0,
            lookTypeName = {Mage}, -- {male, female}
            lookTypeEx = 130,
            lookTypeFm = 138,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 112,
            lookFeet = 128
        },
        -- druid
        [2] = {
            lookBody = 123,
            lookAddons = 0,
            lookTypeName = {Mage}, -- {male, female}
            lookTypeEx = 130,
            lookTypeFm = 138,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 9,
            lookFeet = 118
        },
        -- paladin
        [3] = {
            lookBody = 117,
            lookAddons = 0,
            lookTypeName = {Hunter}, -- {male, female}
            lookTypeEx = 129,
            lookTypeFm = 137,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 98,
            lookFeet = 78
        },
        -- knight
        [4] = {
            lookBody = 38,
            lookAddons = 0,
            lookTypeName = {Knight}, -- {male, female}
            lookTypeEx = 131,
            lookTypeFm = 139,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 94,
            lookFeet = 115,
        }
    }
    player:setVocation(toVocation) -- first set vocation, to add items
    for toVocation = 1, 4 do
        for slot, info in pairs(vocationsItems[toVocation]) do
            local itemCount = player:getItemCount(info[1])
            if itemCount > 0 and info[3] then
                if info[1] ~= 8704 and info[1] ~= 7620 and info[1] ~= 23723 and info[1] ~= 23722 then
                    player:removeItem(info[1], itemCount)
                end
            end
        end
    end
 
    local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)
    for slot, info in pairs(vocationsItems[toVocation]) do
        local extra
        if slot > CONST_SLOT_AMMO then
            extra = true
        else
            local equipped = player:getSlotItem(slot)
            if equipped then
                equipped:moveTo(backpack)
            end
        end
 
        local giveItem = true
        if info.limit and info.limitStorage then
            local given = math.max(player:getStorageValue(info.limitStorage), 0)
            if given >= info.limit then
                giveItem = false
            else
                player:setStorageValue(info.limitStorage, given + 1)
            end
        end
 
        if giveItem then
            if extra then
                player:addItemEx(Game.createItem(info[1], info[2]), INDEX_WHEREEVER, 0)
            else
                local ret = player:addItem(info[1], info[2], false, 1, slot)
                if not ret then
                    player:addItemEx(Game.createItem(info[1], info[2]), false, slot)
                end
            end
        end
    end
 
    local outfit = vocationsOutfits[toVocation]

    if toVocation ~= 0 then   
    
        local tutorials = {5, 6, 4, 3}
        player:sendTutorial(tutorials[toVocation])
    
        if player:getSex() == PLAYERSEX_MALE then
            player:setOutfit(
                {
                    lookBody = outfit.lookBody,
                    lookAddons = outfit.lookAddons,
                    lookTypeName = outfit.lookTypeName,
                    lookType = outfit.lookTypeEx,
                    lookHead = outfit.lookHead,
                    lookMount = outfit.lookMount,
                    lookLegs = outfit.lookLegs,
                    lookFeet = outfit.lookFeet,
                }
            )
        else
            player:setOutfit(
                {
                    lookBody = outfit.lookBody,
                    lookAddons = outfit.lookAddons,
                    lookTypeName = outfit.lookTypeName,
                    lookType = outfit.lookTypeFm,
                    lookHead = outfit.lookHead,
                    lookMount = outfit.lookMount,
                    lookLegs = outfit.lookLegs,
                    lookFeet = outfit.lookFeet,
                }
            )
        end
    end
    if player:getLevel() >= 9 and player:getVocation():getId() == 1 then
    player:setMaxHealth(5 * (player:getLevel() + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 * ((6 * player:getLevel()) - (5 * 8) + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((10 * (player:getLevel() + 39))*100)
    elseif player:getLevel() >= 9 and player:getVocation():getId() == 2 then
    player:setMaxHealth(5 * (player:getLevel() + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 * ((6 * player:getLevel()) - (5 * 8) + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((10 * (player:getLevel() + 39))*100)
    elseif player:getLevel() >= 9 and player:getVocation():getId() == 3 then
    player:setMaxHealth(5 * ((2 * player:getLevel()) - 8 + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 * ((3 * player:getLevel())- (2 * 8) + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((10 * ((2 * player:getLevel()) - 8 + 39))*100)
    elseif player:getLevel() >= 9 and player:getVocation():getId() == 4 then
    player:setMaxHealth(5 *((3 * player:getLevel()) - (2 * 8) + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 *(player:getLevel() + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((5 *((5 * player:getLevel()) - (5 * 8) + 94))*100)
    end
    
    msg = {'As a sorcerer, you can use the following spells: Magic Patch, Buzz, Scorch.',
    'As a druid, you can use these spells: Mud Attack, Chill Out, Magic Patch.',
    'As a paladin, you can use the following spells: Magic Patch, Arrow Call.',
    'As a knight, you can use the following spells: Bruise Bane.'}
    
    trialStorages = {Storage.Dawnport.Sorcerer, Storage.Dawnport.Druid, Storage.Dawnport.Paladin, Storage.Dawnport.Knight}       
                
    if player:getStorageValue(trialStorages[1]) == -1 and player:getStorageValue(trialStorages[2]) == -1 and player:getStorageValue(trialStorages[3]) == -1 and player:getStorageValue(trialStorages[4]) == -1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'As this is the first time you try out a vocation, the Guild has kitted you out. ' .. msg[toVocation])
    elseif player:getStorageValue(trialStorages[toVocation]) == -1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('As this is your first time as a %s' .. ', you received a few extra items. ' .. msg[toVocation], player:getVocation():getName()))
    elseif player:getStorageValue(trialStorages[toVocation]) > -1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('You have received the weapons of a %s' .. '. ' .. msg[toVocation], player:getVocation():getName()))
    end
        
    if fromVocation ~= 0 then
        player:setStorageValue(trialStorages[toVocation], 1)
        if toVocation == 1 or toVocation == 2 then -- sorc
            skills, limits = {1,2,3,4,5}, {0, 20} --((/SORC e DRUID/skill ids de 1 a 5), (limite: nil ML, 20 MELEE))
        elseif toVocation == 3 then -- pala
            skills, limits = {1,2,3,5}, {7, 20} --((/PALA/checar skill ids 1, 2, 3 e 5. ignorar 4 distance), (limite: 5 ML, --20 MEELE))
        elseif toVocation == 4 then -- ek
            skills, limits = {4}, {3, 20} --((/EK/checar skill id 4 distance), (limite: 3 ML, 20 MELEE))
        end
                
        for i = 1, #skills do
            
            if player:getMagicLevel() ~= nil then

                if player:getMagicLevel() > limits[1] then

                    local resultId = db.storeQuery("SELECT [ICODE]id[/ICODE] FROM [ICODE]players[/ICODE] WHERE [ICODE]name[/ICODE] = " .. db.escapeString(player:getName():lower()))
                    local accountId = result.getDataInt(resultId, "id")
                    player:remove()
                    db.query("UPDATE [ICODE]players[/ICODE] SET [ICODE]maglevel[/ICODE] = '0', [ICODE]manaspent[/ICODE] = '0', [ICODE]skill_fist[/ICODE] = '10', [ICODE]skill_fist_tries[/ICODE] = '0', [ICODE]skill_club[/ICODE] = '10', [ICODE]skill_club_tries[/ICODE] = '0', [ICODE]skill_sword[/ICODE] = '10', [ICODE]skill_sword_tries[/ICODE] = '0', [ICODE]skill_axe[/ICODE] = '10', [ICODE]skill_axe_tries[/ICODE] = '0', [ICODE]skill_dist[/ICODE] = '10', [ICODE]skill_dist_tries[/ICODE] = '0', [ICODE]skill_shielding[/ICODE] = '10', [ICODE]skill_shielding_tries[/ICODE] = '0', [ICODE]skill_fishing[/ICODE] = '10', [ICODE]skill_fishing_tries[/ICODE] = '0' WHERE [ICODE]players[/ICODE].[ICODE]id[/ICODE] = " .. accountId)

                    return true

                end

            end

            if player:getSkillLevel(skills[i]) > limits[2] then

                local resultId = db.storeQuery("SELECT [ICODE]id[/ICODE] FROM [ICODE]players[/ICODE] WHERE [ICODE]name[/ICODE] = " .. db.escapeString(player:getName():lower()))
                local accountId = result.getDataInt(resultId, "id")
                player:remove()
                db.query("UPDATE [ICODE]players[/ICODE] SET [ICODE]maglevel[/ICODE] = '0', [ICODE]manaspent[/ICODE] = '0', [ICODE]skill_fist[/ICODE] = '10', [ICODE]skill_fist_tries[/ICODE] = '0', [ICODE]skill_club[/ICODE] = '10', [ICODE]skill_club_tries[/ICODE] = '0', [ICODE]skill_sword[/ICODE] = '10', [ICODE]skill_sword_tries[/ICODE] = '0', [ICODE]skill_axe[/ICODE] = '10', [ICODE]skill_axe_tries[/ICODE] = '0', [ICODE]skill_dist[/ICODE] = '10', [ICODE]skill_dist_tries[/ICODE] = '0', [ICODE]skill_shielding[/ICODE] = '10', [ICODE]skill_shielding_tries[/ICODE] = '0', [ICODE]skill_fishing[/ICODE] = '10', [ICODE]skill_fishing_tries[/ICODE] = '0' WHERE [ICODE]players[/ICODE].[ICODE]id[/ICODE] = " .. accountId)

                retornar verdadeiro

            fim

        fim
    
    fim

    retornar verdadeiro

fim

local centerPosition = Position (32065, 31891, 5)

função onStepIn (criatura, item, posição, fromPosition)
    se criatura: isPlayer (), então
        jogador local = Jogador (criatura)
        local toVocation = Lado a lado (posição): getGround (): getActionId () - 20000
        local fromVocation = player: getVocation (): getId ()
        
        if player: getLevel ()> 19 e (centerPosition: getDistance (fromPosition) <centerPosition: getDistance (position)) então
            player: teleportTo (Position (fromPosition))
        elseif fromVocation ~ = toVocation e (centerPosition: getDistance (fromPosition) <centerPosition: getDistance (position)) e player: getStorageValue (Storage.Dawnport.oressa) <1 então
            getFirstItems (jogador)
            player: getPosition (): sendMagicEffect (CONST_ME_BLOCKHIT)
            changeVocation (player, fromVocation, toVocation)
        fim
    fim
    retornar verdadeiro
fim [/ CODE]
 
i solved it creating new 4 vocations(with the same names) with low progress in skills like rookgaard (no vocation).
then at level 8 you can select the normal voc.
 
i solved it creating new 4 vocations(with the same names) with low progress in skills like rookgaard (no vocation).
then at level 8 you can select the normal voc.

As far as I can tell, this might be the least painful solution. I tried looking for a solution involving addSkillTries(skill, tries) but it doesn't like playing with negative increments (overflows) so you'd have to edit the source.
 
I have vocations for dawnport but the moment they become level 8 they automatically promote to the regular vocation and can thus powerlevel their magic level in dawnport, is there any way to remove them automatically promoting at level 8?

If not possible, is there a way to limit the max skills they can get in dawnport?
 
i solved it creating new 4 vocations(with the same names) with low progress in skills like rookgaard (no vocation).
then at level 8 you can select the normal voc.
this is the tibia real way.
 
i solved it creating new 4 vocations(with the same names) with low progress in skills like rookgaard (no vocation).
then at level 8 you can select the normal voc.
this is the tibia real way.
Tibia way is blocking skills..

Ml for knight is set to max 4
skilsl are set to max 20

If you make a mage and get ml 15 when changing to knight it will downgrade it to 4 so you wont have knight with high ml..
Dont say thinsg you dont know, its like you dont play real tibia..

max ml and skills for mages = 20
dont remember max ml for paladin but skills are also 20
and as said ml for knight cant go higher than 4
Your way is a bad one, i cant even say its a workaround cuz it isnt..
The message you get when trying leveling up your skill higher than the limit is this one
from a sorcerer reaching ml 20
You cannot train your magic level any further. If you want to improve it further, you must go to the mainland.
You advanced to magic level 20.

Post automatically merged:

I'm trying to make Dawnport possible on my server, it's already working, changing vocation, giving items, changing hp, mana and cap ... But there is a big problem, the player can switch to a sorcerer, get high ML and return to the knight and become an OP, the same as for wizards, he can get great protection and can change his vocation. Does anyone know how to convert ML / SKILLS when players change their vocation in the dawnport block?

Lua:
local function givePlayerItem(player, item, slot)
    local ret = player:addItemEx(item, false, sot)
    if not ret then
        player:addItemEx(item, false, INDEX_WHEREEVER, 0)
    end
end

local function getFirstItems(player)
    local firstItems = {
        storage = 4687,

        slots = {
            [CONST_SLOT_HEAD] = Game.createItem(2461),
            [CONST_SLOT_ARMOR] = Game.createItem(2651),
            [CONST_SLOT_LEGS] = Game.createItem(2649),
            [CONST_SLOT_FEET] = Game.createItem(2643)
        }
    }
   
    local backpack = player:getSlotItem(CONST_SLOT_FEET)
    if player:getStorageValue(firstItems.storage) < 1 then
        for slot, item in pairs(firstItems.slots) do
            givePlayerItem(player, item, slot)
        end
        player:setStorageValue(firstItems.storage, 1)      
    end
end

local function changeVocation(player, fromVocation, toVocation)
    local vocationsItems = {
        -- sorcerer
        [1] = {
            [CONST_SLOT_LEFT] = {23719, 1, true}, -- the scorcher
            [CONST_SLOT_RIGHT] = {23771, 1, true}, -- spellbook of the novice
            [11] = {8704, 2, true, limitStorage = 10030, limit = 1}, -- potion
            [12] = {7620, 10, true, limitStorage = 10031, limit = 1}, -- potion
            [13] = {23723, 2, true, limitStorage = 10032, limit = 1}, -- 2 lightest missile runes
            [14] = {23722, 2, true, limitStorage = 10033, limit = 1} -- 2 light stone shower runes
        },
        -- druid
        [2] = {
            [CONST_SLOT_LEFT] = {23721, 1, true}, -- the chiller
            [CONST_SLOT_RIGHT] = {23771, 1, true}, -- spellbook of the novice
            [11] = {8704, 2, true, limitStorage = 10034, limit = 1}, -- potion
            [12] = {7620, 10, true, limitStorage = 10035, limit = 1}, -- potion
            [13] = {23723, 2, true, limitStorage = 10036, limit = 1}, -- 2 lightest missile runes
            [14] = {23722, 2, true, limitStorage = 10037, limit = 1} -- 2 light stone shower runes
        },
        -- paladin
        [3] = {
            [CONST_SLOT_LEFT] = {2456, 1, true}, -- bow
            [CONST_SLOT_AMMO] = {23839, 100, true}, -- 100 arrows
            [11] = {8704, 7, true, limitStorage = 10038, limit = 1}, -- potion
            [12] = {7620, 5, true, limitStorage = 10039, limit = 1}, -- potion
            [13] = {23723, 1, true, limitStorage = 10040, limit = 1}, -- 1 lightest missile rune
            [14] = {23722, 1, true, limitStorage = 10041, limit = 1} -- 1 light stone shower rune
        },
        -- knight
        [4] = {
            [CONST_SLOT_LEFT] = {2379, 1, true}, -- dagger
            [CONST_SLOT_RIGHT] = {2512, 1, true}, -- wooden shield
            [11] = {8704, 10, true, limitStorage = 10042, limit = 1}, -- potion
            [12] = {7620, 2, true, limitStorage = 10043, limit = 1}, -- potion
            [13] = {23723, 1, true, limitStorage = 10044, limit = 1}, -- 1 lightest missile rune
            [14] = {23722, 1, true, limitStorage = 10045, limit = 1} -- 1 light stone shower rune
        }
    }

    local vocationsOutfits = {
           -- sorcerer
        [1] = {
            lookBody = 109,
            lookAddons = 0,
            lookTypeName = {Mage}, -- {male, female}
            lookTypeEx = 130,
            lookTypeFm = 138,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 112,
            lookFeet = 128
        },
        -- druid
        [2] = {
            lookBody = 123,
            lookAddons = 0,
            lookTypeName = {Mage}, -- {male, female}
            lookTypeEx = 130,
            lookTypeFm = 138,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 9,
            lookFeet = 118
        },
        -- paladin
        [3] = {
            lookBody = 117,
            lookAddons = 0,
            lookTypeName = {Hunter}, -- {male, female}
            lookTypeEx = 129,
            lookTypeFm = 137,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 98,
            lookFeet = 78
        },
        -- knight
        [4] = {
            lookBody = 38,
            lookAddons = 0,
            lookTypeName = {Knight}, -- {male, female}
            lookTypeEx = 131,
            lookTypeFm = 139,
            lookHead = 95,
            lookMount = 0,
            lookLegs = 94,
            lookFeet = 115,
        }
    }
    player:setVocation(toVocation) -- first set vocation, to add items
    for toVocation = 1, 4 do
        for slot, info in pairs(vocationsItems[toVocation]) do
            local itemCount = player:getItemCount(info[1])
            if itemCount > 0 and info[3] then
                if info[1] ~= 8704 and info[1] ~= 7620 and info[1] ~= 23723 and info[1] ~= 23722 then
                    player:removeItem(info[1], itemCount)
                end
            end
        end
    end

    local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)
    for slot, info in pairs(vocationsItems[toVocation]) do
        local extra
        if slot > CONST_SLOT_AMMO then
            extra = true
        else
            local equipped = player:getSlotItem(slot)
            if equipped then
                equipped:moveTo(backpack)
            end
        end

        local giveItem = true
        if info.limit and info.limitStorage then
            local given = math.max(player:getStorageValue(info.limitStorage), 0)
            if given >= info.limit then
                giveItem = false
            else
                player:setStorageValue(info.limitStorage, given + 1)
            end
        end

        if giveItem then
            if extra then
                player:addItemEx(Game.createItem(info[1], info[2]), INDEX_WHEREEVER, 0)
            else
                local ret = player:addItem(info[1], info[2], false, 1, slot)
                if not ret then
                    player:addItemEx(Game.createItem(info[1], info[2]), false, slot)
                end
            end
        end
    end

    local outfit = vocationsOutfits[toVocation]

    if toVocation ~= 0 then  
   
        local tutorials = {5, 6, 4, 3}
        player:sendTutorial(tutorials[toVocation])
   
        if player:getSex() == PLAYERSEX_MALE then
            player:setOutfit(
                {
                    lookBody = outfit.lookBody,
                    lookAddons = outfit.lookAddons,
                    lookTypeName = outfit.lookTypeName,
                    lookType = outfit.lookTypeEx,
                    lookHead = outfit.lookHead,
                    lookMount = outfit.lookMount,
                    lookLegs = outfit.lookLegs,
                    lookFeet = outfit.lookFeet,
                }
            )
        else
            player:setOutfit(
                {
                    lookBody = outfit.lookBody,
                    lookAddons = outfit.lookAddons,
                    lookTypeName = outfit.lookTypeName,
                    lookType = outfit.lookTypeFm,
                    lookHead = outfit.lookHead,
                    lookMount = outfit.lookMount,
                    lookLegs = outfit.lookLegs,
                    lookFeet = outfit.lookFeet,
                }
            )
        end
    end
    if player:getLevel() >= 9 and player:getVocation():getId() == 1 then
    player:setMaxHealth(5 * (player:getLevel() + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 * ((6 * player:getLevel()) - (5 * 8) + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((10 * (player:getLevel() + 39))*100)
    elseif player:getLevel() >= 9 and player:getVocation():getId() == 2 then
    player:setMaxHealth(5 * (player:getLevel() + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 * ((6 * player:getLevel()) - (5 * 8) + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((10 * (player:getLevel() + 39))*100)
    elseif player:getLevel() >= 9 and player:getVocation():getId() == 3 then
    player:setMaxHealth(5 * ((2 * player:getLevel()) - 8 + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 * ((3 * player:getLevel())- (2 * 8) + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((10 * ((2 * player:getLevel()) - 8 + 39))*100)
    elseif player:getLevel() >= 9 and player:getVocation():getId() == 4 then
    player:setMaxHealth(5 *((3 * player:getLevel()) - (2 * 8) + 29))
    player:addHealth(player:getMaxHealth())
    player:setMaxMana(5 *(player:getLevel() + 10))
    player:addMana(player:getMaxMana())
    player:setCapacity((5 *((5 * player:getLevel()) - (5 * 8) + 94))*100)
    end
   
    msg = {'As a sorcerer, you can use the following spells: Magic Patch, Buzz, Scorch.',
    'As a druid, you can use these spells: Mud Attack, Chill Out, Magic Patch.',
    'As a paladin, you can use the following spells: Magic Patch, Arrow Call.',
    'As a knight, you can use the following spells: Bruise Bane.'}
   
    trialStorages = {Storage.Dawnport.Sorcerer, Storage.Dawnport.Druid, Storage.Dawnport.Paladin, Storage.Dawnport.Knight}      
               
    if player:getStorageValue(trialStorages[1]) == -1 and player:getStorageValue(trialStorages[2]) == -1 and player:getStorageValue(trialStorages[3]) == -1 and player:getStorageValue(trialStorages[4]) == -1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'As this is the first time you try out a vocation, the Guild has kitted you out. ' .. msg[toVocation])
    elseif player:getStorageValue(trialStorages[toVocation]) == -1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('As this is your first time as a %s' .. ', you received a few extra items. ' .. msg[toVocation], player:getVocation():getName()))
    elseif player:getStorageValue(trialStorages[toVocation]) > -1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('You have received the weapons of a %s' .. '. ' .. msg[toVocation], player:getVocation():getName()))
    end
       
    if fromVocation ~= 0 then
        player:setStorageValue(trialStorages[toVocation], 1)
        if toVocation == 1 or toVocation == 2 then -- sorc
            skills, limits = {1,2,3,4,5}, {0, 20} --((/SORC e DRUID/skill ids de 1 a 5), (limite: nil ML, 20 MELEE))
        elseif toVocation == 3 then -- pala
            skills, limits = {1,2,3,5}, {7, 20} --((/PALA/checar skill ids 1, 2, 3 e 5. ignorar 4 distance), (limite: 5 ML, --20 MEELE))
        elseif toVocation == 4 then -- ek
            skills, limits = {4}, {3, 20} --((/EK/checar skill id 4 distance), (limite: 3 ML, 20 MELEE))
        end
               
        for i = 1, #skills do
           
            if player:getMagicLevel() ~= nil then

                if player:getMagicLevel() > limits[1] then

                    local resultId = db.storeQuery("SELECT [ICODE]id[/ICODE] FROM [ICODE]players[/ICODE] WHERE [ICODE]name[/ICODE] = " .. db.escapeString(player:getName():lower()))
                    local accountId = result.getDataInt(resultId, "id")
                    player:remove()
                    db.query("UPDATE [ICODE]players[/ICODE] SET [ICODE]maglevel[/ICODE] = '0', [ICODE]manaspent[/ICODE] = '0', [ICODE]skill_fist[/ICODE] = '10', [ICODE]skill_fist_tries[/ICODE] = '0', [ICODE]skill_club[/ICODE] = '10', [ICODE]skill_club_tries[/ICODE] = '0', [ICODE]skill_sword[/ICODE] = '10', [ICODE]skill_sword_tries[/ICODE] = '0', [ICODE]skill_axe[/ICODE] = '10', [ICODE]skill_axe_tries[/ICODE] = '0', [ICODE]skill_dist[/ICODE] = '10', [ICODE]skill_dist_tries[/ICODE] = '0', [ICODE]skill_shielding[/ICODE] = '10', [ICODE]skill_shielding_tries[/ICODE] = '0', [ICODE]skill_fishing[/ICODE] = '10', [ICODE]skill_fishing_tries[/ICODE] = '0' WHERE [ICODE]players[/ICODE].[ICODE]id[/ICODE] = " .. accountId)

                    return true

                end

            end

            if player:getSkillLevel(skills[i]) > limits[2] then

                local resultId = db.storeQuery("SELECT [ICODE]id[/ICODE] FROM [ICODE]players[/ICODE] WHERE [ICODE]name[/ICODE] = " .. db.escapeString(player:getName():lower()))
                local accountId = result.getDataInt(resultId, "id")
                player:remove()
                db.query("UPDATE [ICODE]players[/ICODE] SET [ICODE]maglevel[/ICODE] = '0', [ICODE]manaspent[/ICODE] = '0', [ICODE]skill_fist[/ICODE] = '10', [ICODE]skill_fist_tries[/ICODE] = '0', [ICODE]skill_club[/ICODE] = '10', [ICODE]skill_club_tries[/ICODE] = '0', [ICODE]skill_sword[/ICODE] = '10', [ICODE]skill_sword_tries[/ICODE] = '0', [ICODE]skill_axe[/ICODE] = '10', [ICODE]skill_axe_tries[/ICODE] = '0', [ICODE]skill_dist[/ICODE] = '10', [ICODE]skill_dist_tries[/ICODE] = '0', [ICODE]skill_shielding[/ICODE] = '10', [ICODE]skill_shielding_tries[/ICODE] = '0', [ICODE]skill_fishing[/ICODE] = '10', [ICODE]skill_fishing_tries[/ICODE] = '0' WHERE [ICODE]players[/ICODE].[ICODE]id[/ICODE] = " .. accountId)

                retornar verdadeiro

            fim

        fim
   
    fim

    retornar verdadeiro

fim

local centerPosition = Position (32065, 31891, 5)

função onStepIn (criatura, item, posição, fromPosition)
    se criatura: isPlayer (), então
        jogador local = Jogador (criatura)
        local toVocation = Lado a lado (posição): getGround (): getActionId () - 20000
        local fromVocation = player: getVocation (): getId ()
       
        if player: getLevel ()> 19 e (centerPosition: getDistance (fromPosition) <centerPosition: getDistance (position)) então
            player: teleportTo (Position (fromPosition))
        elseif fromVocation ~ = toVocation e (centerPosition: getDistance (fromPosition) <centerPosition: getDistance (position)) e player: getStorageValue (Storage.Dawnport.oressa) <1 então
            getFirstItems (jogador)
            player: getPosition (): sendMagicEffect (CONST_ME_BLOCKHIT)
            changeVocation (player, fromVocation, toVocation)
        fim
    fim
    retornar verdadeiro
fim [/ CODE]
Look this one.. it isnt for 1.x but you can find some help here..
i dont know how, i tried to bring it to 1.2 but ive failed..
im looking for it too

link here TFS 0.X - Convert SKILLS/ML when change vocation Dawnport | Page 2 | OTLand
 
Last edited:
Back
Top