Page 1 of 2
Saving At Stations
Posted: Sat Oct 21, 2023 2:08 pm
by Killer Wolf
Why can i not F2/save at my new model? it's a test spawn, has a test role and "station" in the roles, and has the standard station AI.
as a side topic, is there no way so stopping this stupid size-related top of a radar stalk? the trace for my new model literally fills the scanner.
TIA
Re: Saving At Stations
Posted: Sat Oct 21, 2023 8:38 pm
by Cholmondely
I'm no expert but since nobody else has replied yet, my understanding from these boards is that one can save at any station which is defined as such and which is not moving.
Re: Saving At Stations
Posted: Sat Oct 21, 2023 8:52 pm
by hiran
Cholmondely wrote: ↑Sat Oct 21, 2023 8:38 pm
I'm no expert but since nobody else has replied yet, my understanding from these boards is that one can save at any station which is defined as such and which is not moving.
Then rock hermits seem to be stations, while Galactic Navy's Galcop stations are not.
Re: Saving At Stations
Posted: Sat Oct 21, 2023 9:08 pm
by phkb
In order to save at a station, the game engine needs to know that the station will be spawned at the same location every time, during system population. So, creating the station during shipWillLaunchFromStation, or shipWillExitWitchspace, is far too late in the process.
This routine should work:
Code: Select all
this.systemWillPopulate = function() {
// here we establish the position of the station. this needs to be the same every time the system is populated
// you can use the system.pseudoRandomNumber property to add "randomness" to the location if you want
// in this instance, we're just going to use the main station position, and put our station 5000m directly in front of it.
var stationPos = system.mainStation.position.add(system.mainStation.vectorForward.multiply(5000));
// next, we use the system.setPopulator to create the actual station using a callback
// "create_my_station" is a text string that uniquely identifies this populator function
system.setPopulator("create_my_station", {
callback: function(pos) {
system.addShips("my_station_key", 1, pos, 0); // the "0" parameter at the end is important
},
location:"COORDINATES",
coordinates:stationPos,
deterministic:true // < this is important
});
}
"deterministic:true" is the key to allowing you to save at your station. And the "0" parameter is important, because the "addShips" function will not add any random distance to the position when spawned. It will be at the exact coordinates you specify.
As for the issue with your scanner, what zoom setting do you have? if it's currently 1:1, and the station is still filling the scanner, that would indicate the station is *huge*.
Re: Saving At Stations
Posted: Sat Oct 21, 2023 9:28 pm
by Cholmondely
hiran wrote: ↑Sat Oct 21, 2023 8:52 pm
Cholmondely wrote: ↑Sat Oct 21, 2023 8:38 pm
I'm no expert but since nobody else has replied yet, my understanding from these boards is that one can save at any station which is defined as such and which is not moving.
Then rock hermits seem to be stations, while Galactic Navy's Galcop stations are not.
They are old and date back to the days when saving anywhere outside a main GalCop orbital was impossible. Maybe they move slowly?
Re: Saving At Stations
Posted: Sat Oct 21, 2023 9:41 pm
by phkb
GN’s stations were created before there was even an option of saving at stations in the core game. And no one has gone back to tweak the code to implement the required changes.
Re: Saving At Stations
Posted: Sat Oct 21, 2023 10:37 pm
by hiran
phkb wrote: ↑Sat Oct 21, 2023 9:41 pm
GN’s stations were created before there was even an option of saving at stations in the core game. And no one has gone back to tweak the code to implement the required changes.
There was a time where you could not save the game at stations? But what I see is that you can just save in stations.
Where did one save the game those days?
Re: Saving At Stations
Posted: Sat Oct 21, 2023 10:42 pm
by Cody
I think he means at non-main stations (eg rock hermits). A contrabandista's delight, was saving at rock hermits!
Re: Saving At Stations
Posted: Sat Oct 21, 2023 11:04 pm
by phkb
Sorry, yes. I meant OXP stations
Re: Saving At Stations
Posted: Sun Oct 22, 2023 6:17 am
by hiran
phkb wrote: ↑Sat Oct 21, 2023 9:41 pm
GN’s stations were created before there was even an option of saving at stations in the core game. And no one has gone back to tweak the code to implement the required changes.
phkb wrote: ↑Sat Oct 21, 2023 11:04 pm
Sorry, yes. I meant OXP stations
Maybe it is not too bad going back to change something. I assume the necessary tweak is more or less to set a flag, right?
If we knew where/which OXPs define a station it would be a limited list of items to check.
And with OoliteAddonScanner I can run such stunts to produce a list - if only I knew what to look for.
Re: Saving At Stations
Posted: Sun Oct 22, 2023 6:23 am
by phkb
hiran wrote: ↑Sun Oct 22, 2023 6:17 am
Maybe it is not too bad going back to change something. I assume the necessary tweak is more or less to set a flag, right?
If we knew where/which OXPs define a station it would be a limited list of items to check.
Usually it's a bit more than just changing a flag. Having just done Cataclysm, the work involved in changing how the stations are spawned requires extracting them from the original logic, creating a new routine (systemWillPopulate), with a new spawning mechansm (system.setPopulator), and then making sure the logic of the original has been transferred into the new routine correctly. It's definitely a one station at a time thing.
Re: Saving At Stations
Posted: Sun Oct 22, 2023 3:00 pm
by Killer Wolf
Thanks for the replies, no biggie at the mo, but when i i come to test properly i'll try @phkb's code snippet [cheers bud] as the station is supposed to be a feature of a particular place.
Re: Saving At Stations
Posted: Sun Oct 22, 2023 3:07 pm
by Killer Wolf
phkb wrote: ↑Sat Oct 21, 2023 9:08 pm
As for the issue with your scanner, what zoom setting do you have? if it's currently 1:1, and the station is still filling the scanner, that would indicate the station is *huge*.
Re: Saving At Stations
Posted: Sun Oct 22, 2023 7:41 pm
by phkb
Ah!
That’s no moon. It’s a space station.
Re: Saving At Stations
Posted: Thu Nov 23, 2023 11:38 am
by Killer Wolf
phkb wrote: ↑Sat Oct 21, 2023 9:08 pm
In order to save at a station, the game engine needs to know that the station will be spawned at the same location every time, during system population. So, creating the station during shipWillLaunchFromStation, or shipWillExitWitchspace, is far too late in the process.
This routine should work:
Code: Select all
this.systemWillPopulate = function() {
// here we establish the position of the station. this needs to be the same every time the system is populated
// you can use the system.pseudoRandomNumber property to add "randomness" to the location if you want
// in this instance, we're just going to use the main station position, and put our station 5000m directly in front of it.
var stationPos = system.mainStation.position.add(system.mainStation.vectorForward.multiply(5000));
// next, we use the system.setPopulator to create the actual station using a callback
// "create_my_station" is a text string that uniquely identifies this populator function
system.setPopulator("create_my_station", {
callback: function(pos) {
system.addShips("my_station_key", 1, pos, 0); // the "0" parameter at the end is important
},
location:"COORDINATES",
coordinates:stationPos,
deterministic:true // < this is important
});
}
"deterministic:true" is the key to allowing you to save at your station. And the "0" parameter is important, because the "addShips" function will not add any random distance to the position when spawned. It will be at the exact coordinates you specify.
As for the issue with your scanner, what zoom setting do you have? if it's currently 1:1, and the station is still filling the scanner, that would indicate the station is *huge*.
i managed [it seems] to get my system-specific spawn working by using planetinfo.plist, which is
Code: Select all
{
"0 129" = {
"script_actions" = (
"checkForShips: KWii",
{
conditions = ("shipsFound_number lessthan 1");
do = ( "addSystemShips: KWii 1 1.0" );
}
);
}
}
but again it won't let me save. will i be able to stick the above code into the "do" bit of the planetinfo?
TIA