T
Tibia Demon
Guest
i am trying to check if 1 of the 4 player made boss then it stop team from going inside but it tp 1 player inside [the one with no storage] so i have something wrong. can someone help with this and help to add a check if players inside the room then no other teams can enter.
and kick players inside room after 15 minutes. i think this need 1 more script check?
Lua:
local config = {
playerPositions = {
Position(989, 1011, 7),
Position(987, 1011, 7),
Position(989, 1016, 7),
Position(987, 1016, 7),
},
newPositions = {
Position(988, 1020, 7),
Position(987, 1020, 7),
Position(988, 1021, 7),
Position(987, 1021, 7),
},
items = {
{position = Position(989, 1010, 7), itemid = 1950},
{position = Position(987, 1010, 7), itemid = 1950},
{position = Position(989, 1017, 7), itemid = 1950},
{position = Position(987, 1017, 7), itemid = 1950},
},
}
local BossLever = Action()
function BossLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player or player:isInGhostMode() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end
local storePlayers, playerTile = {}
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions[i]):getTopCreature()
if not playerTile or not playerTile:isPlayer() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
local requiredItems, foundItem = {}
for _, requiredItem in ipairs(config.items) do
foundItem = Tile(requiredItem.position):getItemById(requiredItem.itemid)
if foundItem == nil then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end
requiredItems[#requiredItems + 1] = foundItem
end
local players
for i = 1, #storePlayers do
players = storePlayers[i]
if players and players:getStorageValue(PlayerStorageKeys.bossfourplayers) == 1 then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end
for _, itemToRemove in ipairs(requiredItems) do
itemToRemove:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
itemToRemove:remove(1)
end
players:teleportTo(config.newPositions[i])
players:setDirection(DIRECTION_EAST)
players:setStorageValue(PlayerStorageKeys.bossfourplayers, 1)
end
item:transform(item.itemid == 1946 and 1945 or 1946)
return true
end
BossLever:aid(5892)
BossLever:register()
Last edited by a moderator: