of     2   
chevron_rightchevron_rightchevron_right

SirGelatina
#4648961Tuesday, December 30, 2008 1:55 PM GMT

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()
SirGelatina
#4667939Wednesday, December 31, 2008 2:10 AM GMT

Nobody? T_T
bob10110
#4670435Wednesday, December 31, 2008 3:40 AM GMT

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.
SirGelatina
#4671470Wednesday, December 31, 2008 4:30 AM GMT

http://www.roblox.com/Item.aspx?ID=5860955 Check it to see the result.
pepsi345
#4792878Sunday, January 04, 2009 9:41 AM GMT

Nice... Can we change the ArmsQuantity? Or anything else for different effects?
abc10101
#4915193Saturday, January 10, 2009 7:47 PM GMT

You need to be a good scripter to edit this good Thanks btw
cymru72
#4915549Saturday, January 10, 2009 7:59 PM GMT

Not bad
kaille
#4916451Saturday, January 10, 2009 8:38 PM GMT

Good scripting
SirGelatina
#4923407Sunday, January 11, 2009 1:26 AM GMT

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
kaille
#4958081Monday, January 12, 2009 7:33 PM GMT

Thats a lot of writing
Ironclaw33
#6394936Saturday, March 14, 2009 7:39 PM GMT

One question... _G.[variable]? What does _G do?
kaille
#6704577Monday, March 23, 2009 7:52 PM GMT

I dunno?!?!?!?!?!?!
BlueTaslem
#7970850Monday, April 27, 2009 10:05 PM GMT

Hooplah!
Darian479
#7972518Monday, April 27, 2009 10:35 PM GMT

thats cool
Hobbez
#7972847Monday, April 27, 2009 10:41 PM GMT

This will look great for a look at Enigmis Galaxy outside :D Thanks
kaille
#8387220Sunday, May 10, 2009 12:37 AM GMT

True lol!
LPGhatguy
Forum Moderator
#9050680Saturday, May 30, 2009 3:47 AM GMT

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.
Snateraar
#9054810Saturday, May 30, 2009 6:46 AM GMT

That is actually very nice.
osie
#9686526Monday, June 15, 2009 2:50 PM GMT

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)
poppip40
#10339113Monday, June 29, 2009 12:15 PM GMT

WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT!
Legend26
#13579716Sunday, August 30, 2009 12:59 AM GMT

Nice
harrycat18
#13584142Sunday, August 30, 2009 2:07 AM GMT

So many Variables! Nice job!
Tj3
#14003115Tuesday, September 08, 2009 8:14 PM GMT

Very impressive... Tho im a pretty good scripter, I couldnt make a script to generate a galaxy!
Bobino12
#16128691Sunday, November 01, 2009 2:05 PM GMT

I agree this thing is pointless without a mesh... wait... i forgot to check to see if it lonks to a mesh.
Samblue13
#16944322Sunday, November 22, 2009 4:40 PM GMT

Does anyone play Spore? I bet if we all were to work together we could turn it into a SporeBlox game!

    of     2   
chevron_rightchevron_rightchevron_right