• 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 One quick question about login.lua

SlayingWorld

Active Member
Joined
Jan 23, 2014
Messages
156
Reaction score
37
Location
USA
Is this code necessary? Its on my login.lua on creaturescripts, i am running latest TFS 1.2
Code:
-- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(STORAGEVALUE_PROMOTION)
        if not promotion and value ~= 1 then
            player:setStorageValue(STORAGEVALUE_PROMOTION, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end
What does it do? Because i added more promotions on my ot, but as soon as i logged in one of my chars they had automatically been promoted to promotion 2. Instead of staying as an elite knight they went to a reaper knight.
Then i went to my database and made his promotion back to elite knight, deleted that part of the code on the login.lua and when i logged in he stayed as an elite knight.
 
Is this code necessary? Its on my login.lua on creaturescripts, i am running latest TFS 1.2
Code:
-- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(STORAGEVALUE_PROMOTION)
        if not promotion and value ~= 1 then
            player:setStorageValue(STORAGEVALUE_PROMOTION, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end
What does it do? Because i added more promotions on my ot, but as soon as i logged in one of my chars they had automatically been promoted to promotion 2. Instead of staying as an elite knight they went to a reaper knight.
Then i went to my database and made his promotion back to elite knight, deleted that part of the code on the login.lua and when i logged in he stayed as an elite knight.
If you remove it. It will bug up your server.

Like this "local vocation = player:getVocation()" If this fail, You will be logged in as a non vocced character

and if this fails "if player:isPremium() then" You won't have the premium benefits.

so yes it's important to have login.lua.
 
If you remove it. It will bug up your server.

Like this "local vocation = player:getVocation()" If this fail, You will be logged in as a non vocced character

and if this fails "if player:isPremium() then" You won't have the premium benefits.

so yes it's important to have login.lua.

Its not bugging my server, i removed that code from my login.lua, and i am still able to use premium spells, i kept my own vocation elite knight, i even made new chars lvls 8 from website AAC and everything seems to run normal. Thats why im wondering what that code actually does, as i removed it and everything is running perfect.
 
Its not bugging my server, i removed that code from my login.lua, and i am still able to use premium spells, i kept my own vocation elite knight, i even made new chars lvls 8 from website AAC and everything seems to run normal. Thats why im wondering what that code actually does, as i removed it and everything is running perfect.
Nvm, i though that was the whole login.lua
idk then tbh

Have you added reaper knight in data/xml/vocations.xml?
 
k, i'm back.

I found this in the compat.lua you could try to do something with this, unfortunately I don't know how to script. :(
Code:
function getPromotedVocation(vocationId)
local vocation = Vocation(vocationId)
if vocation == nil then
return 0
end
local promotedVocation = vocation:getPromotion()
if promotedVocation == nil then
return 0
end
return promotedVocation:getId()
end
 
oh. Give me a second and I will find something for ya.


and cute mods sorry, i will probably double post <3
Dont worry i dont need mods or anything like that haha, just need to find out what that part of the code in login.lua does. But i appreciate your effort :D
 
Back
Top