Postado Setembro 20, 2022 2 anos Solução Em 14/09/2022 em 22:59, Dono do WNA disse: Andei procurando aqui pelo TK inteiro e não acho um script funcional para um boss room onde o player clica com direito num altar (parecido com uma alavanca) podendo ir sozinho ou com até 10 jogadores ele é teleportado para uma sala com o boss, podendo desafiar ele a cada 20 horas, toda vez que um jogador puxa a alavanca ele checa se tem player na sala e caso tenha, precisa esperar todos os jogadores sairem. Caso o boss esteja vivo sem players dentro da sala ele remove e adiciona um novo assim que puxam a alavanca. Achei scripts parecidos no forum porém são todos para TFS 1.x+ e eu uso o 0.4 e nenhum compatível que achei esta funcionando TFS 0.4 REV 3996 -- Diiego Liima local posInicio = {x = 5057, y = 3539, z = 7} --pos inicio da sala local posFim = {x = 5078, y = 3562, z = 7}--pos final inicio da sala local posExitTime = {x = 5064, y = 3519, z = 7}-- pos para onde o player vai sair local function verificaPlayers() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then return 1 end end end end local function verificaBoss() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) end end end end local function removePlayersTime() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do local remove, clean = true, true local pos = {x = x, y = y, z = posInicio.z} local m = getTopCreature(pos).uid if m ~= 0 and isPlayer(m) then doTeleportThing(m, posExitTime) end end end doSendMagicEffect(posExitTime, 10) return true end function onUse(cid, item, frompos, item2, topos) -- Lever Boss if item.aid == 5130 then -- action id da alavanca local playerChecked = false local teleportToRoom = false local stoExhaust = 5534241 -- staorage de segurança para exhaust local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust) if stoExhaustPlayer > os.time() then doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.") return true end if verificaPlayers() then doPlayerSendCancel(cid, "There are other players inside the room at the moment.") doSendMagicEffect(topos,2) setPlayerStorageValue(cid, stoExhaust, os.time()+5) return true end local config = { [1] = {pos = {x = 5066, y = 3525, z = 7}}, --posições dos pisos [2] = {pos = {x = 5067, y = 3525, z = 7}}, [3] = {pos = {x = 5068, y = 3525, z = 7}}, [4] = {pos = {x = 5069, y = 3525, z = 7}}, [5] = {pos = {x = 5070, y = 3525, z = 7}}, } local storageTime = 5534240 -- storage de tempo for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid if getPlayerStorageValue(player, storageTime) > os.time() then time = (getPlayerStorageValue(player, storageTime)-os.time())/60 str = "minutes" if time > 60 then time = time/60 str = "hours" end if player == cid then name = "You" else name = getCreatureName(player) end doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.") doSendMagicEffect(topos,2) return true end if player == cid then playerChecked = true end end end if playerChecked then for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid doSendMagicEffect(getCreaturePosition(player), 2) doTeleportThing(player, {x = 5067, y = 3546, z = 7}) -- posiçao que player vai cair dentro da sala setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas teleportToRoom = true end end if teleportToRoom then stopEvent(ResetArea) verificaBoss() doSendMagicEffect({x = 5067, y = 3549, z = 7}, 10) -- efeito aonde o boss nasce doCreateMonster("Boss", {x = 5067, y = 3549, z = 7}) -- onde o boss nasce ResetArea = addEvent(function() removePlayersTime() end, 20 * 60 * 1000) -- tempo dentro da sala return false end else doPlayerSendCancel(cid, "Wouldn't you like to go too?") doSendMagicEffect(topos,2) end return true end end
Postado Setembro 21, 2022 2 anos Autor 21 horas atrás, Diiego Liima disse: -- Diiego Liima local posInicio = {x = 5057, y = 3539, z = 7} --pos inicio da sala local posFim = {x = 5078, y = 3562, z = 7}--pos final inicio da sala local posExitTime = {x = 5064, y = 3519, z = 7}-- pos para onde o player vai sair local function verificaPlayers() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then return 1 end end end end local function verificaBoss() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) end end end end local function removePlayersTime() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do local remove, clean = true, true local pos = {x = x, y = y, z = posInicio.z} local m = getTopCreature(pos).uid if m ~= 0 and isPlayer(m) then doTeleportThing(m, posExitTime) end end end doSendMagicEffect(posExitTime, 10) return true end function onUse(cid, item, frompos, item2, topos) -- Lever Boss if item.aid == 5130 then -- action id da alavanca local playerChecked = false local teleportToRoom = false local stoExhaust = 5534241 -- staorage de segurança para exhaust local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust) if stoExhaustPlayer > os.time() then doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.") return true end if verificaPlayers() then doPlayerSendCancel(cid, "There are other players inside the room at the moment.") doSendMagicEffect(topos,2) setPlayerStorageValue(cid, stoExhaust, os.time()+5) return true end local config = { [1] = {pos = {x = 5066, y = 3525, z = 7}}, --posições dos pisos [2] = {pos = {x = 5067, y = 3525, z = 7}}, [3] = {pos = {x = 5068, y = 3525, z = 7}}, [4] = {pos = {x = 5069, y = 3525, z = 7}}, [5] = {pos = {x = 5070, y = 3525, z = 7}}, } local storageTime = 5534240 -- storage de tempo for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid if getPlayerStorageValue(player, storageTime) > os.time() then time = (getPlayerStorageValue(player, storageTime)-os.time())/60 str = "minutes" if time > 60 then time = time/60 str = "hours" end if player == cid then name = "You" else name = getCreatureName(player) end doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.") doSendMagicEffect(topos,2) return true end if player == cid then playerChecked = true end end end if playerChecked then for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid doSendMagicEffect(getCreaturePosition(player), 2) doTeleportThing(player, {x = 5067, y = 3546, z = 7}) -- posiçao que player vai cair dentro da sala setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas teleportToRoom = true end end if teleportToRoom then stopEvent(ResetArea) verificaBoss() doSendMagicEffect({x = 5067, y = 3549, z = 7}, 10) -- efeito aonde o boss nasce doCreateMonster("Boss", {x = 5067, y = 3549, z = 7}) -- onde o boss nasce ResetArea = addEvent(function() removePlayersTime() end, 20 * 60 * 1000) -- tempo dentro da sala return false end else doPlayerSendCancel(cid, "Wouldn't you like to go too?") doSendMagicEffect(topos,2) end return true end end Adicionei aqui e não da erro algum mano, mas também não funciona, não da mensagem alguma.. é como se o script nem estivesse no servidor Adaptei pras posições do meus servidor e acabou assim: Spoiler <action actionid="5130" event="script" value="Bossroom.lua"/> Spoiler -- Diiego Liima local posInicio = {x = 1421, y = 1936, z = 8} --pos inicio da sala local posFim = {x = 1434, y = 1951, z = 8} --pos final inicio da sala local posExitTime = {x = 1028, y = 915, z = 6} -- pos para onde o player vai sair local function verificaPlayers() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then return 1 end end end end local function verificaBoss() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) end end end end local function removePlayersTime() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do local remove, clean = true, true local pos = {x = x, y = y, z = posInicio.z} local m = getTopCreature(pos).uid if m ~= 0 and isPlayer(m) then doTeleportThing(m, posExitTime) end end end doSendMagicEffect(posExitTime, 10) return true end function onUse(cid, item, frompos, item2, topos) -- Lever Boss if item.aid == 5130 then -- action id da alavanca local playerChecked = false local teleportToRoom = false local stoExhaust = 5534241 -- staorage de segurança para exhaust local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust) if stoExhaustPlayer > os.time() then doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.") return true end if verificaPlayers() then doPlayerSendCancel(cid, "There are other players inside the room at the moment.") doSendMagicEffect(topos,2) setPlayerStorageValue(cid, stoExhaust, os.time()+5) return true end local config = { [1] = {pos = {x = 1460, y = 1978, z = 8}}, --posições dos pisos [2] = {pos = {x = 1461, y = 1977, z = 8}}, [3] = {pos = {x = 1461, y = 1978, z = 8}}, [4] = {pos = {x = 1461, y = 1979, z = 8}}, [5] = {pos = {x = 1462, y = 1977, z = 8}}, } local storageTime = 5534240 -- storage de tempo for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid if getPlayerStorageValue(player, storageTime) > os.time() then time = (getPlayerStorageValue(player, storageTime)-os.time())/60 str = "minutes" if time > 60 then time = time/60 str = "hours" end if player == cid then name = "You" else name = getCreatureName(player) end doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.") doSendMagicEffect(topos,2) return true end if player == cid then playerChecked = true end end end if playerChecked then for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid doSendMagicEffect(getCreaturePosition(player), 2) doTeleportThing(player, {x = 1428, y = 1947, z = 8}) -- posiçao que player vai cair dentro da sala setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas teleportToRoom = true end end if teleportToRoom then stopEvent(ResetArea) verificaBoss() doSendMagicEffect({x = 1428, y = 1939, z = 8}, 10) -- efeito aonde o boss nasce doCreateMonster("Sakura Samurai", {x = 1428, y = 1939, z = 8}) -- onde o boss nasce ResetArea = addEvent(function() removePlayersTime() end, 20 * 60 * 1000) -- tempo dentro da sala return false end else doPlayerSendCancel(cid, "Wouldn't you like to go too?") doSendMagicEffect(topos,2) end return true end end Editado Setembro 21, 2022 2 anos por Dono do WNA (veja o histórico de edições)
Postado Setembro 24, 2022 2 anos Autor Em 20/09/2022 em 05:13, Diiego Liima disse: -- Diiego Liima local posInicio = {x = 5057, y = 3539, z = 7} --pos inicio da sala local posFim = {x = 5078, y = 3562, z = 7}--pos final inicio da sala local posExitTime = {x = 5064, y = 3519, z = 7}-- pos para onde o player vai sair local function verificaPlayers() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then return 1 end end end end local function verificaBoss() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) end end end end local function removePlayersTime() for x = posInicio.x, posFim.x do for y = posInicio.y, posFim.y do local remove, clean = true, true local pos = {x = x, y = y, z = posInicio.z} local m = getTopCreature(pos).uid if m ~= 0 and isPlayer(m) then doTeleportThing(m, posExitTime) end end end doSendMagicEffect(posExitTime, 10) return true end function onUse(cid, item, frompos, item2, topos) -- Lever Boss if item.aid == 5130 then -- action id da alavanca local playerChecked = false local teleportToRoom = false local stoExhaust = 5534241 -- staorage de segurança para exhaust local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust) if stoExhaustPlayer > os.time() then doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.") return true end if verificaPlayers() then doPlayerSendCancel(cid, "There are other players inside the room at the moment.") doSendMagicEffect(topos,2) setPlayerStorageValue(cid, stoExhaust, os.time()+5) return true end local config = { [1] = {pos = {x = 5066, y = 3525, z = 7}}, --posições dos pisos [2] = {pos = {x = 5067, y = 3525, z = 7}}, [3] = {pos = {x = 5068, y = 3525, z = 7}}, [4] = {pos = {x = 5069, y = 3525, z = 7}}, [5] = {pos = {x = 5070, y = 3525, z = 7}}, } local storageTime = 5534240 -- storage de tempo for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid if getPlayerStorageValue(player, storageTime) > os.time() then time = (getPlayerStorageValue(player, storageTime)-os.time())/60 str = "minutes" if time > 60 then time = time/60 str = "hours" end if player == cid then name = "You" else name = getCreatureName(player) end doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.") doSendMagicEffect(topos,2) return true end if player == cid then playerChecked = true end end end if playerChecked then for i, v in pairs(config) do if isPlayer(getTopCreature(config[i].pos).uid) then player = getTopCreature(config[i].pos).uid doSendMagicEffect(getCreaturePosition(player), 2) doTeleportThing(player, {x = 5067, y = 3546, z = 7}) -- posiçao que player vai cair dentro da sala setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas teleportToRoom = true end end if teleportToRoom then stopEvent(ResetArea) verificaBoss() doSendMagicEffect({x = 5067, y = 3549, z = 7}, 10) -- efeito aonde o boss nasce doCreateMonster("Boss", {x = 5067, y = 3549, z = 7}) -- onde o boss nasce ResetArea = addEvent(function() removePlayersTime() end, 20 * 60 * 1000) -- tempo dentro da sala return false end else doPlayerSendCancel(cid, "Wouldn't you like to go too?") doSendMagicEffect(topos,2) end return true end end Troquei de TFS para uma OTX e o script funcionou, obrigado!
Postado Setembro 25, 2022 2 anos 13 horas atrás, Dono do WNA disse: Troquei de TFS para uma OTX e o script funcionou, obrigado! Boaa !
Postado Novembro 1, 2022 2 anos Em 24/09/2022 em 16:48, Dono do WNA disse: Troquei de TFS para uma OTX e o script funcionou, obrigado! posta aqui a mudança que voce fez para otx
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.