Here u can find lua file:
https://onedrive.live.com/redir?resid=D ... 900F%21181
or if u prefer here is the script:
Code: Select all
-- set timerInterval to 0.1 or 1
siAccendono = {} -- keep in memory if fireflies have to turno on or off
inizioAttesa = {} -- keep in memory when they last changed
function lucciole()
-- settings
local tempoInizio = 1.02 -- starting time of the day fireflies start turning on
local tempoFine = 1.98 -- end time of fireflies dance
local luminositaMassima = 8 -- max brightness, default is 4
-- edn of settings
local oraDelGiorno = GameMode.getTimeOfDay()
-- night
if oraDelGiorno >= tempoInizio and oraDelGiorno < tempoFine then
local contatoreSciami = 1 -- these two lines can find
local sciame = findEntity("forest_fireflies_" .. contatoreSciami) -- all fireflies in game
while sciame ~= nil do
local randomLuce = (math.random()*5)+1 -- random light changing time
local randomParticelle = (math.random()*5)+5 -- random particle/fireflies changing time
if sciame.light ~= nil then
if siAccendono[contatoreSciami] == true then
if Time.currentTime() > inizioAttesa[contatoreSciami] + math.max(randomLuce,randomParticelle) then -- higher time (after ">") higher turn off time
local nuovaLuminosita = math.random()*luminositaMassima -- random brightness
local coloreRandom = math.random(1,3) -- chose a color between 3
inizioAttesa[contatoreSciami] = Time.currentTime() -- starting turning on
sciame.light:setBrightness(nuovaLuminosita)
-- sciame.light:setColor(vec(math.random(),math.random(),math.random())) -- christmas tree effect
if coloreRandom == 1 then
sciame.light:setColor(vec(0.2, 0.75, 0.5, 0))
elseif coloreRandom == 2 then
sciame.light:setColor(vec(0.2, 0.7, 0.6, 0))
elseif coloreRandom == 3 then
sciame.light:setColor(vec(0.1, 0.5, 0.3, 0))
-- elseif coloreRandom == 4 then -- if u want add some colors remember to change nunber in "coloreRandom" (just before this "if")
-- sciame.light:setColor(vec(0.3, 1, 0.75, 0))
end
sciame.light:fadeIn(randomLuce)
sciame.particle:fadeIn(randomParticelle)
siAccendono[contatoreSciami] = false
else
end
elseif siAccendono[contatoreSciami] == false then
if Time.currentTime() > inizioAttesa[contatoreSciami] + math.max(randomLuce,randomParticelle) then -- higher time (after ">") higher lighted up time, still brightness differences can look like some fireflies turned off
inizioAttesa[contatoreSciami] = Time.currentTime() -- starting turninf off
sciame.light:fadeOut(randomLuce)
sciame.particle:fadeOut(randomParticelle)
siAccendono[contatoreSciami] = true
else
end
elseif siAccendono[contatoreSciami] == nil then -- starting cicle at night start (tempoInizio you chosed at beginning of script)
inizioAttesa[contatoreSciami] = Time.currentTime()
local caso = math.random(0,1)
if caso == 0 then
sciame.light:fadeOut(randomLuce)
sciame.particle:fadeOut(randomParticelle)
siAccendono[contatoreSciami] = true
elseif caso == 1 then
sciame.light:fadeIn(randomLuce)
sciame.particle:fadeIn(randomParticelle)
siAccendono[contatoreSciami] = false
else
end
end
else
end
contatoreSciami = contatoreSciami + 1
sciame = findEntity("forest_fireflies_" .. contatoreSciami)
end
else
-- day
local contatoreSciami = 1
local sciame = findEntity("forest_fireflies_" .. contatoreSciami)
while sciame ~= nil do
if sciame.light ~= nil then
local randomLuce = (math.random()*10)+1
local randomParticelle = (math.random()*10)+10
sciame.light:fadeOut(randomLuce)
sciame.particle:fadeOut(randomParticelle)
siAccendono[contatoreSciami] = nil
else
end
contatoreSciami = contatoreSciami + 1
sciame = findEntity("forest_fireflies_" .. contatoreSciami)
end
end
end BTW anyone knows what is 4th value in color vec for? default is 0 and changing seems having no effects