Ir para conteúdo

Featured Replies

Postado
  Em 26/03/2021 em 16:25, Orientalz disse:
Mostrar conteúdo oculto

 

position é sempre do MENOR para o MAIOR... seja X, Y ou Z.

 

testa assim:

 

boss_hours = {
	["01:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["02:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["03:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["04:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["05:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["06:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["07:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["08:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["09:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["10:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["11:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=8}}, time = 30, extra_time = 10},
	["12:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["13:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["14:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["15:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["16:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["17:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["18:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["19:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["20:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["21:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["23:45"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=915, z=7}, toPosition = {x=1024, y=1142, z=8}}, time = 30, extra_time = 10},
	["23:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
	["00:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10}
}

function isWalkable(pos) -- by Nord / editado por Omega
	if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
		return false
	elseif isCreature(getTopCreature(pos).uid) then
		return false
	elseif getTileInfo(pos).protection then
		return false
	elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
		return false
	end
	return true
end
function getPlayersInBossArea(tb)
	local t = {}
	for _, pid in pairs(getPlayersOnline()) do
		if isInRange(getPlayerPosition(pid), tb.pos.fromPosition, tb.pos.toPosition) then 
			t[#t+1] = pid
		end
	end
	return t
end 
function doRemoveBoss(tb, force)
	for x = tb.pos.fromPosition.x, tb.pos.toPosition.x do
		for y = tb.pos.fromPosition.y, tb.pos.toPosition.y do
			for z = tb.pos.fromPosition.z, tb.pos.toPosition.z do 
				local m = getTopCreature({x=x, y=y, z=z}).uid
				if m ~= 0 and isMonster(m) then
					if not force and #getPlayersInBossArea(tb) > 0 then
						addEvent(doRemoveBoss, tb.extra_time*60*1000, tb, true)
						return true
					end
					doSendMagicEffect(getCreaturePosition(m), 54) -- Efeito no monstro quando for removido
					doSendMagicEffect(getCreaturePosition(m), 3) -- Efeito no monstro quando for removido
					doRemoveCreature(m)
					break
				end
			end
		end
	end
end 
function onThink(interval, lastExecution)
	hours = tostring(os.date("%X")):sub(1, 5)
	tb = boss_hours[hours]
	if tb then
		local create = true
		repeat
			local pos = {x = math.random(tb.pos.fromPosition.x, tb.pos.toPosition.x), y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y), z = tb.pos.fromPosition.z}
			if isWalkable(pos) then
				doCreateMonster(tb.boss_name, pos)
				doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
				addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
				addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
				doSendMagicEffect(pos, CONST_ME_MORTAREA)
				doBroadcastMessage("O Boss "..tb.boss_name.." nasceu!")
				addEvent(doRemoveBoss, tb.time*60*1000, tb, false)
				create = false 
			end
		until not create
	end
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

  • Respostas 41
  • Visualizações 5.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local config = { name = "Shuryu Boss", pos = {x = 60, y = 63, z = 3}, time = 20 } function onThink(interval, lastExecution) doCreateMonster(config.name, config.pos) broadcastMessage("O "..config.

  • Quem estiver com esse erro:   attempt to call global 'getCreatureByName' (a nil value)     Testem o código dessa forma:   local config = { name = "Shuryu Boss", p

  • @BangxD Então acho que vou fazer melhor, já que dependendo da hora vai ser determinado boss, vou fazer que nem o "arauto" do League of Legends.   Se estiverem atacando o arauto os players te

Posted Images

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.6k

Informação Importante

Confirmação de Termo