I'm discovering some errors after switching to TFS 1.5 860 and now I'm having a hard time with this script
LUA:
local config = {
requiredLevel = 100,
daily = true,
centerDemonRoomPosition = Position(33918, 31649, 8),
playerPositions = {
Position(33918, 31626, 8),
Position(33919, 31626, 8),
Position(33920, 31626, 8),
Position(33921, 31626, 8),
Position(33922, 31626, 8),
},
newPositions = {
Position(33919, 31657, 8),
},
demonPositions = {
Position(33919, 31648, 8),
},
playerFirst = {
Position(33918, 31626, 8),
}
}
function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 9825 then
local storePlayers, playerTile = {}
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerFirst[1]):getTopCreature()
if not playerTile or not playerTile:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 5 players.")
return true
end
if playerTile:getLevel() < config.requiredLevel then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 14, 14, 13, 13)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
return true
end
spec:remove()
end
for i = 1, #config.demonPositions do
Game.createMonster("Urmahlullu the Immaculate", config.demonPositions[i])
end
local players
for i = 1, #storePlayers do
players = storePlayers[i]
config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
players:teleportTo(config.newPositions[1])
config.newPositions[1]:sendMagicEffect(CONST_ME_ENERGYAREA)
players:setDirection(DIRECTION_EAST)
end
elseif item.itemid == 9826 then
if config.daily then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return true
end
end
item:transform(item.itemid == 9825 and 9826 or 9825)
return true
end
leverboss:uid(33001)
leverboss:register()