Call Me saul
New Member
TFS 1.4.2
i've created 3rd promotion but i need a doll or smth when you click on it give you a new vocation
i've created 3rd promotion but i need a doll or smth when you click on it give you a new vocation
local ITEM_ID_VOCS = 6527
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)
local currentVocation = player:getVocation():getId()
local newVocation = vocationTransformations[currentVocation]
if newVocation then
player:setVocation(Vocation(newVocation))
local id =...
<action itemid="2349" script="promotion note.lua"/>
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local vocation = player:getVocation():getId()
if vocation >= 5 and vocation <= 8 then
vocation = vocation + 4
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
local ITEM_ID_VOCS = 6527
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)
local currentVocation = player:getVocation():getId()
local newVocation = vocationTransformations[currentVocation]
if newVocation then
player:setVocation(Vocation(newVocation))
local id = player:getId()
local name = player:getName()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
player:getPosition():sendMagicEffect(10)
item:remove(1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sorry, you don't have a vocation transformation defined for your current type.")
end
end
VocsAction:id(ITEM_ID_VOCS)
VocsAction:register()
very good Congratulations!!There is a table that will make your life easier... enter the correct vocations, for example, ID 1 for Sorcerer. When clicking on any item, he will gain a new vocation with ID 5, which is Master Sorcerer. It's very simple that way.
Revscripts.
LUA:local ITEM_ID_VOCS = 6527 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) local currentVocation = player:getVocation():getId() local newVocation = vocationTransformations[currentVocation] if newVocation then player:setVocation(Vocation(newVocation)) local id = player:getId() local name = player:getName() player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!") player:getPosition():sendMagicEffect(10) item:remove(1) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sorry, you don't have a vocation transformation defined for your current type.") end end VocsAction:id(ITEM_ID_VOCS) VocsAction:register()
worked thanks dudeThere is a table that will make your life easier... enter the correct vocations, for example, ID 1 for Sorcerer. When clicking on any item, he will gain a new vocation with ID 5, which is Master Sorcerer. It's very simple that way.
Revscripts.
LUA:local ITEM_ID_VOCS = 6527 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) local currentVocation = player:getVocation():getId() local newVocation = vocationTransformations[currentVocation] if newVocation then player:setVocation(Vocation(newVocation)) local id = player:getId() local name = player:getName() player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!") player:getPosition():sendMagicEffect(10) item:remove(1) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sorry, you don't have a vocation transformation defined for your current type.") end end VocsAction:id(ITEM_ID_VOCS) VocsAction:register()