Ir para conteúdo
  • 0
Felipesam

Scripting Script Boss time

Pergunta

Felipesam    0
Felipesam

Primeiramente, bom dia!
Gostaria de pedir o auxilio de vocês, estou tendo um problema, no qual não consigo solucionar, preciso de um sistema que verifique se há algum player na sala enfrentando o boss, e aposo combate, o player terá um delay de 20 horas para poder enfrentar novamente, também preciso fazer a checagem para conferir se o player morreu na sala, e tirar o boss que ele não conseguiu matar. abaixo tem o script que ja consegui! 
desde já obrigado

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

local t = {
    players = { -- posições que os players devem ficar ao puxar a alavanca
        [1] = Position(33395,32661,6),
        [2] = Position(33394,32662,6),
        [3] = Position(33395,32662,6),
        [4] = Position(33395,32663,6),
        [5] = Position(33396,32662,6)
    },
    
    boss = {name = "Scarlett Etzel", create_pos = Position(33396,32642,6)},
  
    destination = Position(33395,32656,6), -- posição para qual os players serão teleportados
    
    cooldown = {20, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"}
    
    storage = 56482 -- storage não utilizado no seu servidor
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local players, tab = {}, t.players
    for i = 1, #tab do
        local tile = Tile(tab)
        if tile then
            local p = Player(tile:getTopCreature())
            if p then
                if p:getStorageValue(t.storage) <= os.time() then
                    players[#players + 1] = p:getId()
                end
            end
        end
    end
    if #players == 0 then
        player:sendCancelMessage("One or all players did not wait " .. getStrTime(t.cooldown) .. " to go again.")
        return true
    end
    for i = 1, #tab do
        local playerTile = Tile(tab)
        local playerToGo = Player(playerTile:getTopCreature())
        if playerToGo then
            if isInArray(players, playerToGo:getId()) then
                playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time())
                playerTile:relocateTo(t.destination)
                tab:sendMagicEffect(CONST_ME_POFF)
            end
        end
    end
    t.destination:sendMagicEffect(CONST_ME_TELEPORT)
    Game.createMonster(t.boss.name, t.boss.create_pos)
    item:transform(item.itemid == 36319 or 1946 or 1945)
    return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

function getStrTime(table) -- by dwarfer
local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"}
return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or ""))
end

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

 

 

Editado por Felipesam

Compartilhar este post


Link para o post
Compartilhar em outros sites

2 respostass a esta questão

Recommended Posts

  • 0
MiguelZito    0
MiguelZito

Bom dia, eu fiz um scirpter pra você acho que vai te ajuda, testa ai e me da um retorno eu nao testei

Teste esse scripter

 

local config = {
	time = 1,
	requiredLevel = 1000,  -- Level que pode usa o item ou a lavanca
	daily = false, -- nao mexe nisso
	centerDemonRoomPosition = Position(32265, 33899, 7), -- position que o player vai cai dentro da sala do boss
	playerPositions = {
		Position(370, 196, 7),  -- position de onde os player pode usa o Item ou lavanca
		Position(370, 196, 7),
		Position(370, 196, 7),
		Position(370, 196, 7)
	},
	newPositions = {
		Position(32265, 33899, 7), -- Mesma position onde os player vai cai dentro da sala se for varios player em varios lugares é so coloca em cada uma position.
		Position(32265, 33899, 7),
		Position(32265, 33899, 7),
		Position(32265, 33899, 7)
	},
	soltoPosition = {
		Position(159, 51, 7) -- position onde o player vai quando acaba o tempo dele.
	},
	demonPositions = {
		Position(33219, 31657, 13) -- position do boss se quizer por mais de um boss é so adiciona Position(33219, 31657, 13), com a virgula
	}
}


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if item.itemid == 25378 then  -- item que é usado para entra na area do boss
		local storePlayers, playerTile = {}

		for i = 1, #config.playerPositions do
			playerTile = Tile(config.playerPositions[i]):getTopCreature()
			if not playerTile or not playerTile:isPlayer() then
				player:sendTextMessage(MESSAGE_STATUS_SMALL, "Voce nao esta no lugar certo.")
				return true
			end

			if playerTile:getLevel() < config.requiredLevel then
				player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
				return true
			end

			storePlayers[#storePlayers + 1] = playerTile
		end

		local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 100, 100, 100, 100)
		for i = 1, #specs do
			spec = specs[i]
			if spec:isPlayer() then
				player:sendTextMessage(MESSAGE_STATUS_SMALL, "Tem alguem lutando com o boss, aguarde !")
				return true
			end

			spec:remove()
		end

		for i = 1, #config.demonPositions do
			Game.createMonster("Demon", config.demonPositions[i])
		end

		local players
		for i = 1, #storePlayers do
			players = storePlayers[i]
			config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
			players:teleportTo(config.newPositions[i])
			doRemoveItem(item.uid, 1)
			config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
			player:sendTextMessage(MESSAGE_INFO_DESCR, "Voce tem 3 horas para matar o boss. Se morrer nao podera voltar!!")
		end
	elseif item.itemid == 25378 then
		if config.daily then
			player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
			return true
		end
	end

	item:transform(item.itemid == 25378 and 25378 or 25378)
	return true
end

 

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Dorso    0
Dorso

Qual o caminho desse Script???

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×