local targetaid = 999 -- edit for ground action id
local monster = "Demon" --edit for monster you want summoned
local coalitem = 6500 --Enter item for coal basins
local teleport = {x=920, y=1187, z=10} -- edit for teleport location
local teleportto = {x=950, y=1181, z=7} -- edit for teleport destination
local chest = {x=908, y=1190, z=10} -- edit for chest location
local stor = 8746 -- edit for storage you want set
local chestt = 1749 -- edit for the chest itemid
local ca = 8746 -- edit for chest action id
local stone, stonee = {x=894, y=1186, z=10}, {x=894, y=1187, z=10} -- edit for stone positions
local stoneid = 1355 -- edit for item id of stone
--Edit below for monster spawns
local t = {
{x=899, y=1185, z=10},
{x=901, y=1183, z=10},
{x=903, y=1181, z=10},
{x=905, y=1179, z=10},
{x=908, y=1181, z=10},
{x=911, y=1179, z=10},
{x=913, y=1181, z=10},
{x=915, y=1183, z=10},
{x=917, y=1185, z=10},
{x=917, y=1189, z=10},
{x=915, y=1191, z=10},
{x=913, y=1193, z=10},
{x=911, y=1195, z=10},
{x=908, y=1192, z=10},
{x=905, y=1195, z=10},
{x=903, y=1193, z=10},
{x=901, y=1191, z=10},
{x=899, y=1189, z=10},
{x=905, y=1190, z=10},
{x=903, y=1187, z=10},
{x=903, y=1186, z=10},
{x=905, y=1183, z=10},
{x=908, y=1181, z=10},
{x=911, y=1183, z=10},
{x=913, y=1186, z=10},
{x=913, y=1187, z=10},
{x=911, y=1190, z=10},
{x=907, y=1187, z=10}
}
--edit below for item creation positions
local b = {
{x=897, y=1185, z=10},
{x=899, y=1183, z=10},
{x=901, y=1181, z=10},
{x=903, y=1179, z=10},
{x=905, y=1177, z=10},
{x=908, y=1179, z=10},
{x=911, y=1177, z=10},
{x=913, y=1179, z=10},
{x=915, y=1181, z=10},
{x=917, y=1183, z=10},
{x=919, y=1185, z=10},
{x=919, y=1188, z=10},
{x=917, y=1190, z=10},
{x=915, y=1192, z=10},
{x=913, y=1194, z=10},
{x=911, y=1196, z=10},
{x=908, y=1194, z=10},
{x=905, y=1196, z=10},
{x=903, y=1194, z=10},
{x=901, y=1192, z=10},
{x=899, y=1190, z=10},
{x=897, y=1188, z=10}
}
-- EDIT THIS CODE OF YOUR ROOM WITH DEMONS SET X Y Z OF YOUR RIGHT CORNER AND X Y Z LEFT CORNER
local time = 60000 -- after how many miliseconds room with demons will get clean? 60000 = 60 seconds so 1000 = 1 second
local room = { -- room with demons
fromX = 1291,
fromY = 838,
fromZ = 7,
toX = 1294,
toY = 840,
toZ = 7
}
-- EDIT THIS CODE OF YOUR ROOM WITH DEMONS SET X Y Z OF YOUR RIGHT CORNER AND X Y Z LEFT CORNER
local function valiklis()
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
doRemoveCreature(thing.uid)
end
end
end
end
end
local function deleteStone()
local getgate = getThingfromPos({x=894, y=1186, z=10, stackpos=1})
local getgate2 = getThingfromPos({x=894, y=1187, z=10, stackpos=1})
doRemoveItem(getgate.uid)
doRemoveItem(getgate2.uid)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.actionid == targetaid then
setPlayerStorageValue(cid,stor,1)
for _, v in pairs(t) do
doCreateMonster(monster, v)
end
for z, c in pairs(b) do
doCreateItem(coalitem,1,c)
end
local pumpuras = doCreateItem(chestt, 1, chest)
doItemSetAttribute(pumpuras,"aid",ca)
doCreateTeleport(1387, teleportto, teleport)
doCreateItem(stoneid, 1, stone)
doCreateItem(stoneid, 1, stonee)
addEvent(valiklis, time)
addEvent(deleteStone, time)
end
return true
end