It looks like you're new here. If you want to get involved, click one of these buttons!
Hello Everyone, I'm looking for the easiest way to add three megastructures equidistant apart, always 300,000,000 miles from the star. I could add them at the DB level, but they would not get the GUID assigned like the existing ones that I have added manually. Any thoughts out there?
Comments
Hello Ed, any thoughts on this one?
Maybe put them in the same orbit at 3 different points along the orbit (use time past periapsis for positioning along orbit)
That is what I have been doing. Problem is that it is very time-consuming to add each of these manually. That is adding three megastructures per star system with 2756 Stars currently on the map. Each addition also means calculating the past periapsis so that they are equidistant from each other. Yes, this works, but I was hoping to get this project done before I die of old age, and I am already in my 60's. :-p
Was just looking for a way to automate this process. I like automation. I'm lazy. :-)
You could certainly write a script for it to add them in bulk. To get them relatively equadistant take the orbital time and divide it by 3. ie, if its a 300 day orbital period, make one at 0, one at 100, and one at 200. But they are elliptical orbits so the exact distance would vary over time.
I'm working on a script for that now. I was planning on putting them in a perfectly circular orbit. They are artificial in nature, so why have an eliptical orbit? I am going to try and avoid thinking about gravitational perturbations, whether than are mutual or n-body types. Although that would be a fun mental exercise, it really would not add to the storyline I am trying to build. ;-)
Yep, just set the eccentricity to 0 and it will be circular. Let me know if you have any q's.
I wanted to keep it simple, so I tried to script this to just add one megastructure around each star, but I keep getting VBScript errors. Something is wrong with the way I am trying to add the child to the star. I'm not a big VBScript guy, so maybe someone out there can help me out. I will try to add my script here:
plugin Starlock Placement
author Steven R. Hoag
desc Puts a Starlock around every star in the sector.
' Set constants
Const BODY_TYPE_MEGASTRUCTURE = 28 ' Corresponds to the AlienAPI body type for megastructures
' Function to add a "Starlock Facility" around a star
Sub AddStarlockFacility(star)
' Create a new body (megastructure) as a child of the star
Dim megastructure
Set megastructure = star.AddChild(BODY_TYPE_MEGASTRUCTURE)
End Sub
' Main function to iterate over all stars in the sector and add a "Starlock Facility" to each
Sub Main
' Retrieve the current sector
Dim sector
Set sector = GetCurrentSector()
End Sub
' Execute the main function
Main
Sorry about the strange formatting. Should have pasted as plain text. Oops.
Try iterating systems like this
Use SystemCount() and GetSystem() to retrieve the systems. Then add your megastructure to each. Keep in mind if you have binaries, you'll have to decide what you want to do for those.
Okay, I've re-written and simplified the script, but I am still getting the dreaded Microsoft VBScript runtime error. I believe the issue is with creating the child body, but maybe I am wrong.
plugin Add Starlock to Non-Binary Systems
author Steven R. Hoag
desc Adds a Starlock Facility around each non-binary star system
Set sector = GetCurrentSector()
Dim sysCount
sysCount = sector.SystemCount
'Iterate through each system in the sector
For i = 1 To sysCount
Set starSystem = sector.GetSystem(i - 1)
Next
'Clear the update message
sector.RenderMessageBig = ""
RefreshScene
What's the error you're getting? Usually commenting out lines until the error goes away gets you the cause.
You can check if the BodyType is BODY_TYPE_MULT or BODY_TYPE_CLOSEMULT to detect if its a multiple. Actually what you might want to do is the other way around - only add the object if its BODY_TYPE_STAR.
After you create the body, you have to add it to the star using starsystem.AddChild( starlock)
"Microsoft VBScript runtime error"
Not particularly helpful or informative.
I will try your latest suggestions and let you know if I get any further along. It may be a day or two as things at work are really busy.