• 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 make Dawnport possible in my 8.60 server, it's already working, changing vocation, giving items...

But there is a big problem, player can switch to sorcerer, get ML high and back to knight and be OP, same to mages, can get a big shielding and can change vocation.

Is anybody know how to convert ML/SKILLS when players change vocation in dawnport tile?
Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {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
        }
   }
}

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
    if item.actionid == 65530 then -- sorc
        doPlayerSetVocation(cid, 1)
        needcap = 88
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        -- convert ML and SKILLS
    elseif item.actionid == 65529 then -- druid
        doPlayerSetVocation(cid, 2)
        needcap = 91
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        -- convert ML and SKILLS
    elseif item.actionid == 65528 then -- pally
        doPlayerSetVocation(cid, 3)
        needcap = 122
        hp = (185) + (extralvls * 10)
        mp = (35) + (extralvls * 15)
        cap = (400) + (extralvls * 20)
        -- convert ML and SKILLS
    elseif item.actionid == 65527 then -- kina
        doPlayerSetVocation(cid, 4)
        needcap = 44
        hp = (185) + (extralvls * 15)
        mp = (35) + (extralvls * 5)
        cap = (400) + (extralvls * 25)
        -- convert ML and SKILLS
    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)
    doPlayerSetMaxCapacity(cid, cap)

    -- 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
 
Hi, you need to create 4 new vocations, example.


. New Druid / Druid / Elder druid
. New Knight / Knight / Elite knight

No vocation) This four Dawnport. Mainland. Promos.

. New Paladin / Paladin / Royal Paladin
. New Sorcerer / Sorcerer / Master Sorcerer

Then the first vocations NEWS ones, set Skill and ML advance same as NO VOCATION, in vocation xml.
 
Hi, you need to create 4 new vocations, example.


. New Druid / Druid / Elder druid
. New Knight / Knight / Elite knight

No vocation) This four Dawnport. Mainland. Promos.

. New Paladin / Paladin / Royal Paladin
. New Sorcerer / Sorcerer / Master Sorcerer

Then the first vocations NEWS ones, set Skill and ML advance same as NO VOCATION, in vocation xml.

I got your point, would be so much easer, but it would destroy the experience to experiment a vocation.
 
the /New ones vocations, are the four that you gonna use in dawnport

I've gottcha, it's not a bad idea...
But like the guy said, it would be so much better to players if work just like on Tibia

If i make this vocation stuff, it would not shows the players the real experience of each vocation...
There is no way to reset the skills/ml just like on normal tibia when players change vocation in Dawnport?
 
I'm trying to make Dawnport possible in my 8.60 server, it's already working, changing vocation, giving items...

But there is a big problem, player can switch to sorcerer, get ML high and back to knight and be OP, same to mages, can get a big shielding and can change vocation.

Is anybody know how to convert ML/SKILLS when players change vocation in dawnport tile?
Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2302, count = 15} -- FIREBALL
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2287, count = 30}, -- lmm
            {itemID = 2265, count = 5}, -- IH
            {itemID = 2302, count = 10} -- FIREBALL
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {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
        }
   }
}

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
    if item.actionid == 65530 then -- sorc
        doPlayerSetVocation(cid, 1)
        needcap = 88
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        -- convert ML and SKILLS
    elseif item.actionid == 65529 then -- druid
        doPlayerSetVocation(cid, 2)
        needcap = 91
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        -- convert ML and SKILLS
    elseif item.actionid == 65528 then -- pally
        doPlayerSetVocation(cid, 3)
        needcap = 122
        hp = (185) + (extralvls * 10)
        mp = (35) + (extralvls * 15)
        cap = (400) + (extralvls * 20)
        -- convert ML and SKILLS
    elseif item.actionid == 65527 then -- kina
        doPlayerSetVocation(cid, 4)
        needcap = 44
        hp = (185) + (extralvls * 15)
        mp = (35) + (extralvls * 5)
        cap = (400) + (extralvls * 25)
        -- convert ML and SKILLS
    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)
    doPlayerSetMaxCapacity(cid, cap)

    -- 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
Hi,
U are using tfs 0.X, i don't have a server to test to you now... but try use:

Lua:
getPlayerSkillTries(cid, skill)
and
getPlayerRequiredSkillTries(cid, skillId, skillLevel)

Get skill tries that player have in each Skill, change player vocation, set skills to 10, and give back all tries player got in each skill. I think will work. I realy can't do the code now, think about change your TFS to newers versions... In 1.X version, this should be very easy to do...

Hope this helps.
 
Hi,
U are using tfs 0.X, i don't have a server to test to you now... but try use:

Lua:
getPlayerSkillTries(cid, skill)
and
getPlayerRequiredSkillTries(cid, skillId, skillLevel)

Get skill tries that player have in each Skill, change player vocation, set skills to 10, and give back all tries player got in each skill. I think will work. I realy can't do the code now, think about change your TFS to newers versions... In 1.X version, this should be very easy to do...

Hope this helps.

Oh thank you!

I've tried it:
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 it's not working right, if i keep going to knight tile
Sometimes it add skills and sometimes it remove skills

Why?

my luafunctions source: https://github.com/Fir3element/3777/blob/master/src/luascript.cpp
 
Oh thank you!

I've tried it:
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 it's not working right, if i keep going to knight tile
Sometimes it add skills and sometimes it remove skills

Why?

my luafunctions source: https://github.com/Fir3element/3777/blob/master/src/luascript.cpp
Send full script please, this is in Knight tile? I think u should have only 1 script to all vocations, and actionID in each tile to determine what vocation belongs the tile. U changing player vocation before add the tries back?
Waiting.
 
the solution has been posted By TITOKERE.

create four new vocations called 'New druid' 'New Knight' 'New paladin' 'New Sorcerer'

this four vocations will be the ones in dawnport, and remember in vocations xml, put the skills the same as NO/vocation. and hp/mana.

so this four vocations will have low advance in skills like No vocation on rookgaard.

then when the players reach level 8, and talk with the NPC or simple open the door below , then change to the normal vocation id /druid, sorcerer, knight, paladin.
 
Send full script please, this is in Knight tile? I think u should have only 1 script to all vocations, and actionID in each tile to determine what vocation belongs the tile. U changing player vocation before add the tries back?
Waiting.

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
    if item.actionid == 65530 then -- sorc
        doPlayerSetVocation(cid, 1)
        needcap = 88
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        --- 
    elseif item.actionid == 65529 then -- druid
        doPlayerSetVocation(cid, 2)
        needcap = 91
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        --- 
    elseif item.actionid == 65528 then -- pally
        doPlayerSetVocation(cid, 3)
        needcap = 122
        hp = (185) + (extralvls * 10)
        mp = (35) + (extralvls * 15)
        cap = (400) + (extralvls * 20)
        --- 
    elseif item.actionid == 65527 then -- kina
        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 |
    -- 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)
    -- | 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
 
the solution has been posted By TITOKERE.

create four new vocations called 'New druid' 'New Knight' 'New paladin' 'New Sorcerer'

this four vocations will be the ones in dawnport, and remember in vocations xml, put the skills the same as NO/vocation. and hp/mana.

so this four vocations will have low advance in skills like No vocation on rookgaard.

then when the players reach level 8, and talk with the NPC or simple open the door below , then change to the normal vocation id /druid, sorcerer, knight, paladin.
Yeah, is much better and fast to do...

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
    if item.actionid == 65530 then -- sorc
        doPlayerSetVocation(cid, 1)
        needcap = 88
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        ---
    elseif item.actionid == 65529 then -- druid
        doPlayerSetVocation(cid, 2)
        needcap = 91
        hp = (185) + (extralvls * 5)
        mp = (35) + (extralvls * 30)
        cap = (400) + (extralvls * 10)
        ---
    elseif item.actionid == 65528 then -- pally
        doPlayerSetVocation(cid, 3)
        needcap = 122
        hp = (185) + (extralvls * 10)
        mp = (35) + (extralvls * 15)
        cap = (400) + (extralvls * 20)
        ---
    elseif item.actionid == 65527 then -- kina
        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 |
    -- 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)
    -- | 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
Try this, i don't tested, don't have a server to test.

Lua:
-- 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
 
Yeah, is much better and fast to do...


Try this, i don't tested, don't have a server to test.

Lua:
-- 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

Same thing...
Not working

I tested with a knight skills axe 20
When i become sorcerer it was go to 10 with 20% to 11

So i go back to become a knight again
And instead get skills 20 back, it downgrade to skill 10 with 100% to 11
 
Same thing...
Not working

I tested with a knight skills axe 20
When i become sorcerer it was go to 10 with 20% to 11

So i go back to become a knight again
And instead get skills 20 back, it downgrade to skill 10 with 100% to 11
I will have to get a 0.X server to test this... I can't do this now... TITOKERE sended the best way to do this, is better and fast. I will try do this using skillTries, if i make it, i send here on thread...
To solve your problem now, use TITOKERE method.
 
Titokere solution jerry-rig the problem
It's a quick solution, If anyone really discovery how to fix this and make a 100% dawnport to 860 pls post in here
 
I will have to get a 0.X server to test this... I can't do this now... TITOKERE sended the best way to do this, is better and fast. I will try do this using skillTries, if i make it, i send here on thread...
To solve your problem now, use TITOKERE method.


Titokere solution jerry-rig the problem
It's a quick solution, If anyone really discovery how to fix this and make a 100% dawnport to 860 pls post in here

I hope you guys find a solution, i don't like the TITOKERE either, thanks to give, but it really looks like a quicky solution
 
Back
Top