Postado Janeiro 10, 2021 4 anos .Qual servidor ou website você utiliza como base? 8.6 tfs 1.3 Qual o motivo deste tópico? erro no script Está surgindo algum erro? Se sim coloque-o aqui. Citar Pessoal estou com um problema nesse script e queria ver se alguem poderia me ajudar pois estou iniciando com scripts ainda o problema no script e que quando puxa a alavanca para ir para a sala do boss e se tiver mais de um player junto aparece dois boss , mas quando puxa a alavanca e se tive um player so funciona certinho aparece um boss so eu acredito que estou me perdendo nessa parte do codigo -- Game.getSpectators -- nao to entendendo como realmente funciona essa parte qual contagem faço para colocar o numero exato se alguem puder me auxiliar ficarei grato acredito eu que varios devem ter essa duvida com esses scripts de lever ira ajudar varios. Você tem o código disponível? Se tiver publique-o aqui: local config = { bossName = "Maxxenius", bossName2 = "Glooth-Generator", bossName3 = "Glooth-Generator", bossName4 = "Glooth-Generator", summonName = "Rift Invader", bossPos = Position{x = 31983, y = 31982, z = 15}, horror = Position{x = 31982, y = 31984, z = 15}, phobia = Position{x = 31989, y = 31984, z = 15}, fear = Position{x = 31984, y = 31987, z = 15}, centerRoom = Position{x = 31984, y = 31985, z = 15}, -- Center Room exitPosition = Position{x = 32001, y = 31984, z = 15}, -- Exit Position newPos = Position{x = 31984, y = 31990, z = 15}, -- Player Position on room playerPositions = { Position{x = 32003, y = 31980, z = 15}, Position{x = 32003, y = 31981, z = 15}, Position{x = 32003, y = 31982, z = 15}, Position{x = 32003, y = 31983, z = 15}, Position{x = 32003, y = 31984, z = 15} }, range = 30, time = 30, -- time in minutes to remove the player } local function clearFerumbrasRoom() local spectators = Game.getSpectators(config.bossPos, false, false, 10, 10, 10, 10) for i = 2, #spectators do local spectator = spectators[i] if spectator:isPlayer() then spectator:teleportTo(config.exitPosition) spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT) spectator:say('Time out! You were teleported out by strange forces.', TALKTYPE_MONSTER_SAY) elseif spectator:isMonster() then spectator:remove() end end end local ferumbrasAscendantLever = Action() function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 9825 then if player:getPosition() ~= Position{x = 32003, y = 31980, z = 15} then return true end for x = 32003, 32003 do for y = 31980, 31984 do local playerTile = Tile(Position(x, y, 15)):getTopCreature() if playerTile and playerTile:isPlayer() then if playerTile:getStorageValue(421516177) > os.time() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You or a member in your team have to wait 20 hours to face Boss again!") item:transform(9826) return true end end end end local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] if spec:isPlayer() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's someone fighting with Boss.") return true end end local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15) for i = 1, #spectators do local spectator = spectators[i] if spectator:isMonster() then spectator:remove() end end for x = 32003, 32003 do for y = 31980, 31984 do local playerTile = Tile(Position(x, y, 15)):getTopCreature() if playerTile and playerTile:isPlayer() then playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPos) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) playerTile:setStorageValue(421516177, os.time() + 20 * 60 * 60) -- 14 days player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 30 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.") addEvent(clearFerumbrasRoom, 60 * config.time * 1000, player:getId(), config.centerRoom, config.range, config.range, config.exitPosition) Game.createMonster(config.bossName, config.bossPos, true, true) Game.createMonster(config.bossName2, config.horror, true, true) Game.createMonster(config.bossName3, config.phobia, true, true) Game.createMonster(config.bossName4, config.fear, true, true) item:transform(9826) end end end elseif item.itemid == 9826 then item:transform(9825) return true end end ferumbrasAscendantLever:aid(30014) ferumbrasAscendantLever:register() Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Editado Janeiro 10, 2021 4 anos por Felippe Reine014 (veja o histórico de edições)
Postado Janeiro 10, 2021 4 anos Solução Olá meu lindo amigo tudo bem? Vamos resolver Use esse código: local config = { bossName = "Maxxenius", bossName2 = "Glooth-Generator", bossName3 = "Glooth-Generator", bossName4 = "Glooth-Generator", summonName = "Rift Invader", bossPos = Position{x = 31983, y = 31982, z = 15}, horror = Position{x = 31982, y = 31984, z = 15}, phobia = Position{x = 31989, y = 31984, z = 15}, fear = Position{x = 31984, y = 31987, z = 15}, centerRoom = Position{x = 31984, y = 31985, z = 15}, -- Center Room exitPosition = Position{x = 32001, y = 31984, z = 15}, -- Exit Position newPos = Position{x = 31984, y = 31990, z = 15}, -- Player Position on room playerPositions = { Position{x = 32003, y = 31980, z = 15}, Position{x = 32003, y = 31981, z = 15}, Position{x = 32003, y = 31982, z = 15}, Position{x = 32003, y = 31983, z = 15}, Position{x = 32003, y = 31984, z = 15} }, range = 30, time = 30, -- time in minutes to remove the player } local function clearFerumbrasRoom() local spectators = Game.getSpectators(config.bossPos, false, false, 10, 10, 10, 10) for i = 2, #spectators do local spectator = spectators[i] if spectator:isPlayer() then spectator:teleportTo(config.exitPosition) spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT) spectator:say('Time out! You were teleported out by strange forces.', TALKTYPE_MONSTER_SAY) elseif spectator:isMonster() then spectator:remove() end end end local ferumbrasAscendantLever = Action() function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 9825 then if player:getPosition() ~= Position{x = 32003, y = 31980, z = 15} then return true end for x = 32003, 32003 do for y = 31980, 31984 do local playerTile = Tile(Position(x, y, 15)):getTopCreature() if playerTile and playerTile:isPlayer() then if playerTile:getStorageValue(421516177) > os.time() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You or a member in your team have to wait 20 hours to face Boss again!") item:transform(9826) return true end end end end local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] if spec:isPlayer() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's someone fighting with Boss.") return true end end local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15) for i = 1, #spectators do local spectator = spectators[i] if spectator:isMonster() then spectator:remove() end end for x = 32003, 32003 do for y = 31980, 31984 do local playerTile = Tile(Position(x, y, 15)):getTopCreature() if playerTile and playerTile:isPlayer() then playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPos) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) playerTile:setStorageValue(421516177, os.time() + 20 * 60 * 60) -- 14 days player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 30 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.") addEvent(clearFerumbrasRoom, 60 * config.time * 1000, player:getId(), config.centerRoom, config.range, config.range, config.exitPosition) item:transform(9826) end end end Game.createMonster(config.bossName, config.bossPos, true, true) Game.createMonster(config.bossName2, config.horror, true, true) Game.createMonster(config.bossName3, config.phobia, true, true) Game.createMonster(config.bossName4, config.fear, true, true) elseif item.itemid == 9826 then item:transform(9825) return true end end ferumbrasAscendantLever:aid(30014) ferumbrasAscendantLever:register() Motivo do erro: Quando você usa um for neste caso deste script ele vai executar tudo que está dentro do for repetindo a quantidade de players, se for 1 player será 1 repetição, 2 players 2 repetições, 3 players 3 repetições e assim por diante. agora removi de dentro do for e os monstros nascerão apenas 1 de cada como está no arquivo. '' Uma ideia é apenas uma ideia, até ser desenvolvida, mastigada, retratada, analisada e por fim se tornar uma boa ideia. ''
Postado Janeiro 12, 2021 4 anos Autor Em 10/01/2021 em 23:46, Alienbear disse: Olá meu lindo amigo tudo bem? Vamos resolver Use esse código: local config = { bossName = "Maxxenius", bossName2 = "Glooth-Generator", bossName3 = "Glooth-Generator", bossName4 = "Glooth-Generator", summonName = "Rift Invader", bossPos = Position{x = 31983, y = 31982, z = 15}, horror = Position{x = 31982, y = 31984, z = 15}, phobia = Position{x = 31989, y = 31984, z = 15}, fear = Position{x = 31984, y = 31987, z = 15}, centerRoom = Position{x = 31984, y = 31985, z = 15}, -- Center Room exitPosition = Position{x = 32001, y = 31984, z = 15}, -- Exit Position newPos = Position{x = 31984, y = 31990, z = 15}, -- Player Position on room playerPositions = { Position{x = 32003, y = 31980, z = 15}, Position{x = 32003, y = 31981, z = 15}, Position{x = 32003, y = 31982, z = 15}, Position{x = 32003, y = 31983, z = 15}, Position{x = 32003, y = 31984, z = 15} }, range = 30, time = 30, -- time in minutes to remove the player } local function clearFerumbrasRoom() local spectators = Game.getSpectators(config.bossPos, false, false, 10, 10, 10, 10) for i = 2, #spectators do local spectator = spectators[i] if spectator:isPlayer() then spectator:teleportTo(config.exitPosition) spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT) spectator:say('Time out! You were teleported out by strange forces.', TALKTYPE_MONSTER_SAY) elseif spectator:isMonster() then spectator:remove() end end end local ferumbrasAscendantLever = Action() function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 9825 then if player:getPosition() ~= Position{x = 32003, y = 31980, z = 15} then return true end for x = 32003, 32003 do for y = 31980, 31984 do local playerTile = Tile(Position(x, y, 15)):getTopCreature() if playerTile and playerTile:isPlayer() then if playerTile:getStorageValue(421516177) > os.time() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You or a member in your team have to wait 20 hours to face Boss again!") item:transform(9826) return true end end end end local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] if spec:isPlayer() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's someone fighting with Boss.") return true end end local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15) for i = 1, #spectators do local spectator = spectators[i] if spectator:isMonster() then spectator:remove() end end for x = 32003, 32003 do for y = 31980, 31984 do local playerTile = Tile(Position(x, y, 15)):getTopCreature() if playerTile and playerTile:isPlayer() then playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPos) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) playerTile:setStorageValue(421516177, os.time() + 20 * 60 * 60) -- 14 days player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 30 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.") addEvent(clearFerumbrasRoom, 60 * config.time * 1000, player:getId(), config.centerRoom, config.range, config.range, config.exitPosition) item:transform(9826) end end end Game.createMonster(config.bossName, config.bossPos, true, true) Game.createMonster(config.bossName2, config.horror, true, true) Game.createMonster(config.bossName3, config.phobia, true, true) Game.createMonster(config.bossName4, config.fear, true, true) elseif item.itemid == 9826 then item:transform(9825) return true end end ferumbrasAscendantLever:aid(30014) ferumbrasAscendantLever:register() Motivo do erro: Quando você usa um for neste caso deste script ele vai executar tudo que está dentro do for repetindo a quantidade de players, se for 1 player será 1 repetição, 2 players 2 repetições, 3 players 3 repetições e assim por diante. agora removi de dentro do for e os monstros nascerão apenas 1 de cada como está no arquivo. Man obrigado de coraçao se nao sabe como isso tava me deixando louco nao tenho palavras pra agradecer vlw msm tmj rep+ pra sempre haha tmj
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.