|
If you are going to use it, GIVE CREDIT
Variables affect DIRECTLY formation of the galaxy. They are self-explanatory.
--------------------------------------------------------------------------------
_G.starSize = {4, 4, 5, 5, 5, 5, 6, 6, 7}
_G.GalaxyCenter = Vector3.new(0, 257, 0)
_G.StarColors = {"Bright yellow", "Bright orange", "Bright red", "Medium blue"}
_G.PlanetN = 0
allowStarPainting = false
galaxyArmsQuantity = 7
galaxyArms = {}
galaxyArms_AngleGrow = 10
galaxyArms_RadiusGrow = 16
galaxyArms_DefaultRadius = 50
galaxyArms_GrowingTimes = 10
galaxyArms_RandomizationFactor = 130
galaxyArms_Density = 8
galaxyArms_Inclination = 2
lostStars = {}
lostStars_Quantity = 80
lostStars_minXvalue = -252
lostStars_maxXvalue = 252
lostStars_minYvalue = 7.9
lostStars_maxYvalue = 507
lostStars_minZvalue = -252
lostStars_maxZvalue = 252
misc = {}
misc_Proportion = 1
celestialBodies = {}
local base = Instance.new("Part")
base.Shape = "Ball"
base.Anchored = true
celestialBodies_GalaxyCenter = Vector3.new(-134, 49.4, -71)
celestialBodies_DefaultStar = base
for x=1, galaxyArmsQuantity do
galaxyArms[#galaxyArms + 1] = ( 360 / ( galaxyArmsQuantity ) ) * x
print(galaxyArms[#galaxyArms])
end
function createLostSystem()
local mainStar = celestialBodies_DefaultStar:clone()
local x = math.random(lostStars_minXvalue, lostStars_maxXvalue) * misc_Proportion
local y = math.random(lostStars_minYvalue, lostStars_maxYvalue) * misc_Proportion
local z = math.random(lostStars_minZvalue, lostStars_maxZvalue) * misc_Proportion
local starSizeFactor = starSize[math.random(1, #starSize)] * misc_Proportion
mainStar.Position = Vector3.new(x, y, z)
mainStar.Size = Vector3.new(starSizeFactor, starSizeFactor, starSizeFactor)
mainStar.Parent = game.Workspace
local starNumber = #celestialBodies + 1
celestialBodies[starNumber] = {}
celestialBodies[starNumber][1] = mainStar
end
function createSystem(radius, angle)
local mainStar = celestialBodies_DefaultStar:clone()
local x = math.sin(math.rad(angle)) * radius * misc_Proportion
local y = ( (math.sin(math.rad(angle)) * radius) / ( 10 / galaxyArms_Inclination ) ) * misc_Proportion
local z = math.cos(math.rad(angle)) * radius * misc_Proportion
local starSizeFactor = starSize[math.random(1, #starSize)] * misc_Proportion
mainStar.Position = Vector3.new(x, y, z) + GalaxyCenter + ( Vector3.new(math.random(-galaxyArms_RandomizationFactor, galaxyArms_RandomizationFactor) / 10, math.random(-galaxyArms_RandomizationFactor, galaxyArms_RandomizationFactor) / 10, math.random(-galaxyArms_RandomizationFactor, galaxyArms_RandomizationFactor) / 10) ) * misc_Proportion
mainStar.Size = Vector3.new(starSizeFactor, starSizeFactor, starSizeFactor)
mainStar.Parent = game.Workspace
if allowStarPainting == true then mainStar.BrickColor = BrickColor.new(StarColors[math.random(1, #StarColors)]) else mainStar.BrickColor = BrickColor.new("White") end
local starNumber = #celestialBodies + 1
celestialBodies[starNumber] = {}
celestialBodies[starNumber][1] = mainStar
local planetNumber = math.random(0, starSizeFactor)
if planetNumber == 0 then return end
for x=1, planetNumber do
local planetNumber = x + 1
celestialBodies[starNumber][planetNumber] = {}
end
end
function createGalaxy()
for i=1, galaxyArms_Density do
for a=1, #galaxyArms do
for b=1, galaxyArms_GrowingTimes do
createSystem(galaxyArms_DefaultRadius + ( ( galaxyArms_RadiusGrow - 1 ) * b ), galaxyArms[a] + ( galaxyArms_AngleGrow * b ) )
end
end
end
for x=1, lostStars_Quantity do
createLostSystem()
end
print(#celestialBodies)
end
createGalaxy() |
|
|
bob10110Join Date: 2007-12-09 Post Count: 679 |
The script by itself doesn't do it justice. There needs to be a picture alongside it, or people won't know that this is a pretty awesome script.
In any case, good work. |
|
|
pepsi345Join Date: 2007-08-07 Post Count: 2774 |
Nice... Can we change the ArmsQuantity? Or anything else for different effects? |
|
abc10101Join Date: 2008-06-18 Post Count: 52 |
You need to be a good scripter to edit this good
Thanks btw |
|
cymru72Join Date: 2008-01-26 Post Count: 4362 |
Not bad |
|
kailleJoin Date: 2008-09-16 Post Count: 356 |
Good scripting |
|
|
Variables explanation:
_G.starSize = {4, 4, 5, 5, 5, 5, 6, 6, 7}
-- The script will choose one of those sizes for each star.
_G.GalaxyCenter = Vector3.new(0, 257, 0)
-- This is the position of the center of the galaxy
_G.StarColors = {"Bright yellow", "Bright orange", "Bright red", "Medium blue"}
-- If allowStarPainting is true, the script will choose one of those colors randomly to color stars
_G.PlanetN = 0
-- Do not edit this
allowStarPainting = false
-- If true, will paint starts randomly with colors defined in StarColors variable
galaxyArmsQuantity = 7
-- The number of arms of the galaxy.
galaxyArms = {}
-- Do not change this
galaxyArms_AngleGrow = 10
galaxyArms_RadiusGrow = 16
galaxyArms_DefaultRadius = 50
galaxyArms_GrowingTimes = 10
galaxyArms_RandomizationFactor = 130
-- The higher the number here is, the more randomizated position of stars will be
galaxyArms_Density = 8
-- The density of the arms
galaxyArms_Inclination = 2
-- The inclination of the galaxy
lostStars = {}
lostStars_Quantity = 80
-- The number of the stars not located in galaxy.
lostStars_minXvalue = -252
lostStars_maxXvalue = 252
lostStars_minYvalue = 7.9
lostStars_maxYvalue = 507
lostStars_minZvalue = -252
lostStars_maxZvalue = 252
|
|
kailleJoin Date: 2008-09-16 Post Count: 356 |
Thats a lot of writing |
|
|
One question... _G.[variable]? What does _G do? |
|
kailleJoin Date: 2008-09-16 Post Count: 356 |
I dunno?!?!?!?!?!?! |
|
|
Darian479Join Date: 2008-05-11 Post Count: 28 |
thats cool |
|
HobbezJoin Date: 2008-12-06 Post Count: 4842 |
This will look great for a look at Enigmis Galaxy outside :D Thanks |
|
kailleJoin Date: 2008-09-16 Post Count: 356 |
True lol! |
|
LPGhatguyForum ModeratorJoin Date: 2008-06-27 Post Count: 4725 |
Pretty cool. I'm more of a hard-core, scripter, make coroutine imploits kind of scripter... Not the kind who uses trig to make galaxy patterns. Lol. |
|
SnateraarJoin Date: 2008-04-15 Post Count: 3901 |
That is actually very nice. |
|
osieJoin Date: 2008-11-12 Post Count: 130 |
nicely made and very...good for ship battle places and also just for showing off it can be turned into anything all you need is knowledge on scripting and imagination to turn this into anything...even candy galaxy!(lol its just a very fast thought) |
|
poppip40Join Date: 2008-09-11 Post Count: 234 |
WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT! |
|
Legend26Join Date: 2008-09-08 Post Count: 10586 |
Nice |
|
|
So many Variables!
Nice job! |
|
Tj3Join Date: 2008-03-12 Post Count: 677 |
Very impressive... Tho im a pretty good scripter, I couldnt make a script to generate a galaxy! |
|
Bobino12Join Date: 2008-11-02 Post Count: 21 |
I agree this thing is pointless without a mesh... wait... i forgot to check to see if it lonks to a mesh. |
|
Samblue13Join Date: 2008-12-08 Post Count: 14 |
Does anyone play Spore? I bet if we all were to work together we could turn it into a SporeBlox game! |
|