dfs1
Member
- Joined
- Aug 27, 2011
- Messages
- 75
- Solutions
- 1
- Reaction score
- 5
good day community , Could you help me, with the following script, that each player teleports to a different place, this script teleport all players to a single place.
I would be very grateful, if they could help me.
I would be very grateful, if they could help me.
Lua:
local config = {
leverUniqueID = 1255,
requiredLevel = 150,
daily = true,
bossName = "Absum, Lacunean Wanderer",
storage = 1255,
roomCenterPosition = Position(784, 431, 10),
playerPositions = {
Position(785, 437, 9),
Position(784, 439, 9),
Position(786, 439, 9)
},
teleportPosition = Position(785, 434, 10),
bossPosition = Position(781, 432, 10),
kickMinutes = 10, -- minutes
kickPosition = Position(785, 444, 9)
}
local absum = Action()
function absum.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item:getId() == 8047 then
if player:getPosition() ~= Position (785, 437, 9) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Stand in front of the book..")
return true
end
local participants = {}
for _, playerPos in pairs(config.playerPositions) do
local tile = Tile(playerPos)
if tile then
local participant = tile:getTopCreature()
if participant and participant:isPlayer() then
if participant:getLevel() < config.requiredLevel then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("All the players need to be level %d or higher.", config.requiredLevel))
return true
end
if config.daily and participant:getStorageValue(config.storage) > os.time() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "One or more players are not ready to fight again.")
participant:sendCancelMessage("you need to wait "..player:getStorageValue(config.storage) - os.time().." seconds to boss fight.")
return true
end
participants[#participants +1] = participant
end
end
local clearOberonRoom = Game.getSpectators(Position(config.roomCenterPosition), false, false, 7, 7, 7, 7)
for index, spectatorcheckface in ipairs(clearOberonRoom) do
if spectatorcheckface:isPlayer() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting against the boss! You need wait awhile.")
return false
end
end
for index, removeOberon in ipairs(clearOberonRoom) do
if (removeOberon:isMonster()) then
removeOberon:remove()
end
end
end
local boss = Game.createMonster(config.bossName, config.bossPosition)
if boss then boss:registerEvent("CancelKickEvent") end
for _, participant in pairs(participants) do
participant:getPosition():sendMagicEffect(CONST_ME_POFF)
participant:teleportTo(config.teleportPosition)
participant:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have 10 minute(s) to defeat the boss.')
participant:setStorageValue(config.storage, os.time() + 0*60*60)
end
config.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
config.kickEventId = addEvent(function ()
for _, spectator in pairs(Game.getSpectators(config.roomCenterPosition, false, false, 7, 7, 7, 7)) do
if spectator:isPlayer() then
spectator:teleportTo(config.kickPosition, false)
spectator:sendTextMessage(MESSAGE_EVENT_ADVANCE,"Time is out!")
else
spectator:remove()
end
end
config.kickPosition:sendMagicEffect(CONST_ME_TELEPORT)
end, config.kickMinutes * 1000 * 60)
end
item:transform(8047)
return true
end
absum:uid(config.leverUniqueID)
absum:register()