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

Lua Dawnport vocation changer

cristianso

Member
Joined
Jan 27, 2019
Messages
47
Reaction score
16
Hello!
I AM trying to make a script that looks like global... Everything is looking fine, I can choose my vocation lvl 1, but the problem is If I choose sorcerer, for example, I Will have 285 mana instead of 80 (like global) when I reach lvl 8. Same Goes for Knight (higher Hp at lvl 8).

My question is: what should I do to avoid getting a higher amount of mana or Hp at lvl 8?
 
What does "like global" mean? I assume you mean another server, but you should describe what that server does so that people who haven't played on the server still can help you.

What account maker are you using? If website (e.g. Znote), it's probably in your PHP script.
 
My Idea is making a server that start level 1 and you can choose your vocation by passing through tiles (like dawnport). I managed to do It, but it is not like in global.
Global Tibia you get 5 mana and 5 Hp per level until lvl 8, even If you have vocation. When you reach level 8 you must have 185 Hp an 90 mp.
I AM not getting these values... When I reach level 8 as sorcerer, for example, I get 185 Hp 285 mp (something close to this).

So, what I am looking for is a script that makes me get 5mp and 5hp until level 8, and then I can get the normal mp and Hp per vocation after lvl 8.
 
I did It.
I finally found out a way to execute my Idea.
Could you share it? Not because it's difficult but just because you asked for help.
 
It is basic but should do the trick... The character will act like a non-vocation, gaining 5hp, 5mp and 10cap per level until level 8. After level 8 you are going to get your stats normally...
I was having trouble when the character could get more than 2 levels at once, but I managed to fix it too.


Lua:
function onAdvance(player, skill, oldLevel, newLevel)
    local level_dif = newLevel   
    if newLevel >= 1 and newLevel <= 8 then   
        hp = ((newLevel-1)*5)+150
        mp = ((newLevel-1)*5)+55
        cap = ((newLevel-1)*1000)+40000
        player:setMaxHealth(hp)
        player:setMaxMana(mp)
        player:setCapacity(cap)
    end

    if newLevel > 8 and newLevel < 20 then
        local voc = player:getVocation():getId()
        level_dif = newLevel-8
            if voc == 1 then
                hp = (level_dif*5)+185
                mp = (level_dif*30)+90
                cap = (level_dif*1000)+47000
                player:setMaxHealth(hp)
                player:setMaxMana(mp)
                player:setCapacity(cap)
            end
            if voc == 2 then
                hp = (level_dif*5)+185
                mp = (level_dif*30)+90
                cap = (level_dif*1000)+47000
                player:setMaxHealth(hp)
                player:setMaxMana(mp)
                player:setCapacity(cap)
            end
            if voc == 3 then
                hp = (level_dif*10)+185
                mp = (level_dif*15)+90
                cap = (level_dif*2000)+47000
                player:setMaxHealth(hp)
                player:setMaxMana(mp)
                player:setCapacity(cap)
            end
            if voc == 4 then
                hp = (level_dif*15)+185
                mp = (level_dif*5)+90
                cap = (level_dif*2500)+47000
                player:setMaxHealth(hp)
                player:setMaxMana(mp)
                player:setCapacity(cap)
            end
    end
    return false
end
 
Well, just found another bug. :(
Whenever I use a spell, it reset my mana to 0 and my health to 150 lol
edit: the bug happens when I level up a skill...
 
Last edited:
Wouldn't it be best to give them the additional hp/mana while in dawnport so they "get a feel for the vocations benefits". Once they travel to main, run a script that sets their max health/mana to the proper amounts.

If this solution is not acceptable, you will need to make sure that the skill in your script is in fact LEVEL as onAdvance fires when any advancement is made (sword, axe, level, ect...)

I believe it would be SKILL_LEVEL
So...
Code:
if skill == SKILL_LEVEL then
 
Back
Top