Jump to content
  • 0
rogerio021

Scripting Duke Krule script

Question

rogerio021

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:

Mapa Global 12x

Qual é a sua pergunta?

Galera estou com problema adicionei o Duke  boss de Thaís e usei a script do lulu como base , Deu certo porem quando faço algum dele lulu ou o Duke não tem como eu fazer o outro, como se eu tivesse já feito, já procurei solucionar mais não encontro em lugar algum se alguém ja passou por isso e pode me dar um help agradeço 

 

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

Spoiler
local config = {
    requiredLevel = 100,
    daily = true,
    roomCenterPosition = Position(33455, 31472, 13),
    playerPositions = {
        Position(33455, 31493, 13),
        Position(33456, 31493, 13),
        Position(33457, 31493, 13),
        Position(33458, 31493, 13),
        Position(33459, 31493, 13)
    },
    teleportPosition = Position(33455, 31479, 13),
    bossPosition = Position(33456, 31466, 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):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.Kilmaresh.UrmahlulluTimer) > 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
            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("Duke Krule", config.bossPosition)

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

    item:transform(9825)
    return true
end

leverboss:uid(65535)
leverboss:register()
  

Esse e o Script Do Lulu

-- lever to urmahlullu room

local config = {
    requiredLevel = 100,
    daily = true,
    roomCenterPosition = Position(33919, 31648, 8),
    playerPositions = {
        Position(33918, 31626, 8),
        Position(33919, 31626, 8),
        Position(33920, 31626, 8),
        Position(33921, 31626, 8),
        Position(33922, 31626, 8)
    },
    teleportPosition = Position(33918, 31657, 8),
    bossPosition = Position(33918, 31641, 8)
}

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):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.Kilmaresh.UrmahlulluTimer) > 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
            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("Urmahlullu the Immaculate", config.bossPosition)

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

    item:transform(9825)
    return true
end

leverboss:uid(9545)
leverboss:register()

 

 

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

Spoiler

 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Majesty

Usa esse como exemplo:

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()

 

 

Share this post


Link to post
Share on other sites
  • 0
rogerio021
13 horas atrás, Majesty disse:

Usa esse como exemplo:

  Ocultar conteúdo

-- 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()

 

 

Esse Deu Certo Vlw 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×