local config = {
requiredLevel = 8,
daily = false,
centerDemonRoomPosition = Position(33221, 31659, 13),
playerPositions = {
Position(333, 1712, 9)
Position(333, 1712, 9)
Position(333, 1712, 9)
},
newPositions = {
Position(336, 1712, 9),
Position(336, 1713, 9),
Position(336, 1714, 9),
Position(336, 1715, 9)
},
RotwormPositions = {
Position(329, 1712, 9),
Position(329, 1714, 9),
Position(332, 1714, 9),
Position(333, 1714, 9),
Position(33220, 31661, 13),
Position(33222, 31661, 13)
}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1946 then
local storePlayers, playerTile = {}
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions[i]):getTopCreature()
if not playerTile or not playerTile:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 4 players.")
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
for i = 1, #config.RotwormPositions do
Game.createMonster("Rotworm", config.RotwormPositions[i])
end
local players
for i = 1, #storePlayers do
players = storePlayers[i]
config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
players:teleportTo(config.newPositions[i])
config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
players:setDirection(DIRECTION_EAST)
end
elseif item.itemid == 1945 then
if config.daily then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return true
end
end
item:transform(item.itemid == 1946 and 1945 or 1946)
return true
end