• 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 [TFS 1.3] Demoted on relog

SorketROrk

Well-Known Member
Joined
Oct 14, 2020
Messages
152
Solutions
1
Reaction score
69
Location
Sweden
Hi,

I have tried several scripts both npc and on use of item where the player is promoted successfully.

The problem is when I relog the player goes back to original vocation.

Im using this script atm for a scroll that is used to promote the player:

Lua:
local cfg = {
    [1985] = {fromVoc = 1, toVoc = 20, namefrom = 'mage', nameto = 'sorcerer'},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local vocation = player:getVocation():getId()
    if vocation == 1 then
        vocation = 20
        player:setVocation(vocation)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
        item:remove()
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You're already at the maximum promotion level. Unable to utilize this item.")
    end
    return true
end

Player is promoted when using this item, but i cannot keep player promoted if he is to relog, how come?

Here is the login.lua for promotion:
Lua:
    -- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(PlayerStorageKeys.promotion)
        if not promotion and value ~= 1 then
            player:setStorageValue(PlayerStorageKeys.promotion, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end


Also ive tried to manually change the vocation thorugh the database, but its not taking effect when changing values, i can set lvl, skills, looktype without problem, but changing vocation is not working :eek:


I appreciate all your efforts to help me with this, thanks.

Yours,
SRO
 
Take a look - might be related to it


 
Take a look - might be related to it


I tried
Lua:
if not promotion and value == -1 then
but its not working.

Is this problem related to new vocations or will a knight promoting to elite knight also be affected by this issue after relog?
 
I tried
Lua:
if not promotion and value == -1 then
but its not working.

Is this problem related to new vocations or will a knight promoting to elite knight also be affected by this issue after relog?

Hi. If you are still looking for a solution here it is:

I had the same problem but it's fine now.
 
Back
Top