Em area
local config = {
exhaust_storage = 5750,
exhaust_time = 30,
-- walls conf
walls_time = 10,
area_size = 3,
walls_pos = {
["vertical"] = 13051,
["horizontal"] = 13051,
["rightcorner"] = 13051,
["leftcorner"] = 13051
}
}
local function buildWalls(cid)
local cid_pos = getThingPosition(cid)
local size = config.area_size
for x = -size, size do
for y = -size, size do
if(math.abs(x) == size or math.abs(y) == size) then
local target_pos = {x = (cid_pos.x + x), y = (cid_pos.y + y), z = cid_pos.z}
if(doTileQueryAdd(cid, target_pos) == 1 and not getTileInfo(target_pos).protection) then
local create_item = nil
if(x == -size and y == -size) then
create_item = config.walls_pos["leftcorner"]
elseif(x == size and y == size) then
create_item = config.walls_pos["rightcorner"]
elseif(math.abs(x) == size and not (x == size and y == -size)) then
create_item = config.walls_pos["vertical"]
else
create_item = config.walls_pos["horizontal"]
end
doCreateItem(create_item, 1, target_pos)
local _time = config.walls_time
for i = 0, _time do
addEvent(function()
local uid = getTileItemById(target_pos, create_item).uid
if(uid ~= 0) then
if(i < _time) then
doSendAnimatedText(target_pos, (_time - i), 180)
else
doRemoveItem(uid)
end
end
end, 1000 * i)
end
end
end
end
end
end
function onCastSpell(cid, var)
if(isPlayer(cid) and exhaustion.check(cid, config.exhaust_storage)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, config.exhaust_storage) .. " segundos para usar novamente.")
return false
end
exhaustion.set(cid, config.exhaust_storage, config.exhaust_time)
buildWalls(cid)
return true
end
<instant name="Nome da magia" words="Nome da magia" lvl="325" mana="10" aggressive="1" range="5" blockwalls="1" selftarget="1" exhaustion="1900" needlearn="0" event="script" value="EX:Hashirama/Nome da magia.lua">
Em Target
local t = {
remove_time = 5, -- tempo em segundos para remover as magic wall
item_id = 13057, -- id da lavar que vai ficar ao redor
effe = 480 -- efeito da lava(fogo- sla)
}
function isWalkable(pos, creature, pz, proj)
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
function removeItem(posAll)
for i=1, #posAll do
for j=0, 255 do
pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j}
removeTile = getThingfromPos(pos_stack)
if removeTile.itemid == t.item_id then
doRemoveItem(removeTile.uid)
end
end
end
end
function onCastSpell(cid, var)
local waittime = 3 -- Tempo de exhaustion em segundos
local storage = 5853 -- Storage de Spell, nunca usar a mesma em outra spell, a menos que não queira usar duas spell juntas!
if exhaustion.check(cid, storage) then
doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end
local pos = getPlayerPosition(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}
---- aqui \/ você configura de acordo com a posição do seu efeito, para centralizar ele
local pose = getPlayerPosition(getCreatureTarget(cid))
posTe1 = {x=pose.x+1,y=pose.y+1,z=pose.z}
posTe2 = {x=pose.x+1,y=pose.y,z=pose.z}
posTe3 = {x=pose.x+1,y=pose.y-1,z=pose.z}
posTe4 = {x=pose.x,y=pose.y-1,z=pose.z}
posTe5 = {x=pose.x-0,y=pose.y-1,z=pose.z}
posTe6 = {x=pose.x-0,y=pose.y,z=pose.z}
posTe7 = {x=pose.x-0,y=pose.y+1,z=pose.z}
posTe8 = {x=pose.x,y=pose.y+1,z=pose.z}
posTall = {posTe1,posTe2,posTe3,posTe4,posTe5,posTe6,posTe7,posTe8}
--- fim /\ da configuração
for a= 1, #posTall do
doSendMagicEffect(posTall[a], t.effe)
end
addEvent(function()
for i=1, #posAll do
if isWalkable(posAll[i]) then
doCreateItem(t.item_id, 1, posAll[i])
end
end
end, 500)
addEvent(removeItem, t.remove_time*1000, posAll)
exhaustion.set(cid, storage, waittime)
return true
end
<instant name="Nome da magia" words="Nome da magia" lvl="180" mana="10" aggressive="1" range="5" blockwalls="1" needtarget="1" exhaustion="1900" needlearn="0" event="script" value="EX:Hashirama/Nome da magia.lua">
Se ajudei deixe o like e rep se possivel