darkmu
Well-Known Member
Can anyone tell me where is wrong in this script? Only one person who pulled the lever is left with storage and how else can he pull again, or the correct one is all the main ones for the boss who can no longer go, that is, wait or return again.
otg 1.3, version 12.40
otg 1.3, version 12.40
Lua:
local config = {
requiredLevel = 350,
daily = true,
BossPosition = Position(780, 337, 10),
Center_Room_Position = Position(789, 364, 10),
playerPositions = {
Position(778, 315, 10),
Position(779, 315, 10),
Position(780, 315, 10),
Position(781, 315, 10),
Position(782, 315, 10)
},
newPositions = {
Position(782, 344, 10),
Position(782, 344, 10),
Position(782, 344, 10),
Position(782, 344, 10),
Position(782, 344, 10)
},
}
function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
if item.itemid == 9825 then
if player:getPosition() ~= Position(778, 315, 10) then
item:transform(9826)
return true
end
local storePlayers, playerTile = {}
local exaustedSeconds = 1
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions[i]):getTopCreature()
if not (player:getStorageValue(15510) <= os.time()) then
player:say("You did this boss before 12 hours!", TALKTYPE_MONSTER_SAY)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone did this boss before 12 hours.")
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
if item.itemid == 9826 then
if player:getPosition() ~= Position(777, 315, 10) then
item:transform(9826)
player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
return true
end
end
return true
end
end
local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Sir Nictros and Sir Baeloc.")
return true
end
spec:remove()
end
local players
local monster = Game.createMonster("Sir Nictros", Position(776, 334, 10))
local monster1 = Game.createMonster("Sir Baeloc", Position(784, 334, 10))
monster1:setReward(true)
for i = 1, #storePlayers do
players = storePlayers[i]
if not (players:getStorageValue(15510) <= os.time()) then
players:sendTextMessage(TALKTYPE_MONSTER_SAY, "You did this boss before 12 hours.")
player:say("Someone already did this room before 12 hours!", TALKTYPE_MONSTER_SAY)
return
end
end
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_NORTH)
player:setStorageValue(15510, os.time()+exaustedSeconds*43200)
end
elseif item.itemid == 9825 then
if config.daily then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return true
end
end
item:transform(item.itemid == 9826 and 9825 or 9826)
return true
end