Hello, after looking at this thread i decided to do something like this to TFS 1.0.. So, here is it.
actions.xml
promotion.lua
actions.xml
Code:
<action itemid="5952" script="promotion.lua"/>
promotion.lua
Code:
local vocations = {
-- Vocation id 1 gonna upgrade to vocation id 2
-- Easy, huh?
[1] = 2
}
-- Maybe it exist an better way than this function.
-- Just to lazy to look atm.
function vocationIDtoName(vocID)
local vocation = Vocation(vocID)
local vocname = vocation:getName()
return vocname
end
function onUse(cid, item, fromPosition, itemEX, toPosition)
local vocID = getPlayerVocation(cid)
local vocationName = vocationIDtoName(vocID)
if vocations[vocID] then
doPlayerSendTextMessage(cid, 4, 'You have succesfully upgraded from a '..vocationName..' to a '..vocationIDtoName(vocations[vocID])..'. ')
doPlayerSetVocation(cid, vocations[vocID])
else
doPlayerSendTextMessage(cid, 4, 'You cannot upgrade vocation.')
end
return true
end