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

Change vocation when reach skill level?

jededias

Member
Joined
Jan 21, 2019
Messages
66
Solutions
1
Reaction score
12
Its possible to upgrade character vocation (change vocation) when player reach skill fist level 20 for example?
 
Ofcourse!

Look into the creatureScript onAdvance(player, skill, oldLevel, newLevel) and then you can use doPlayerSetVocation(cid, vocation) to set any vocation to the player.
 
That is actually a very interesting idea. Warrior < Arms Master, requires obtaining 65 in all melee skills. Class based around different attack effects depending on weapons.
 
Something like this?
@El Diablo @RookstayerSpike @Sajgon

Lua:
function onAdvance(player, skill, oldLevel, newLevel)
    if getPlayerSkill(SKILL_FIST) = 20 and (getPlayerStorageValue(cid, 8484) == EMPTY_STORAGE) then
        doPlayerSetVocation(cid, vocation)
        setPlayerStorageValue(cid, 8000, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
        doPlayerSendTextMessage(cid,22,"Congratulations, you obtained a promotion!")
        doRemoveItem(item.uid, 1)
    else
        return true
    end
end
 
Try this one, Not tested.
Lua:
local config = {
  fist = 20
}

function onAdvance(player, skill, oldLevel, newLevel)
local vocation = player:getVocation()
local promotion = vocation:getPromotion()
local vocName = player:getVocation():getName()
    if player:getSkillLevel(SKILL_FIST) == config.fist then
    player:setVocation(promotion)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Congratulations! You have been promoted!.')
    return true
end
end
 
Lua:
if skill == SKILL_FIST and newLevel == 20 then
    player:setVocation(Vocation(2))
    ...
end

I would do it something like this
 
Back
Top