periodicthreats.lua
1234567891011
-- WORM ATTACKS --
local worm_waittime = function(data)
--The older the world, the more often the attacks.
--Day 100+ gives the most often.
local clock = GetWorld().components.clock
local days = math.random(10)
if clock then
days = Lerp(10, 3, clock:GetNumCycles()/100)
days = math.min(days, 10)
days = math.max(days, 3)
end
1234567891011
-- WORM ATTACKS --
local worm_waittime = function(data)
--The older the world, the more often the attacks.
--Day 150+ gives the most often.
local clock = GetWorld().components.clock
local days = math.random(10)
if clock then
days = Lerp(12, 5, clock:GetNumCycles()/150)
days = math.min(days, 10)
days = math.max(days, 3)
end
17181920212223
local time = math.random(15, 40)
local clock = GetWorld().components.clock
if clock then
time = Lerp(40, 15, clock:GetNumCycles()/100)
time = math.min(time, 40)
time = math.max(time, 15)
end
17181920212223
local time = math.random(15, 40)
local clock = GetWorld().components.clock
if clock then
time = Lerp(40, 15, clock:GetNumCycles()/150)
time = math.min(time, 40)
time = math.max(time, 15)
end
4445464748495051525354
local worm_numtospawn = function(data)
--The older the world, the more that spawn. (2-6)
--Day 100+ do max
local clock = GetWorld().components.clock
local num = math.random(2,6)
if clock then
num = Lerp(2, 6, clock:GetNumCycles()/100)
num = math.min(num, 6)
num = math.max(num, 2)
end
4445464748495051525354
local worm_numtospawn = function(data)
--The older the world, the more that spawn. (2-6)
--Day 150+ do max
local clock = GetWorld().components.clock
local num = math.random(2,6)
if clock then
num = Lerp(2, 6, clock:GetNumCycles()/150)
num = math.min(num, 6)
num = math.max(num, 2)
end