poopsiedoodle
Gibe moni plos
how do I make a script that changes your vocation to a knight/pally/sorc/druid if you have no vocation by using this?
(ID: 9767)
Last edited:
<action uniqueid="5588" script="vocation_stone_sorcerer.lua" />
function onUse(cid, item, frompos, item2, topos)
if (getPlayerVocation(cid) == 0) then
doPlayerSetVocation(cid, 1)
else
doPlayerSendTextMessage(cid,22,"You already have a vocation.")
end
end
local config = {
-- [actionid] = vocation
[1234] = 1,
[2345] = 2,
[3456] = 3,
[4567] = 4
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for actionid, vocation in pairs(config) do
if item.actionid == actionid and getPlayerVocation(cid) == 0 then
doPlayerSetVocation(cid, vocation)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, now you are ".. getPlayerVocationName(cid))
end
end
return true
end
<action actionid="1234;2345;3456;4567" script="NAME.OF.THE.LUA.FILE.lua" />
local config = {
-- [actionid] = vocation
[1234] = 1,
[2345] = 2,
[3456] = 3,
[4567] = 4
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for actionid, vocation in pairs(config) do
if item.actionid == actionid and getPlayerVocation(cid) == 0 then
doPlayerSetVocation(cid, vocation)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, now you are ".. getPlayerVocationName(cid)..".")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not pick a vocation.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
end
return true
end
<action actionid="1234;2345;3456;4567" event="script" value="vocation.lua" />