Ir para conteúdo
  • Cadastre-se

(Resolvido)Invasao de Monsters Aleatorios


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

Queria uma Script que o server sorteia qual monster vai nascer exemplo

coloco 9/10 monster na script o server vai e escolhe uma deles pra dar Respawn

Queria que esse evento aconteça em 3-/-3 horas

Avisa ao server Todo Exemplo "Nasceu X Monster X Local Mate-o"

se nao matar o Monster em 1:30 o Server Retira ele.

Obrigado.

 

@Dwarfer

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

Link para o post
Compartilhar em outros sites
  • Solução

Crie um arquivo em globalevents.lua:

 

Spoiler

local t = {
monsters = {"Dwarf", "Dwarf Guard", "Dwarf Soldier", "Dwarf Geomancer", "Rotworm", "Cyclops", "Snake", "Troll", "Orc", "Spider"},
position = {x=1, y =1, z=1}, -- edite o local 
location = "Kazordoon Mines", -- msg onde nasceu o monstro
remove_time = {1.5, "hour"} -- edite o tempo para remover
}

function onThink(interval, lastExecution)
local m = t.monsters[math.random(1, #t.monsters)]
doBroadcastMessage(m .. " appeared near "..t.location .. "! It will be there for " .. t.remove_time[1] .. " " .. t.remove_time[2] .. ".", MESSAGE_EVENT_ADVANCE) 
local monster = doSummonCreature(m, t.position)
addEvent(function()
if isMonster(monster) then
doRemoveCreature(monster)
doBroadcastMessage(m.. " returned stronger than before to its covil.", MESSAGE_EVENT_ADVANCE)
end
end, mathtime(t.remove_time)*1000)
return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

 

 

 

E adicione a tag no globalevents.xml:  <globalevent name="RandomInvasao" interval="10800000" event="script" value="NOMEDOSEUARQUIVO.lua"/>

 

Edite o interval como queira. Tá configurado para acontecer de 3 em 3 horas e remover a cada 1h e meia.

 

 

 

Editado por Dwarfer (veja o histórico de edições)

Contato:

 

Link para o post
Compartilhar em outros sites
  • 1 month later...
Em 27/08/2017 em 14:00, Dwarfer disse:

Crie um arquivo em globalevents.lua:

 

  Ocultar conteúdo


local t = {
monsters = {"Dwarf", "Dwarf Guard", "Dwarf Soldier", "Dwarf Geomancer", "Rotworm", "Cyclops", "Snake", "Troll", "Orc", "Spider"},
position = {x=1, y =1, z=1}, -- edite o local 
location = "Kazordoon Mines", -- msg onde nasceu o monstro
remove_time = {1.5, "hour"} -- edite o tempo para remover
}

function onThink(interval, lastExecution)
local m = t.monsters[math.random(1, #t.monsters)]
doBroadcastMessage(m .. " appeared near "..t.location .. "! It will be there for " .. t.remove_time[1] .. " " .. t.remove_time[2] .. ".", MESSAGE_EVENT_ADVANCE) 
local monster = doSummonCreature(m, t.position)
addEvent(function()
if isMonster(monster) then
doRemoveCreature(monster)
doBroadcastMessage(m.. " returned stronger than before to its covil.", MESSAGE_EVENT_ADVANCE)
end
end, mathtime(t.remove_time)*1000)
return true
end

function mathtime(table) 
    if table[2] == "sec" then
        return table[1]
    elseif table[2] == "min" then
        return table[1]*60
    elseif table[2] == "hour" then
        return table[1]*60*60
    elseif table[2] == "day" then
        return table[1]*24*60*60
    else
        return print("Error: Bad declaration in mathtime function.")
    end
end

 

 

 

E adicione a tag no globalevents.xml:  <globalevent name="RandomInvasao" interval="10800000" event="script" value="NOMEDOSEUARQUIVO.lua"/>

 

Edite o interval como queira. Tá configurado para acontecer de 3 em 3 horas e remover a cada 1h e meia.

 

 

 

 

Tem como fazer ela somente 1 monstro?

Link para o post
Compartilhar em outros sites
1 hora atrás, Mateus Santosss disse:

Tem como fazer ela somente 1 monstro?

 

É só deixar apenas um monstro lá: monsters = {"Dwarf"}

 

 

 

Contato:

 

Link para o post
Compartilhar em outros sites
  • 9 months later...
Em 27/08/2017 em 14:00, Dwarfer disse:

Crie um arquivo em globalevents.lua:

 

  Ocultar conteúdo


local t = {
monsters = {"Dwarf", "Dwarf Guard", "Dwarf Soldier", "Dwarf Geomancer", "Rotworm", "Cyclops", "Snake", "Troll", "Orc", "Spider"},
position = {x=1, y =1, z=1}, -- edite o local 
location = "Kazordoon Mines", -- msg onde nasceu o monstro
remove_time = {1.5, "hour"} -- edite o tempo para remover
}

function onThink(interval, lastExecution)
local m = t.monsters[math.random(1, #t.monsters)]
doBroadcastMessage(m .. " appeared near "..t.location .. "! It will be there for " .. t.remove_time[1] .. " " .. t.remove_time[2] .. ".", MESSAGE_EVENT_ADVANCE) 
local monster = doSummonCreature(m, t.position)
addEvent(function()
if isMonster(monster) then
doRemoveCreature(monster)
doBroadcastMessage(m.. " returned stronger than before to its covil.", MESSAGE_EVENT_ADVANCE)
end
end, mathtime(t.remove_time)*1000)
return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end

 

 

 

E adicione a tag no globalevents.xml:  <globalevent name="RandomInvasao" interval="10800000" event="script" value="NOMEDOSEUARQUIVO.lua"/>

 

Edite o interval como queira. Tá configurado para acontecer de 3 em 3 horas e remover a cada 1h e meia.

 

 

 

tem como por pra aparecer todos os sábados é domingo ?

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo