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

RevScripts vocation/promotion scroll

delikerem

Member
Joined
Jan 9, 2020
Messages
118
Solutions
1
Reaction score
15
Hello,

I have been looking for a similar script but havent found one, i am looking for a script (prefer revscript) that changes vocation.

For example, there should be an item (scroll) that can be used.
lvl restriction to use this item and that changes your vocation ID to whatever is set in that script.

Also it should only be possible to click it once and an error message that says its been already used or something like that.

I am using 10.98 tfx 1.4.2

Hope someone could help me with this script :)
 
 
How do i put lvl restriction to it?
 
How do i put lvl restriction to it?
LUA:
local ITEM_ID_VOCS = 6527
local MIN_LEVEL = 20 -- Define the minimum level required to use the item

local vocationTransformations = {
    [1] = 5, -- Master Sorcerer
    [2] = 6, -- Elder Druid
    [3] = 7, -- Royal Paladin
    [4] = 8, -- Elite Knight
}

local VocsAction = Action()

function VocsAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() < MIN_LEVEL then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be at least level " .. MIN_LEVEL .. " to use this item.")
        return true
    end

    local currentVocation = player:getVocation():getId()
    local newVocation = vocationTransformations[currentVocation]

    if newVocation then
        player:setVocation(Vocation(newVocation))
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
        player:getPosition():sendMagicEffect(10)
        item:remove(1)
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sorry, your current vocation cannot be transformed.")
    end
    return true
end

VocsAction:id(ITEM_ID_VOCS)
VocsAction:register()
 

Similar threads

  • Question Question
Replies
14
Views
672
Back
Top