Hello good mornig for everyone!
I need help for a change vocation script. I have 1 that works well. The problem is that I want you to eliminate the item 2346 that you put once the vocation has changed.
and I also want you to help me change my vocation. I leave the skills 10 and magic lvl 10 can also help me.
and that I can also modify to my liking the gainhp and gainmana why I have it customized
Its my script
local config = {
item = {2346, y}, -- 2346 = itemid, y = itemcount needed
start = {hp = 180, mana = 20},
leaveRook = 8 -- leave the character leaves rook - needed to set correct health/mana
}
function onSay(cid, words, param)
local lvl, tovoc = getPlayerLevel(cid)
for i = 1, 4 do
if words:find(getVocationInfo(i).name:lower()) then
tovoc = getVocationInfo(i)
break
end
if i == 4 then return doPlayerSendCancel(cid, "ERROR: vocation not found") end
end
if getPlayerVocation(cid) == tovoc.id then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are already a "..tovoc.name:lower().."!")
end
if not doPlayerRemoveItem(cid, config.item[1], config.item[2]) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need "..config.item[2].."x "..getItemNameById(config.item[1]).." to change your vocation.")
end
local new = {health = (config.leaveRook >= lvl and (config.start.hp+(lvl-1)*getVocationInfo(0).healthGain) or (config.start.hp+(getVocationInfo(0).healthGain*(lvl-(lvl-config.leaveRook+1))+(lvl-config.leaveRook)*tovoc.healthGain))), mana = (config.leaveRook >= lvl and (config.start.mana+(lvl-1)*getVocationInfo(0).manaGain) or (config.start.mana+(getVocationInfo(0).manaGain*(lvl-(lvl-config.leaveRook+1))+(lvl-config.leaveRook)*tovoc.manaGain)))}
setCreatureMaxHealth(cid, new.health)
setCreatureMaxMana(cid, new.mana)
doCreatureAddHealth(cid, new.health)
doCreatureAddMana(cid, new.mana)
doPlayerSetVocation(cid, tovoc.id)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now a "..tovoc.name:lower().."!")
return true
end
I need help for a change vocation script. I have 1 that works well. The problem is that I want you to eliminate the item 2346 that you put once the vocation has changed.
and I also want you to help me change my vocation. I leave the skills 10 and magic lvl 10 can also help me.
and that I can also modify to my liking the gainhp and gainmana why I have it customized
Its my script
local config = {
item = {2346, y}, -- 2346 = itemid, y = itemcount needed
start = {hp = 180, mana = 20},
leaveRook = 8 -- leave the character leaves rook - needed to set correct health/mana
}
function onSay(cid, words, param)
local lvl, tovoc = getPlayerLevel(cid)
for i = 1, 4 do
if words:find(getVocationInfo(i).name:lower()) then
tovoc = getVocationInfo(i)
break
end
if i == 4 then return doPlayerSendCancel(cid, "ERROR: vocation not found") end
end
if getPlayerVocation(cid) == tovoc.id then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are already a "..tovoc.name:lower().."!")
end
if not doPlayerRemoveItem(cid, config.item[1], config.item[2]) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need "..config.item[2].."x "..getItemNameById(config.item[1]).." to change your vocation.")
end
local new = {health = (config.leaveRook >= lvl and (config.start.hp+(lvl-1)*getVocationInfo(0).healthGain) or (config.start.hp+(getVocationInfo(0).healthGain*(lvl-(lvl-config.leaveRook+1))+(lvl-config.leaveRook)*tovoc.healthGain))), mana = (config.leaveRook >= lvl and (config.start.mana+(lvl-1)*getVocationInfo(0).manaGain) or (config.start.mana+(getVocationInfo(0).manaGain*(lvl-(lvl-config.leaveRook+1))+(lvl-config.leaveRook)*tovoc.manaGain)))}
setCreatureMaxHealth(cid, new.health)
setCreatureMaxMana(cid, new.mana)
doCreatureAddHealth(cid, new.health)
doCreatureAddMana(cid, new.mana)
doPlayerSetVocation(cid, tovoc.id)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now a "..tovoc.name:lower().."!")
return true
end