06-22-2012, 05:40 PM
Not a very big or difficult script; I just made this for Script Builder. Basically, it smoothly shifts the color of the game's Terrain randomly.
[lua]
local redamount = 1
local blueamount = 1
local greenamount = 1
while true do
sleep(0.1)
redamount = redamount + math.random(-1, 1)
if redamount > 8 or redamount < -8 or game.Terrain.Color.r + redamount > 255 or game.Terrain.Color.r + redamount < 0 then
redamount = 0
end
blueamount = blueamount + math.random(-1, 1)
if blueamount > 8 or blueamount < -8 or game.Terrain.Color.b + blueamount > 255 or game.Terrain.Color.b + blueamount < 0 then
blueamount = 0
end
greenamount = greenamount + math.random(-1, 1)
if greenamount > 8 or greenamount < -8 or game.Terrain.Color.g + greenamount > 255 or game.Terrain.Color.g + greenamount < 0 then
greenamount = 0
end
game.Terrain.Color = Color(game.Terrain.Color.r + redamount, game.Terrain.Color.g + greenamount, game.Terrain.Color.b + blueamount)
end
[/lua]
[lua]
local redamount = 1
local blueamount = 1
local greenamount = 1
while true do
sleep(0.1)
redamount = redamount + math.random(-1, 1)
if redamount > 8 or redamount < -8 or game.Terrain.Color.r + redamount > 255 or game.Terrain.Color.r + redamount < 0 then
redamount = 0
end
blueamount = blueamount + math.random(-1, 1)
if blueamount > 8 or blueamount < -8 or game.Terrain.Color.b + blueamount > 255 or game.Terrain.Color.b + blueamount < 0 then
blueamount = 0
end
greenamount = greenamount + math.random(-1, 1)
if greenamount > 8 or greenamount < -8 or game.Terrain.Color.g + greenamount > 255 or game.Terrain.Color.g + greenamount < 0 then
greenamount = 0
end
game.Terrain.Color = Color(game.Terrain.Color.r + redamount, game.Terrain.Color.g + greenamount, game.Terrain.Color.b + blueamount)
end
[/lua]