Ir para conteúdo
  • 0
Entre para seguir isso  
kumegawa

Scripting Lever to King Zelos Room

Pergunta

kumegawa    0
kumegawa

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Obs: não delete esse formulário pré-definido, preencha-o corretamente para postar o seu tópico!

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

Base:

OTServBR-Global 12.x

Qual é a sua pergunta?

Olá! Estou tendo alguns problemas ao tentar criar um script de alavanca para o Boss King Zelos. Procurei em vários fórum alguns scripts e nenhum funcionou. 

Atualmente estou usando  como base esse Script: 

otservbr-global/3-urmahlullu-the-immaculate.lua at 30304137ec82749dd024524e405bd8cc00e443ae · opentibiabr/otservbr-global · GitHub

 

E esse post feito aqui: 

OTServ Brasil - O seu Portal para o mundo OTServ!

 

 

Fiz as modificações e que achei que deveria fazer e nada deu certo. Se alguém ai puder me dizer o que fiz de errado agradeço muito!!!

Segue meu script que fiz: 

 

Desde já agradeço a quem puder ajudar! 

 

OBS: A ideia é bem simples, 1-10 jogadores podem entrar na sala do boss e e enfrenta-lo, logo após isso somente depois de 20 horas poderão enfrentar novamente, 

 

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

Spoiler

-- lever to king zelos room

local config = {
    requiredLevel = 450,
    daily = false,
    centerZelosRoomPosition = Position(33443, 31542, 13),
    playerPositions = {
        Position(33485, 31548, 13),
        Position(33486, 31548, 13),
        Position(33485, 31547, 13),
        Position(33486, 31547, 13),
        Position(33485, 31546, 13),
        Position(33486, 31546, 13),
        Position(33485, 31545, 13),
        Position(33486, 31545, 13),
        Position(33485, 31544, 13),
        Position(33486, 31544, 13),


    },
    newPositions = {
        Position(33443, 31542, 13),
    },
    zelosPosition = {
        Position(33443, 31546, 13),
    },
    firstPlayer = {
        Position(33485, 31546, 13),
    }
}

local leverboss = Action()

function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9825 then
        local storePlayers, playerTile = {}

        for i = 1, #config.playerPositions do
            playerTile = Tile(config.firstPlayer):getTopCreature()
            if not playerTile or not playerTile:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 5 players.")
                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

            if config.daily and playerTile:getStorageValue(Storage.King.ZelosTimer) > os.time() then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendCancelMessage('All players are not still ready from last battle yet.')
                return true
            end

            storePlayers[#storePlayers + 1] = playerTile
        end

        local specs, spec = Game.getSpectators(config.centerZelosRoomPosition, false, false, 14, 14, 13, 13)
        for i = 1, #specs do
            spec = specs
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
                return true
            end

            spec:remove()
        end

        if player:getPosition()~=config.firstPlayer[1] then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can't start a battle.")
            return true
        end

        for i = 1, #config.zelosPosition do
            Game.createMonster("King Zelos", config.zelosPosition)
        end

        local players
        for i = 1, #storePlayers do
            players = storePlayers
            config.playerPositions:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[1])
            config.newPositions[1]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_EAST)
        end
        player:setStorageValue(Storage.King.ZelosTimer, os.time()+20*60*60) -- 20 hours
    end

    item:transform(9825)
    return true
end

leverboss:uid(47521)
leverboss:register()

 

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

Spoiler

 

 

Editado por kumegawa

Compartilhar este post


Link para o post
Compartilhar em outros sites

1 resposta a esta questão

Recommended Posts

  • 0
Majesty    1755
Majesty

Script:

Spoiler

-- King Zelos

local config = {
	requiredLevel = 250,
	daily = true,
	roomCenterPosition = Position(33443, 31546, 13),
	playerPositions = {
		Position(33485, 31546, 13),
		Position(33485, 31548, 13),
		Position(33485, 31547, 13),
		Position(33485, 31545, 13),
		Position(33485, 31544, 13),
		Position(33486, 31544, 13),
		Position(33486, 31545, 13),
		Position(33486, 31546, 13),
		Position(33486, 31547, 13),
		Position(33486, 31548, 13)
	},
	teleportPosition = Position(33446, 31552, 13),
	bossPosition = Position(33443, 31536, 13)
}

local leverboss = Action()

function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if item.itemid == 9825 then
		-- Check if the player that pulled the lever is on the correct position
		if player:getPosition() ~= config.playerPositions[1] then
			player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can\'t start the battle.")
			return true
		end
		
		local team, participant = {}

		for i = 1, #config.playerPositions do
			participant = Tile(config.playerPositions[i]):getTopCreature()
			
			-- Check there is a participant player
			if participant and participant:isPlayer() then
				-- Check participant level
				if participant:getLevel() < config.requiredLevel then
					player:sendTextMessage(MESSAGE_STATUS_SMALL,
						"All the players need to be level ".. config.requiredLevel .." or higher.")
					return true
				end

				-- Check participant boss timer
				if config.daily and participant:getStorageValue(Storage.GraveDanger.KingZelosTimer) > os.time() then
					player:getPosition():sendMagicEffect(CONST_ME_POFF)
					player:sendCancelMessage("Not all players are ready yet from last battle.")
					return true
				end

				team[#team + 1] = participant
			end
		end

		-- Check if a team currently inside the boss room
		local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)
		for i = 1, #specs do
			spec = specs[i]
			if spec:isPlayer() then
				player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the boss room.")
				return true
			end

			spec:remove()
		end

		-- Spawn boss
		Game.createMonster("King Zelos", config.bossPosition)

		-- Teleport team participants
		for i = 1, #team do
			team[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
			team[i]:teleportTo(config.teleportPosition)
			-- Assign boss timer
			team[i]:setStorageValue(Storage.GraveDanger.KingZelosTimer, os.time() + 20*60*60) -- 20 hours
		end
		
		config.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
	end

	item:transform(9825)
	return true
end

leverboss:uid(9999)
leverboss:register()

 

 

Compartilhar este post


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

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×