E
Evil Puncker
Guest
hi everyone, I'm trying to make the machete script more user friendly but I miss the knowledge to do so:
what i'm missing right now is to make the first if works, it should check if target ID is the first value of the jungleGrass table, and then transform it to the second value
Lua:
local wildGrowth = { 1499, 11099 }
local jungleGrass = {
[2782] = 2781,
[3985] = 3984,
[19433] = 19431
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local targetId = target.itemid
if table.contains(jungleGrass, targetId) then
target:transform(jungleGrass[target:getId()])
target:decay()
return true
end
if table.contains(wildGrowth, targetId) then
toPosition:sendMagicEffect(CONST_ME_POFF)
target:remove()
return true
end
return destroyItem(player, target, toPosition)
end
what i'm missing right now is to make the first if works, it should check if target ID is the first value of the jungleGrass table, and then transform it to the second value