Ir para conteúdo
  • 0

Ajuda arrumar sistema de raid


warriorfrog

Pergunta

Estou usando 0.4

Alguém me ajuda a arrumar meu sistema de raid!

 

Raids.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<raids>
   <singlespawn name="Orshabaal" delay="0" message="Raid: Orshabaal" x="368" y="1588" z="7">
</raids>

 

 

<globalevent name="Invasion" time="03:22:00" script="raids.lua" />

 

raids.lua

 

local now = os.date("*t")
local raids = {
  'Orshabaal',
  'Orshabaal',
  'Orshabaal'
}

if now.wday == 7 or now.wday == 1 then -- if today is monday (wday can be 1-7 and starts with Sunday as 1)
  executeRaid(raids[math.random(1, #raids)])
end

 

Error:

http://i.imgur.com/uvfjF5l.png

 

http://i.imgur.com/KZuUPr9.png

Link para o comentário
Compartilhar em outros sites

13 respostass a esta questão

Posts Recomendados

  • 0

diminui esse interval pra
<globalevent name="randomentreraidfds" interval="1000" event="script" value="raid.lua"/>

e esse para

<raid name="Orshabaal" file="scripts/Orshabaal.xml" interval2="15" margin="1800" enabled="yes"/>

aí vc tenta usar /raid orshabaal.. Se der certo a gente sabe que a raid funciona. Aí vc precisa abrir o sv uns 10 minutos antes da hora que vc colocou lá. Se vc colocou 5 horas, então tenha ctza que 4:50 da manhã o sv vai estar aberto e espera até pelo menos 5:10 pra ver se ele executou ou não.

presta atenção nos dias configurados e lembra que a hora é aleatória, o script está correto;


 

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

    local invasoes = {'Orshabaal'}    
    local hours = {5, 10}

    local raids =
    {
        [1] =
        {
            days = {'sunday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [2] =
        {
            days = {'friday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [3] =
        {
            days = {'saturday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        }
    }
    
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        local day = os.date("%A", static_time):lower()
        if isInArray(raid.days, day) then
            local hour = tonumber(os.date("%H", static_time))
            if (raid.hour == hour) then
                local minute = tonumber(os.date("%M", static_time))
                if (raid.minu == minute) then
                    local day_number = tonumber(os.date("%d", static_time))
                    if (last_execsutes[k] ~= day_number) then
                        last_execsutes[k] = day_number
                        executeRaid(invasoes[math.random(1, #invasoes)])
                    end
                end
            end
        end
    end
    return true
end



e não precisa me citar pra responder minhas perguntas, e lembra de usar [.spoiler] [./spoiler] sem os pontos pra garantir que o código fique minimizado, se não fica foda ficar lendo oque vc escreve.

 

Link para o comentário
Compartilhar em outros sites

  • 0

cara, isso n é um sistema de raid.. usa o meu:

globalevents/scripts/raid.lua

 

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be 
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

local raids =
	{
		[1] = 
			{
				name = 'Morgaroth',
				type = 'weekly',
				days = {'friday'},
				hour = 18,
				minu = 00
			},
		[2] = 
			{
				name = 'Zulazza the Corruptor',
				type = 'weekly',
				days = {'tuesday'},
				hour = 20,
				minu = 00
			},
		[3] = 
			{
				name = 'RatsThais',
				type = 'weekly',
				days = {'monday'},
				hour = 8,
				minu = 00
			},
		[4] = 
			{
				name = 'OrcsThais',
				type = 'weekly',
				days = {'wednesday'},
				hour = 12,
				minu = 00
			},
		[5] = 
			{
				name = 'Barbarian',
				type = 'weekly',
				days = {'thursday'},
				hour = 10,
				minu = 00
			},
		[6] = 
			{
				name = 'Demodras',
				type = 'weekly',
				days = {'sunday'},
				hour = 15,
				minu = 00
			},
		[7] = 
			{
				name = 'Elfos',
				type = 'weekly',
				days = {'tuesday'},
				hour = 10,
				minu = 00
			},
		[8] = 
			{
				name = 'Ferumbras',
				type = 'weekly',
				days = {'saturday'},
				hour = 22,
				minu = 00
			},
		[9] = 
			{
				name = 'Ghazbaran',
				type = 'weekly',
				days = {'monday'},
				hour = 16,
				minu = 00
			},
		[10] = 
			{
				name = 'Horned Fox',
				type = 'weekly',
				days = {'sunday'},
				hour = 8,
				minu = 00
			},
		[11] = 
			{
				name = 'Necropharus',
				type = 'weekly',
				days = {'thursday'},
				hour = 20,
				minu = 00
			},
		[12] = 
			{
				name = 'Nomads',
				type = 'weekly',
				days = {'wednesday'},
				hour = 8,
				minu = 00
			},
		[13] = 
			{
				name = 'Orshabaal',
				type = 'weekly',
				days = {'sunday'},
				hour = 18,
				minu = 00
			},
		[14] = 
			{
				name = 'Pirates',
				type = 'weekly',
				days = {'saturday'},
				hour = 6,
				minu = 00
			},
		[15] = 
			{
				name = 'Quaras',
				type = 'weekly',
				days = {'friday'},
				hour = 4,
				minu = 00
			},
		[16] = 
			{
				name = 'Scarabs',
				type = 'weekly',
				days = {'tuesday'},
				hour = 5,
				minu = 00
			},
		[17] = 
			{
				name = 'Old Widow',
				type = 'weekly',
				days = {'wednesday'},
				hour = 19,
				minu = 00
			},
		[18] = 
			{
				name = 'Undead Army',
				type = 'weekly',
				days = {'thursday'},
				hour = 20,
				minu = 00
			},
		[19] = 
			{
				name = 'Undead Darashia',
				type = 'weekly',
				days = {'friday'},
				hour = 12,
				minu = 00
			},
		[20] = 
			{
				name = 'Sir Valorcrest',
				type = 'weekly',
				days = {'monday'},
				hour = 11,
				minu = 00
			},
		[21] = 
			{
				name = 'Zevelong Duskbringer',
				type = 'weekly',
				days = {'tuesday'},
				hour = 3,
				minu = 00
			},
		[22] = 
			{
				name = 'Diblis The Fair',
				type = 'weekly',
				days = {'saturday'},
				hour = 12,
				minu = 00
			},
		[23] = 
			{
				name = 'Arachir the Ancient One',
				type = 'weekly',
				days = {'monday'},
				hour = 15,
				minu = 00
			},
		[24] = 
			{
				name = 'Halloween Hare',
				type = 'exact',
				date = {day = 31, month = 10},
				hour = 16,
				minu = 00
			}	
	}
	
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
	local static_time = os.time()
	for k, raid in ipairs(raids) do
		if (raid.type == 'weekly') then
			local day = os.date("%A", static_time):lower()
			if isInArray(raid.days, day) then
				local hour = tonumber(os.date("%H", static_time))
				if (raid.hour == hour) then
					local minute = tonumber(os.date("%M", static_time))
					if (raid.minu == minute) then
						local day_number = tonumber(os.date("%d", static_time))
						if (last_execsutes[k] ~= day_number) then
							last_execsutes[k] = day_number
							doExecuteRaid(raid.name)
						end
					end
				end
			end
		elseif (raid.type == 'exact') then
			local month = tonumber(os.date("%m", static_time))
			if (raid.date.month == month) then
				local day = tonumber(os.date("%d", static_time))
				if (raid.date.day == day) then
					local hour = tonumber(os.date("%H", static_time))
					if (raid.hour == hour) then
						local minute = tonumber(os.date("%M", static_time))
						if (raid.minu == minute) then
							if (last_execsutes[k] ~= day) then
								last_execsutes[k] = day
								doExecuteRaid(raid.name)
							end
						end
					end
				end
			end
		end
	end
	return true
end

 



globalevents.xml:

<globalevent name="raids" interval="60000" event="script" value="raid.lua"/>


raids/raids.xml

<?xml version="1.0" encoding="UTF-8"?>
<raids>
	<raid name="Barbarian" file="Barbarian.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Demodras" file="Demodras.xml" interval2="35" margin="1800" enabled="yes"/>
	<raid name="Elfs" file="Elfs.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Ferumbras" file="Ferumbras.xml" interval2="60" margin="1800" enabled="yes"/>
	<raid name="Necropharus" file="Necropharus.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="OrcsThais" file="OrcsThais.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Orshabaal" file="Orshabaal.xml" interval2="45" margin="1800" enabled="yes"/>
	<raid name="Pirates" file="Pirates.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Quara" file="Quara.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Rats" file="Rats.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Scarabs" file="Scarabs.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="The Old Widow" file="The Old Widow.xml" interval2="35" margin="1800" enabled="yes"/>
	<raid name="UndeadDarashia" file="UndeadDarashia.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="UndeadArmy" file="UndeadArmy.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Wolfsraid" file="Wolfsraid.xml" interval2="25" margin="1800" enabled="yes"/>
	<raid name="Necropharus" file="Necropharus.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Hornedfox" file="Hornedfox.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Halloweenhare" file="Halloweenhare.xml" interval2="40" margin="1800" enabled="yes"/>
	<raid name="Undead Jester" file="Undead Jester.xml" interval2="40" margin="1800" enabled="yes"/>
	<raid name="goblin" file="grynch clan goblin.xml" interval2="40" margin="1800" enabled="yes"/>
	<raid name="Morgaroth" file="Morgaroth.xml" interval2="40" margin="1800" enabled="yes"/>
</raids>

e os scripts tem que ser da forma:

 

<?xml version="1.0" encoding="utf-8"?>
<raid>
    <!-- 
	// Raid System by 5mok3
	// DO NOT CHANGE INTERVAL UNLESS YOU ARE SURE WHAT YOU ARE DOING!!
	-->

  <!--Announcements-->
  <announce delay="1000" type="Event" message="An ancient evil is awakening in the mines beneath Hrodmir." />
  <announce delay="30000" type="Event" message="Demonic entities are entering the mortal realm in the Hrodmir mines." />
  <announce delay="60000" type="Event" message="The demonic master has revealed itself in the mines of Hrodmir." />
  <!--Single Spawns-->
  <singlespawn delay="60000" name="Ghazbaran" x="32228" y="31163" z="15" />
  <!--Area Spawns-->
  <areaspawn delay="53000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Deathslicer" amount="12" />
  </areaspawn>
  <areaspawn delay="55000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Juggernaut" amount="5" />
  </areaspawn>
  <areaspawn delay="56000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Fury" amount="8" />
  </areaspawn>
  <areaspawn delay="58000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Demon" amount="6" />
  </areaspawn>
</raid>

 

 

Agora é só retirar os que você não vai usar que dá certinho.

Link para o comentário
Compartilhar em outros sites

  • 0

cara, isso n é um sistema de raid.. usa o meu:

 

globalevents/scripts/raid.lua

 

 

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be 
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

local raids =
	{
		[1] = 
			{
				name = 'Morgaroth',
				type = 'weekly',
				days = {'friday'},
				hour = 18,
				minu = 00
			},
		[2] = 
			{
				name = 'Zulazza the Corruptor',
				type = 'weekly',
				days = {'tuesday'},
				hour = 20,
				minu = 00
			},
		[3] = 
			{
				name = 'RatsThais',
				type = 'weekly',
				days = {'monday'},
				hour = 8,
				minu = 00
			},
		[4] = 
			{
				name = 'OrcsThais',
				type = 'weekly',
				days = {'wednesday'},
				hour = 12,
				minu = 00
			},
		[5] = 
			{
				name = 'Barbarian',
				type = 'weekly',
				days = {'thursday'},
				hour = 10,
				minu = 00
			},
		[6] = 
			{
				name = 'Demodras',
				type = 'weekly',
				days = {'sunday'},
				hour = 15,
				minu = 00
			},
		[7] = 
			{
				name = 'Elfos',
				type = 'weekly',
				days = {'tuesday'},
				hour = 10,
				minu = 00
			},
		[8] = 
			{
				name = 'Ferumbras',
				type = 'weekly',
				days = {'saturday'},
				hour = 22,
				minu = 00
			},
		[9] = 
			{
				name = 'Ghazbaran',
				type = 'weekly',
				days = {'monday'},
				hour = 16,
				minu = 00
			},
		[10] = 
			{
				name = 'Horned Fox',
				type = 'weekly',
				days = {'sunday'},
				hour = 8,
				minu = 00
			},
		[11] = 
			{
				name = 'Necropharus',
				type = 'weekly',
				days = {'thursday'},
				hour = 20,
				minu = 00
			},
		[12] = 
			{
				name = 'Nomads',
				type = 'weekly',
				days = {'wednesday'},
				hour = 8,
				minu = 00
			},
		[13] = 
			{
				name = 'Orshabaal',
				type = 'weekly',
				days = {'sunday'},
				hour = 18,
				minu = 00
			},
		[14] = 
			{
				name = 'Pirates',
				type = 'weekly',
				days = {'saturday'},
				hour = 6,
				minu = 00
			},
		[15] = 
			{
				name = 'Quaras',
				type = 'weekly',
				days = {'friday'},
				hour = 4,
				minu = 00
			},
		[16] = 
			{
				name = 'Scarabs',
				type = 'weekly',
				days = {'tuesday'},
				hour = 5,
				minu = 00
			},
		[17] = 
			{
				name = 'Old Widow',
				type = 'weekly',
				days = {'wednesday'},
				hour = 19,
				minu = 00
			},
		[18] = 
			{
				name = 'Undead Army',
				type = 'weekly',
				days = {'thursday'},
				hour = 20,
				minu = 00
			},
		[19] = 
			{
				name = 'Undead Darashia',
				type = 'weekly',
				days = {'friday'},
				hour = 12,
				minu = 00
			},
		[20] = 
			{
				name = 'Sir Valorcrest',
				type = 'weekly',
				days = {'monday'},
				hour = 11,
				minu = 00
			},
		[21] = 
			{
				name = 'Zevelong Duskbringer',
				type = 'weekly',
				days = {'tuesday'},
				hour = 3,
				minu = 00
			},
		[22] = 
			{
				name = 'Diblis The Fair',
				type = 'weekly',
				days = {'saturday'},
				hour = 12,
				minu = 00
			},
		[23] = 
			{
				name = 'Arachir the Ancient One',
				type = 'weekly',
				days = {'monday'},
				hour = 15,
				minu = 00
			},
		[24] = 
			{
				name = 'Halloween Hare',
				type = 'exact',
				date = {day = 31, month = 10},
				hour = 16,
				minu = 00
			}	
	}
	
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
	local static_time = os.time()
	for k, raid in ipairs(raids) do
		if (raid.type == 'weekly') then
			local day = os.date("%A", static_time):lower()
			if isInArray(raid.days, day) then
				local hour = tonumber(os.date("%H", static_time))
				if (raid.hour == hour) then
					local minute = tonumber(os.date("%M", static_time))
					if (raid.minu == minute) then
						local day_number = tonumber(os.date("%d", static_time))
						if (last_execsutes[k] ~= day_number) then
							last_execsutes[k] = day_number
							doExecuteRaid(raid.name)
						end
					end
				end
			end
		elseif (raid.type == 'exact') then
			local month = tonumber(os.date("%m", static_time))
			if (raid.date.month == month) then
				local day = tonumber(os.date("%d", static_time))
				if (raid.date.day == day) then
					local hour = tonumber(os.date("%H", static_time))
					if (raid.hour == hour) then
						local minute = tonumber(os.date("%M", static_time))
						if (raid.minu == minute) then
							if (last_execsutes[k] ~= day) then
								last_execsutes[k] = day
								doExecuteRaid(raid.name)
							end
						end
					end
				end
			end
		end
	end
	return true
end

 

 

 

globalevents.xml:

 

<globalevent name="raids" interval="60000" event="script" value="raid.lua"/>

 

 

raids/raids.xml

<?xml version="1.0" encoding="UTF-8"?>
<raids>
	<raid name="Barbarian" file="Barbarian.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Demodras" file="Demodras.xml" interval2="35" margin="1800" enabled="yes"/>
	<raid name="Elfs" file="Elfs.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Ferumbras" file="Ferumbras.xml" interval2="60" margin="1800" enabled="yes"/>
	<raid name="Necropharus" file="Necropharus.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="OrcsThais" file="OrcsThais.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Orshabaal" file="Orshabaal.xml" interval2="45" margin="1800" enabled="yes"/>
	<raid name="Pirates" file="Pirates.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Quara" file="Quara.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Rats" file="Rats.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Scarabs" file="Scarabs.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="The Old Widow" file="The Old Widow.xml" interval2="35" margin="1800" enabled="yes"/>
	<raid name="UndeadDarashia" file="UndeadDarashia.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="UndeadArmy" file="UndeadArmy.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Wolfsraid" file="Wolfsraid.xml" interval2="25" margin="1800" enabled="yes"/>
	<raid name="Necropharus" file="Necropharus.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Hornedfox" file="Hornedfox.xml" interval2="30" margin="1800" enabled="yes"/>
	<raid name="Halloweenhare" file="Halloweenhare.xml" interval2="40" margin="1800" enabled="yes"/>
	<raid name="Undead Jester" file="Undead Jester.xml" interval2="40" margin="1800" enabled="yes"/>
	<raid name="goblin" file="grynch clan goblin.xml" interval2="40" margin="1800" enabled="yes"/>
	<raid name="Morgaroth" file="Morgaroth.xml" interval2="40" margin="1800" enabled="yes"/>
</raids>

e os scripts tem que ser da forma:

 

 

<?xml version="1.0" encoding="utf-8"?>
<raid>
    <!-- 
	// Raid System by 5mok3
	// DO NOT CHANGE INTERVAL UNLESS YOU ARE SURE WHAT YOU ARE DOING!!
	-->

  <!--Announcements-->
  <announce delay="1000" type="Event" message="An ancient evil is awakening in the mines beneath Hrodmir." />
  <announce delay="30000" type="Event" message="Demonic entities are entering the mortal realm in the Hrodmir mines." />
  <announce delay="60000" type="Event" message="The demonic master has revealed itself in the mines of Hrodmir." />
  <!--Single Spawns-->
  <singlespawn delay="60000" name="Ghazbaran" x="32228" y="31163" z="15" />
  <!--Area Spawns-->
  <areaspawn delay="53000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Deathslicer" amount="12" />
  </areaspawn>
  <areaspawn delay="55000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Juggernaut" amount="5" />
  </areaspawn>
  <areaspawn delay="56000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Fury" amount="8" />
  </areaspawn>
  <areaspawn delay="58000" fromx="32194" fromy="30986" fromz="14" tox="32213" toy="31012" toz="14">
    <monster name="Demon" amount="6" />
  </areaspawn>
</raid>

 

 

Agora é só retirar os que você não vai usar que dá certinho.

 

O problema é que o seu não é do jeito que eu queria, poderia adaptar pra mim? O seu tem dia e hora marada

 

O meu que eu to tentando fazer (juntando varias partes de scripts q eu acho, sou noob)

Era tipo assim

Todo sabado e todo domingo teria uma invasão, randomica entre todas as invasões

 

Tipo tem ferumbras,rat e cave rat

Sabada da um random entre esses 3, cai 1

Domingo a msm coisa

 

Link para o comentário
Compartilhar em outros sites

  • 0

 

coloca as raids que vc quer nos horários/dias que vc quer e aí vc faz o script ao invés de rodar aquela raid em questão ele rodar um aleatorio entre elas.

doExecuteRaid(raids[math.random(1, #raids)].name)

 

Acho que eu to fazendo certo...

Acho que já consegui fazer pra sair invasões aleatorias entre todas as invasões, agora me ajuda a fazer pras invasões acontecerem em horarios aleatorios?

 

Tipo a invasão acontece sabado, mas pode sair entre esses horarios

12:00, 14:00, 18:00,19:00,20:00,22:00,00:00,02:00

 

 

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

    local invasoes = {
      'Orshabaal',
      'Orshabaal',
      'Orshabaal'
    }

    local raids =
    {
        [1] =
        {
            type = 'weekly',
            days = {'sunday'},
            hour = 18,
            minu = 00
        },
        [2] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = 18,
            minu = 00
        }    
    }
    
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        if (raid.type == 'weekly') then
            local day = os.date("%A", static_time):lower()
            if isInArray(raid.days, day) then
                local hour = tonumber(os.date("%H", static_time))
                if (raid.hour == hour) then
                    local minute = tonumber(os.date("%M", static_time))
                    if (raid.minu == minute) then
                        local day_number = tonumber(os.date("%d", static_time))
                        if (last_execsutes[k] ~= day_number) then
                            last_execsutes[k] = day_number
                            executeRaid(invasoes[math.random(1, #invasoes)])
                        end
                    end
                end
            end
        end
    end
    return true
end
Editado por warriorfrog
Link para o comentário
Compartilhar em outros sites

  • 0

é só criar a raid cara...

 local raids =
    {
        [1] =
        {
            type = 'weekly',
            days = {'sunday'},
            hour = 18,
            minu = 00
        },
        [2] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = 18,
            minu = 00
        },
        [3] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = 14,
            minu = 00
        }        
    }

vai adicionando todos os dias e horários que vc quer...

Link para o comentário
Compartilhar em outros sites

  • 0

é só criar a raid cara...

 

 local raids =
    {
        [1] =
        {
            type = 'weekly',
            days = {'sunday'},
            hour = 18,
            minu = 00
        },
        [2] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = 18,
            minu = 00
        },
        [3] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = 14,
            minu = 00
        }        
    }

vai adicionando todos os dias e horários que vc quer...

 

Não cara, ele quer que a invasão do dia seja em horario randomico entre aqueles horarios lá

 

Link para o comentário
Compartilhar em outros sites

  • 0

toda vez que reiniciar o servidor ele vai definir um horário que vai ficar imutável até o sv reiniciar novamente, então sugiro fechar o sv ou dar um reload em globalevents a cada semana pra isso daqui ficar certinho:

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

    local invasoes = {
      'Orshabaal',
      'Orshabaal',
      'Orshabaal'
    }
	
	local hours = {12, 14, 18, 19, 20, 22, 00, 02}

    local raids =
    {
        [1] =
        {
            type = 'weekly',
            days = {'sunday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [2] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        }    
    }
    
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        if (raid.type == 'weekly') then
            local day = os.date("%A", static_time):lower()
            if isInArray(raid.days, day) then
                local hour = tonumber(os.date("%H", static_time))
                if (raid.hour == hour) then
                    local minute = tonumber(os.date("%M", static_time))
                    if (raid.minu == minute) then
                        local day_number = tonumber(os.date("%d", static_time))
                        if (last_execsutes[k] ~= day_number) then
                            last_execsutes[k] = day_number
                            executeRaid(invasoes[math.random(1, #invasoes)])
                        end
                    end
                end
            end
        end
    end
    return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

 

toda vez que reiniciar o servidor ele vai definir um horário que vai ficar imutável até o sv reiniciar novamente, então sugiro fechar o sv ou dar um reload em globalevents a cada semana pra isso daqui ficar certinho:

 

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

    local invasoes = {
      'Orshabaal',
      'Orshabaal',
      'Orshabaal'
    }
	
	local hours = {12, 14, 18, 19, 20, 22, 00, 02}

    local raids =
    {
        [1] =
        {
            type = 'weekly',
            days = {'sunday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [2] =
        {
            type = 'weekly',
            days = {'saturday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        }    
    }
    
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        if (raid.type == 'weekly') then
            local day = os.date("%A", static_time):lower()
            if isInArray(raid.days, day) then
                local hour = tonumber(os.date("%H", static_time))
                if (raid.hour == hour) then
                    local minute = tonumber(os.date("%M", static_time))
                    if (raid.minu == minute) then
                        local day_number = tonumber(os.date("%d", static_time))
                        if (last_execsutes[k] ~= day_number) then
                            last_execsutes[k] = day_number
                            executeRaid(invasoes[math.random(1, #invasoes)])
                        end
                    end
                end
            end
        end
    end
    return true
end

 

 

Obrigado

Desculpa a demora pra responder, estava sem net

 

Tentei aqui e não funcionou! Tem algo errado?

<globalevent name="randomentreraidfds" interval="50000" event="script" value="raid.lua"/>
--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

    local invasoes = {
      'Orshabaal',
      'Orshabaal',
      'Orshabaal'
    }
    
    local hours = {5, 5, 5}

    local raids =
    {
        [1] =
        {
            days = {'sunday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [2] =
        {
            days = {'friday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [3] =
        {
            days = {'saturday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        }
    }
    
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        local day = os.date("%A", static_time):lower()
        if isInArray(raid.days, day) then
            local hour = tonumber(os.date("%H", static_time))
            if (raid.hour == hour) then
                local minute = tonumber(os.date("%M", static_time))
                if (raid.minu == minute) then
                    local day_number = tonumber(os.date("%d", static_time))
                    if (last_execsutes[k] ~= day_number) then
                        last_execsutes[k] = day_number
                        executeRaid(invasoes[math.random(1, #invasoes)])
                    end
                end
            end
        end
    end
    return true
end

raid

<raid name="Orshabaal" file="scripts/Orshabaal.xml" interval2="45" margin="1800" enabled="yes"/>
<?xml version="1.0" encoding="utf-8"?>
<raid>
  <!--Announcements-->
  <announce delay="1000" type="Event" message="Orshabaal's minions are working on his return to the World. LEAVE Edron at once, mortals." />
  <announce delay="20000" type="Event" message="Orshabaal is about to make his way into the mortal realm. Run for your lives!" />
  <announce delay="60000" type="Event" message="Orshabaal has been summoned from hell to plague the lands of mortals once again." />
  <!--Single Spawns-->
  <singlespawn delay="60000" name="Orshabaal" x="368" y="1588" z="7" />
  <!--Area Spawns-->
</raid>
Editado por warriorfrog
Link para o comentário
Compartilhar em outros sites

  • 0

diminui esse interval pra

<globalevent name="randomentreraidfds" interval="1000" event="script" value="raid.lua"/>

 

e esse para

 

<raid name="Orshabaal" file="scripts/Orshabaal.xml" interval2="15" margin="1800" enabled="yes"/>

 

aí vc tenta usar /raid orshabaal.. Se der certo a gente sabe que a raid funciona. Aí vc precisa abrir o sv uns 10 minutos antes da hora que vc colocou lá. Se vc colocou 5 horas, então tenha ctza que 4:50 da manhã o sv vai estar aberto e espera até pelo menos 5:10 pra ver se ele executou ou não.

 

presta atenção nos dias configurados e lembra que a hora é aleatória, o script está correto;

 

 

 

--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

    local invasoes = {'Orshabaal'}    
    local hours = {5, 10}

    local raids =
    {
        [1] =
        {
            days = {'sunday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [2] =
        {
            days = {'friday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        },
        [3] =
        {
            days = {'saturday'},
            hour = hours[math.random(1, #hours)],
            minu = 00
        }
    }
    
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        local day = os.date("%A", static_time):lower()
        if isInArray(raid.days, day) then
            local hour = tonumber(os.date("%H", static_time))
            if (raid.hour == hour) then
                local minute = tonumber(os.date("%M", static_time))
                if (raid.minu == minute) then
                    local day_number = tonumber(os.date("%d", static_time))
                    if (last_execsutes[k] ~= day_number) then
                        last_execsutes[k] = day_number
                        executeRaid(invasoes[math.random(1, #invasoes)])
                    end
                end
            end
        end
    end
    return true
end

 

 

e não precisa me citar pra responder minhas perguntas, e lembra de usar [.spoiler] [./spoiler] sem os pontos pra garantir que o código fique minimizado, se não fica foda ficar lendo oque vc escreve.

 

 

Obrigado! Era estupidez minha mesmo, tá funcionando! Obrigado!

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...