Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

System Redux v 1.2 bug..

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

System Redux v 1.2 bug..

Post by Frame »

I allready Pmed the author

system redux has a bug that will generate extra planets/moons each time you undock, while not having made a Withcspace jump.

The bug is proportional to the number of planets/moons generated in a system

if you for example jump into Lave, it generates 4 extra planets/moons for each time you Launch from something... so if you happen to stop by 3 rock hermits in LAVE, then after you launched from the third Rock hermit, then there is now... 4*4 + main planet = 17 planets/moons in the system..

However the posistion of these planets are identical to the ones generated when you jumped/launched for the first time into/in lave...

Therefore it is not something you catch visually.. i Catched it while a script of mine read out the number of planets in a system, at first i was a bit confused as i couldnt find those extra planets...

Then i flew near to a moon, and it started flicker its textures... as an experienced modeler i could tell, that there was two identical planets on the same spot.. Then my before mentioned read out from the script made sense.

I also provide a fix for this, for those abeld to edit the system redux Script
locate these two functions.. in script.js found in the config directory..

Code: Select all

this.shipWillLaunchFromStation  =  function()
{
	this.populate();	
}

this.shipWillExitWitchspace = function()
{	
	this.populate();

}
Replace all that with this

Code: Select all

this.shipWillLaunchFromStation  =  function()
{
	if(!this.uswitch)
	{
		this.populate();
		this.uswitch = true;
	}
	
}

this.shipWillExitWitchspace = function()
{
	
		this.populate();
		this.uswitch = true;	//set to true since we do not want to populate again before next witchspace exit
}
On a side note, i´m not even sure you need that populator in the this.shipWillLaunchFromStation function, IMO it should be done at startup instead, that will only ever run once for each time the game is started and the player is allways in a station. and it would save some CPU time when you launch from a station...

strike that because of this

Code: Select all


Exception: Error: Planet.setTexture must be called only during shipWillLaunchFromStation or shipWillExitWitchspace.

Bounty Scanner
Number 935
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: System Redux v 1.2 bug..

Post by Eric Walch »

Frame wrote:
strike that because of this

Code: Select all


Exception: Error: Planet.setTexture must be called only during shipWillLaunchFromStation or shipWillExitWitchspace.

There is also an other reason. (Very much related of cause)

this.startUp would be way to soon. It runs before you get the choice to reload a saved game. And it does not run when you load a saved game.

Better would be this.reset. That runs after every loaded game. With 1.71 the mission variables are already read in at this point, but the system is still not set up at this point. I tried to add ship's at this point but it didn't work. Still to early!

Alternative to your code you can also set a special variable at reset time:

Code: Select all

this.startUp = this.reset = function()
{
    this.mustPopulate = true;
}

this.shipLaunchedFromStation = function()
{
   if(this.mustPopulate) {this.setUpShips(); this.mustPopulate = false};
}

this.shipExitedWitchspace = function()
{
    if(!system.isInterstellarSpace) this.setUpShips();
}
And setUpShips() does the actual adding of ships (or planets)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: System Redux v 1.2 bug..

Post by JensAyton »

Eric Walch wrote:
Better would be this.reset. That runs after every loaded game. With 1.71 the mission variables are already read in at this point, but the system is still not set up at this point. I tried to add ship's at this point but it didn't work. Still to early!
I haven’t tested this, but if you set up a one-shot timer with a delay of 0, it should fire in the next frame:

Code: Select all

new Timer(this, this.doSomething, 0);
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: System Redux v 1.2 bug..

Post by Eric Walch »

Ahruman wrote:
I haven’t tested this, but if you set up a one-shot timer with a delay of 0, it should fire in the next frame:

Code: Select all

new Timer(this, this.doSomething, 0);
A good idea. I added something similar to Frame's Rock Hermit Locator. There the buoys are added with a one-shot timer to be sure it is activated after all other oxp's added their Rock Hermits and/or pirate coves on a wichspace jump.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

i jsut discoverd a bug i introduced if people added my bugfix...

the 2nd time you load a commander, the system will not add the extra moons and planets, and set the new texture when the player ship launches, and wont do so, until the player enters a new system...

solution is here...

add this to the end of the script...

Code: Select all

this.reset =  function()
{
	this.uswitch = false;
}
Bounty Scanner
Number 935
Post Reply