initial_color = {r=100, g=0, b=250, bv=10, rv=7, gv=3} colors = {} function change_color_component(c, variance) c = c + variance if c > 255 then c = 255 variance = -variance elseif c < 0 then c = 0 variance = -variance end return c, variance end function process_node_color(n) local color color = colors[n] or initial_color color.r, color.rv = change_color_component(color.r, color.rv) color.g, color.gv = change_color_component(color.g, color.gv) color.b, color.bv = change_color_component(color.b, color.bv) colors[n] = color SetColor(n, color) end function process_node_pos(n) local pos pos = GetOriginalPosition(n) pos.x = pos.x + math.random(3) - 1 pos.y = pos.y + math.random(3) - 1 pos.z = pos.z + math.random(3) - 1 SetPosition(n, pos) end function process_node(n) process_node_color(n) process_node_pos(n) end