• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Invasion 1 week

maikons

Member
Joined
Aug 1, 2015
Messages
227
Reaction score
16
How to make 2 invasions per week (sunday and saturday)
Random raid and Random TIME

How to make it in random time to day


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

raids.lua
Code:
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


raids.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<raids>
   <singlespawn name="Orshabaal" delay="0" message="Raid: Orshabaal" x="368" y="1588" z="7">
</raids>
 
Last edited:
<singlespawn delay="604800000" name="Cave Rat" ref="yes" x="95" y="117" z="7"/>


604800000 = 1 weed in mil...

Its right to put on raids?

But my server have full save and maybe it can down!!! It's not work i think :(

How to make 1 week even server down
No.. this is not the way to handle something like this.. this should be done in a script.. so take this thread to requests..
 
I would use a global event and check the week day with os.date("*t").
Code:
<globalevent name="Invasion" time="09:00:00" script="invasion.lua" />
If you want to randomize the time you can use addEvent in the script to delay the start.
Code:
local now = os.date("*t")
if now.wday == 2 then -- if today is monday (wday can be 1-7 and starts with Sunday as 1)
    addEvent(startInvasionFunction, delayInMS)
end
 
I would use a global event and check the week day with os.date("*t").
Code:
<globalevent name="Invasion" time="09:00:00" script="invasion.lua" />
If you want to randomize the time you can use addEvent in the script to delay the start.
Code:
local now = os.date("*t")
if now.wday == 2 then -- if today is monday (wday can be 1-7 and starts with Sunday as 1)
    addEvent(startInvasionFunction, delayInMS)
end

I will use it too

Its \/
Code:
if now.wday == 7 or now.wday == 1 then
Saturday and Sunday?
 
I told you. Read the code.
Im so sorry, im so dumb

What did I do wrong?

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

raids.lua
Code:
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


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