Ir para conteúdo

Featured Replies

Postado
1 hora atrás, Vodkart disse:

consegui ja está ali no topico, no caso se tiver players na area ele da mais um extra time... poderia me mandar o seu codigo para ver como ficou? ta dizendo que não tem uma função no seu ot... manda o código alterado ai.

 meu servidor esta em Revscript tfs 1.3

codigo esta abaixo
 

Spoiler

 

local boss_hours = {
    ["23:15"] = {boss_name = "Demon", pos = {fromPosition = {x=998, y=1010, z=7}, toPosition = {x=998, y=1010, z=7}}, time = 20, extra_time = 10},
    ["23:30"] = {boss_name = "Rat", pos = {fromPosition = {x=998, y=1010, z=7}, toPosition = {x=998, y=1010, z=7}}, time = 20, extra_time = 10},
    ["23:50"] = {boss_name = "Hydra", pos = {fromPosition = {x=998, y=1010, z=7}, toPosition = {x=998, y=1010, z=7}}, time = 20, 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
            local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.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    

local nascerboss = GlobalEvent("nascerbossroom")
function nascerboss.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 

nascerboss:interval(3600000)
nascerboss:register()

 

 

  • Respostas 41
  • Visualizações 5.5k
  • 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

Postado
1 hora atrás, leomacedin disse:

 meu servidor esta em Revscript tfs 1.3

codigo esta abaixo
 

  Mostrar conteúdo oculto

 

local boss_hours = {
    ["23:15"] = {boss_name = "Demon", pos = {fromPosition = {x=998, y=1010, z=7}, toPosition = {x=998, y=1010, z=7}}, time = 20, extra_time = 10},
    ["23:30"] = {boss_name = "Rat", pos = {fromPosition = {x=998, y=1010, z=7}, toPosition = {x=998, y=1010, z=7}}, time = 20, extra_time = 10},
    ["23:50"] = {boss_name = "Hydra", pos = {fromPosition = {x=998, y=1010, z=7}, toPosition = {x=998, y=1010, z=7}}, time = 20, 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
            local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.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    

local nascerboss = GlobalEvent("nascerbossroom")
function nascerboss.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 

nascerboss:interval(3600000)
nascerboss:register()

 

 

 

ah ta, esse código é pra versão 0.X mano!!

vodkart_logo.png

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

 

DISCORDvodkart#6090

 

  • 3 weeks later...
Postado
Em 10/10/2020 em 22:30, Vodkart disse:

@BangxD

 

Não testei

 


boss_hours = {
	["10:00"] = {boss_name = "Demon", pos = {fromPosition = {x=1011, y=910, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 20, extra_time = 10},
	["11:00"] = {boss_name = "Rat", pos = {fromPosition = {x=1011, y=910, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 20, extra_time = 10},
	["12:00"] = {boss_name = "Hydra", pos = {fromPosition = {x=1011, y=910, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 20, 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
			local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.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	
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  

 

COMO POE EM XML?

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