Ir para conteúdo
  • 0
costickmichel

Scripting Script que limpa sala antes de criar monstro.

Pergunta

costickmichel    0
costickmichel

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 - Version TFS 1.3

Qual é a sua pergunta?

Boa noite. Gostaria da ajuda de vocês. Tenho esse script esta 100%, porém caso o monster q foi criado após o use da alavanca não for morto, o próximo player que usar. terá q enfrentar dois monstros ( O que o antigo player não matou e o novo que ele precisa matar ) . alguem sabe algum comando(script) que limpe a sala antes de criar um novo monstro ?

 

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 = {
    centerRoom = Position(33616, 32561, 13),
    bossPosition = Position(33617, 32561, 13),
    newPosition = Position(33617, 32567, 13)
}


local threatenedLever = Action()

function threatenedLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 10030 then
        if player:getPosition() ~= Position(33638, 32562, 13) then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Step on the tile in front of the lever to activate it.")
            return true
        end
    end
    if item.itemid == 10030 then
        local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Faceless Bane.")
                return true
            end
        end

        for x = 33638, 33642 do
            local playerTile = Tile(Position(x, 32562, 13)):getTopCreature()
            if playerTile and playerTile:isPlayer() then
                if playerTile:getStorageValue(Storage.ThreatenedDreams.FacelessBaneTime) > os.time() then
                    playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
                    playerTile:teleportTo(config.newPosition)
                    playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                    playerTile:setStorageValue(Storage.ThreatenedDreams.FacelessBaneTime, os.time() + 20 * 3600)
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Boss.")
                    return true
                end
            end
        end
        local moster = Game.createMonster("Faceless Bane", config.bossPosition, true, true)
       
        --addEvent(clearBosses, 30 * 60 * 1000)
        item:transform(10030)
    elseif item.itemid == 10030 then
        item:transform(10029)
    end
    return true
end

threatenedLever:uid(1039)
threatenedLever:register()

 

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

Spoiler

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

3 respostass a esta questão

Recommended Posts

  • 0
Majesty    1755
Majesty

Script:

Spoiler

local setting = {
	timeToFightAgain = 20, -- In hour
	clearRoomTime = 60, -- In hour
	centerRoom = {x = 33617, y = 32561, z = 13},
	range = 10,
	exitPosition = {x = 33617, y = 32569, z = 13},
	storage = Storage.ThreatenedDreams.FacelessBaneTime,
	bossName = "Faceless Bane",
	bossPosition = {x = 33617, y = 32561, z = 13}
}

local playerPositions = {
	{fromPos = {x = 33638, y = 32562, z = 13}, toPos = {x = 33615, y = 32567, z = 13}},
	{fromPos = {x = 33639, y = 32562, z = 13}, toPos = {x = 33616, y = 32567, z = 13}},
	{fromPos = {x = 33640, y = 32562, z = 13}, toPos = {x = 33617, y = 32567, z = 13}},
	{fromPos = {x = 33641, y = 32562, z = 13}, toPos = {x = 33618, y = 32567, z = 13}},
	{fromPos = {x = 33642, y = 32562, z = 13}, toPos = {x = 33619, y = 32567, z = 13}}
}

local threatenedLever = Action()
function threatenedLever.onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
	if item.itemid == 10030 then
		if player:getPosition() ~= Position(33638, 32562, 13) then
			player:SendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		if roomIsOccupied(setting.centerRoom, setting.range, setting.range) then
			player:say("Someone is fighting against the boss! You need wait awhile.", TALKTYPE_MONSTER_SAY)
			return true
		end

		for i = 1, #playerPositions do
			local creature = Tile(playerPositions[i].fromPos):getTopCreature()
			if creature and creature:isPlayer() then
				if creature:getStorageValue(setting.storage) < os.time() then
                    creature:setStorageValue(setting.storage, os.time() + setting.timeToFightAgain * 60 * 60)
					creature:teleportTo(playerPositions[i].toPos)
					creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                else
					creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last " .. setting.timeToFightAgain .. " hours.")
					return true
				end
			end
		end
		-- One hour for clean the room
		addEvent(clearRoom, setting.clearRoomTime * 60 * 1000, setting.centerRoom, setting.range, setting.range, setting.exitPosition)
		Game.createMonster(setting.bossName, setting.bossPosition)
	end
	return true
end

threatenedLever:uid(1039)
threatenedLever:register()

 

 

Editado por Majesty
Atualizado.

Compartilhar este post


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

Esse era um script antigo que eu tinha também, porém tem varios erros, por isso eu reformulei ele, esse ai nao puxa os 5 players. so nao posso te afirmar se ele funciona o cleanboss event ali.

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.

×