This is an simples function
UPDATED
Add it on 050-function.lua and enjoy!
Example:
OR with updated funcion
Enjoy
--------
UPDATED
Lua:
function doSendMagicEffectInArea(pos,effect,area,cid) -- Function by mock
local centro = {}
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
if area[y][x] > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
if type(effect) == 'table' then
doSendMagicEffect({x=pos.x+x-centro.x,y=pos.y+y-centro.y,z= pos.z},(effect[area[y][x]] or 0),cid)
else
doSendMagicEffect({x=pos.x+x-centro.x,y=pos.y+y-centro.y,z= pos.z},effect or 0,cid)
end
end
end
end
return true
end
Example:
Lua:
local area = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}
function onUse(cid, item, frompos, item2, topos)
doSendMagicEffectInArea(topos,36,area)
return true
end
OR with updated funcion
Lua:
local area = {
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 3, 3, 3, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 0},
{0, 2, 1, 3, 1, 1, 1, 1, 1, 4, 0},
{2, 2, 1, 1, 1, 4, 4, 1, 1, 4, 4},
{0, 2, 1, 6, 1, 4, 4, 1, 1, 4, 0},
{0, 1, 1, 6, 1, 5, 5, 1, 1, 1, 0},
{0, 0, 1, 6, 1, 5, 5, 1, 1, 0, 0},
{0, 0, 0, 1, 5, 5, 5, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
doSendMagicEffectInArea(toPosition,{36,5,10,15,20,50},area)
return true
end
Enjoy
--------
Last edited: