Ir para conteúdo

Featured Replies

Postado

boa noite galera.

alguem poderia me ajudar com esse script PF

ja procurei e testei dezenas de script, mas em nenhum obtive êxito ja estou quase desistindo

queria um sistema de boss room igual do global: uma alavanca que pode levar de 1 a 5 player para o local x,

o jogador tem y minutos para terminar e se caso nao termine a tempo será teleportado para fora.

tenho esse script funciona tudo normal, mas ele nao remove a criatura da sala quando o jogador puxa a alavanca.

tenho esse aqui mas esta com o bug que citei à cima

Spoiler


local config = {
	from = {x = 22987, y = 19805, z = 7}, -- coordenada do canto superior esquerdo da área.
	to = {x = 23024, y = 19992, z = 7}, -- coordenada do canto inferior direito da área.
	}

local t = {
	lvl = 100,
	Time = 2, -- em minutos
	entrada =
	{
		{x = 23052, y = 19991, z = 7}, -- pos players
		{x = 23051, y = 19991, z = 7},
		{x = 23050, y = 19991, z = 7},
		{x = 23049, y = 19991, z = 7}
	},
	saida =
	{
		{x = 23017, y = 19985, z = 7}, -- pos para onde eles irão
		{x = 23019, y = 19985, z = 7},
		{x = 23017, y = 19987, z = 7},
		{x = 23019, y = 19987, z = 7}
	},
	monstros =
	{
		{{x = 23004, y = 19832, z = 7}, "Juggernaut"}, -- defina pos dos montros e nomes
		{{x = 23004, y = 19834, z = 7}, "Ghazbaran"}
	} 
}

local function getPlayersInArea(fromPos, toPos)
	local players = {}
	for _, pid in ipairs(getPlayersOnline()) do
		if isInRange(getPlayerPosition(pid), fromPos, toPos) then
			table.insert(players, pid)
		end
	end
	return players
end

local function VarAnihiPlayer(cid)
	if not isCreature(cid) then return LUA_ERROR end
	if isInRange(getPlayerPosition(cid), config.from, config.to) then
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local check = {}
	if #getPlayersInArea(config.from, config.to) > 0 then
		doPlayerSendCancel(cid, 'Aguarde, tem jogadores fazendo a quest.') return true
	end
	for _, k in ipairs(t.entrada) do
		local x = getTopCreature(k).uid
		if(x == 0 or not isPlayer(x) or getPlayerLevel(x) < t.lvl) then
			doPlayerSendCancel(cid, 'Está faltando player ou alguém não possui level '..t.lvl..' ou mais.') return true
		end
		table.insert(check, x)
	end
	for _, summon in pairs(t.monstros) do
		local creature = getTopCreature(summon[1]).uid
		if(creature > 0 and not isPlayer(creature)) then
			doRemoveCreature(creature)
		end
		doCleanTile(summon[1])
		doCreateMonster(summon[2], summon[1])
	end
	for i, tid in ipairs(check) do
		doSendMagicEffect(t.entrada[i], CONST_ME_POFF)
		doTeleportThing(tid, t.saida[i], false)
		addEvent(VarAnihiPlayer, t.Time*60*1000, tid)
		doSendMagicEffect(t.saida[i], CONST_ME_ENERGYAREA)
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	return true
end

 

 

Editado por Carlinhous1996 (veja o histórico de edições)

  • Carlinhous1996 mudou o título para boss room sistem 8.6
  • Respostas 5
  • Visualizações 1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado
  • Autor
17 horas atrás, Dono do WNA disse:

Nesse topico tem a resposta do Diego Lima, caso te ajude deixa o REP pra ele!!

 

obrigado pela atençao.

eu tenstei aqui, mas é como o como o dono do topico falou

quando uso o script e como se nao houvesse nada, nao da erro nem nada.

o mesmo falou que mudando para otx resolvia, mas acho que nao compensa mudar so por causa de 1 script

Spoiler

-- Diiego Liima

local posInicio = {x = 1353, y = 908, z = 6} --pos inicio da sala
local posFim = {x = 1371, y = 921, z = 6}--pos final inicio da sala
local posExitTime = {x = 1358, y = 915, 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 == 2320 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 = 1356, y = 915, z = 7}}, --posições dos pisos
            [2] = {pos = {x = 1357, y = 915, z = 7}},
            [3] = {pos = {x = 1358, y = 915, z = 7}},
            [4] = {pos = {x = 1359, y = 915, z = 7}},
            [5] = {pos = {x = 1360, y = 915, 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 = 1358, y = 917, z = 6}) -- 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 = 1357, y = 914, z = 6}, 10) -- efeito aonde o boss nasce
                doCreateMonster("Brother Freeze", {x = 1357, y = 914, z = 6}) -- 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 por Carlinhous1996 (veja o histórico de edições)

Postado
2 horas atrás, Carlinhous1996 disse:

obrigado pela atençao.

eu tenstei aqui, mas é como o como o dono do topico falou

quando uso o script e como se nao houvesse nada, nao da erro nem nada.

o mesmo falou que mudando para otx resolvia, mas acho que nao compensa mudar so por causa de 1 script

  Mostrar conteúdo oculto

-- Diiego Liima

local posInicio = {x = 1353, y = 908, z = 6} --pos inicio da sala
local posFim = {x = 1371, y = 921, z = 6}--pos final inicio da sala
local posExitTime = {x = 1358, y = 915, 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 == 2320 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 = 1356, y = 915, z = 7}}, --posições dos pisos
            [2] = {pos = {x = 1357, y = 915, z = 7}},
            [3] = {pos = {x = 1358, y = 915, z = 7}},
            [4] = {pos = {x = 1359, y = 915, z = 7}},
            [5] = {pos = {x = 1360, y = 915, 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 = 1358, y = 917, z = 6}) -- 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 = 1357, y = 914, z = 6}, 10) -- efeito aonde o boss nasce
                doCreateMonster("Brother Freeze", {x = 1357, y = 914, z = 6}) -- 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

 

qual você esta usando ?

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo