Postado Setembro 10, 2023 1 ano Pessoal, utilizo TFS 0.4 e gostaria de saber se é possivel fazer com que o boss do final de uma quest seja impossivel de trapar, como por exemplo ele cortar graves ou se teleportar pra outro target na sala do boss, evitando que fique preso em um unico lugar
Postado Setembro 10, 2023 1 ano Autor Entao pessoal, encontrei um pra TFS 1x Spoiler local playerPositions = {} function onCastSpell(cid, variant) local monster = Creature(cid) local closeSpec = Game.getSpectators(monster:getPosition(), false, true, 2, 2, 2, 2) for i = 1, #closeSpec do if closeSpec[i] ~= nil then return false end end local specs = Game.getSpectators(Position(monster:getPosition()), false, true, 20, 20, 20, 20) for i = 1, #specs do local spectator = specs[i] playerPositions[#playerPositions + 1] = spectator:getPosition() end local randomPos = playerPositions[math.random(#playerPositions)] local freePos = getFreeTile(randomPos) if freePos then monster:getPosition():sendMagicEffect(CONST_ME_POFF) monster:teleportTo(freePos) monster:getPosition():sendMagicEffect(CONST_ME_TELEPORT) monster:say('BUU!!', TALKTYPE_MONSTER_SAY) end return false end function getFreeTile(positions) local checkTiles = { -- 1, 2, 3 -- 4, 0, 5 -- 0 is player -- 6, 7, 8 Position(positions.x + 1, positions.y, positions.z), -- 5 Position(positions.x - 1, positions.y, positions.z), -- 4 Position(positions.x, positions.y + 1, positions.z), -- 7 Position(positions.x, positions.y - 1, positions.z), -- 2 Position(positions.x + 1, positions.y - 1, positions.z), -- 3 Position(positions.x + 1, positions.y + 1, positions.z), -- 8 Position(positions.x - 1, positions.y - 1, positions.z), -- 1 Position(positions.x - 1, positions.y + 1, positions.z) -- 6 } local freePosition for i = 1, #checkTiles do if Tile(checkTiles[i]):getGround() and not Tile(checkTiles[i]):getItemById(1387) and not Tile(checkTiles[i]):getItemById(5070) then freePosition = checkTiles[i] return freePosition else return false end end end É preciso registrar em spells.xml e colocar a nova spells no mosntro desejado! Script disponibilizado pelo Nekiro! Alguém conseguiria adaptar para TFS 0.4? Editado Setembro 10, 2023 1 ano por A.Mokk (veja o histórico de edições)
Postado Setembro 10, 2023 1 ano Diretor Solução function onCastSpell(cid, var) local target = getCreatureTarget(cid) if isCreature(target) and isPlayer(target) then local targetPos = getCreaturePosition(target) local creaturePos = getCreaturePosition(cid) local distance = math.max(math.abs(targetPos.x - creaturePos.x), math.abs(targetPos.y - creaturePos.y)) if distance > 1 then -- Defina a distância mínima para teleportar conforme sua preferência doTeleportThing(cid, targetPos, true) end end return true end @A.Mokk
Postado Setembro 10, 2023 1 ano Diretor 19 minutos atrás, A.Mokk disse: Muito obrigado, funcional em TFS 0.4 ! se puder clique em reputação, ali nas reações
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.