I have this script which use an item to another and according to the vocation comes configured id. but is giving the following error.
[Warning - Event::checkScript] Can not load script: scripts/wolfamulet.lua
data/actions/scripts/wolfamulet.lua:7: '}' expected (to close '{' at line 2) near '['
[Warning - Event::checkScript] Can not load script: scripts/wolfamulet.lua
data/actions/scripts/wolfamulet.lua:7: '}' expected (to close '{' at line 2) near '['
PHP:
local moonlightcrystals = {24739}
local items = { -- 1 and 2 is mage, 3 is paladin, 4 is knight, change if wrong
[1] = {
[24716] = {24717},
[24718] = {24771}
}
[3] = {
[24716] = {24717},
[24718] = {24783}
}
[4] = {
[24716] = {24717},
[24718] = {24769}
}
}
items[2] = items[1]
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local voc = player:getVocation():getId()%4
voc = (voc > 0 and voc) or 4
if isInArray(moonlightcrystals, item:getId()) then
local toId = items[voc][target.itemid]
if toId then
target:transform(toId)
item:remove(1)
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
else
fromPosition:sendMagicEffect(CONST_ME_POFF)
end
end
return true
end