Fiz o seguinte script: Item que concede promotion ao player e se o player não tiver vocação é atribuída uma vocação randômica ao mesmo.
Fiz este script:
local config = {
{voc = 1},
{voc = 2},
{voc = 3},
{voc = 4}
}
local vocation = {
[1] = {1, 5},
[2] = {2, 6},
[3] = {3, 7},
[4] = {4, 8}
}
function onUse(cid, item, frompos, item2, topos)
for v = 0, #config do
for w = 0, #vocation do
if getPlayerVocation(cid) == 0 then
if math.random(1,4) == config[v].voc then
doPlayerSetVocation(cid, config[v].voc)
if getPlayerVocation(cid) == vocation[w][1] then
doPlayerSetVocation(cid, vocation[w][2])
return doRemoveItem(item.uid, 1) and doSendMagicEffect(frompos, 30)
end
end
return doRemoveItem(item.uid, 1) and doSendMagicEffect(frompos, 30)
end
end
end
end
No Debugger LUA ele passa, mas in-game não funfa, será que errei algo no script ou minha distro ta bugada?? Minha distro é TFS 0.3.6 PL1 e a versão do Tibia é 8.54. Analisei meu script linha por linha e não achei nenhum erro!! Quando do use no item apareceo seguinte erro no console: linha 20: atemp to index field '?' (a nil value) fala q o erro ta na linha 20, ajudem!