SorketROrk
Well-Known Member
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:
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:
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
I appreciate all your efforts to help me with this, thanks.
Yours,
SRO
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
I appreciate all your efforts to help me with this, thanks.
Yours,
SRO