Tinkerer's Workshop - OXP tweaking for fun and profit!

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

Moderators: another_commander, winston

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Diziet Sma »

CaptSolo wrote:
HyperRadio 1.26:
Reason for tweak: Did not like podMusic quiting with condition Red Alert (i.e. I like radio blasting during battle).
I like this idea! 8)
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Twisp
Above Average
Above Average
Posts: 21
Joined: Sat Mar 16, 2013 4:18 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Twisp »

This going to seem like a kind of odd request, but does anyone here know how I'd go about making a modification to how stations spawn in Stations for Extra Planets OXP? I'm trying to stick to a more-or-less vanilla artstyle, and need something to make those systems more interesting besides RRS stations and the occasional HoOpy Casino. Some of the stations work nicely for this, and I've already got the OXP working without system restrictions, only spawning globe stations and habitats. However, I'm overall pretty bad at js, and I have no idea where I'd add an appropriate TL and or system government-related if-statement in the populator script to actually make it affect where things spawn, instead of just breaking things.

I've tried looking at other station oxp populator scripts but it seems like Stations for Extra Planets works in a much more complex way, which I guess isn't a surprise. Any ideas?
Conducting a deepspace mining operation out in Orrira. Thanking various dieties for the existence of cargo shepherds. Flying the rugged Python Prospector Errant.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by spara »

Twisp wrote:
This going to seem like a kind of odd request, but does anyone here know how I'd go about making a modification to how stations spawn in Stations for Extra Planets OXP? I'm trying to stick to a more-or-less vanilla artstyle, and need something to make those systems more interesting besides RRS stations and the occasional HoOpy Casino. Some of the stations work nicely for this, and I've already got the OXP working without system restrictions, only spawning globe stations and habitats. However, I'm overall pretty bad at js, and I have no idea where I'd add an appropriate TL and or system government-related if-statement in the populator script to actually make it affect where things spawn, instead of just breaking things.

I've tried looking at other station oxp populator scripts but it seems like Stations for Extra Planets works in a much more complex way, which I guess isn't a surprise. Any ideas?
The script has three groups of stations: this.$corStations, this.$dodStations and this.$icoStations. When techLevel < 11, stations from this.$corStations get spawned. Otherwise stations from all groups get spawned. This roughly follows the population rules of the core game. If I have understood your request correctly, you want to group the stations into TL dependent groups and draw from those groups. If that's the case and you need more than three groups, you need to define more groups the same way the groups are already defined and then edit the ifs starting from line 54:

Code: Select all

	if (system.techLevel < 11)
		var stations = this.$corStations.concat();
	else 
		var stations = this.$corStations.concat(this.$dodStations, this.$icoStations);
For example to alter the population of the defined three groups you could do something like this:

Code: Select all

	if (system.techLevel < 5)
		var stations = this.$corStations.concat();
	else if (system.techLevel < 10)
		var stations = this.$dodStations.concat();
	else 
		var stations = this.$icoStations.concat();
That would use stations in the first group when techLevel <5 and the second group when 5<=techLevel<10 and the third group when techLevel >=10.

Note also that system.techLevel differs from TL shown in the game by one :wink:
User avatar
Twisp
Above Average
Above Average
Posts: 21
Joined: Sat Mar 16, 2013 4:18 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Twisp »

Thank you so much Spara! That really helps. I was also looking to organize by government level, would I simply have to turn the "if 'x'" statement into an "if 'x' and 'y'" statement in order to define government levels under which each station appears?

Like so?

Code: Select all

	
	if (system.techLevel < 9 && system.government > 5)
		var stations = this.$corStations.concat();
	else if (system.techLevel <13 && system.government > 5)
		var stations = this.$corstations.concat(this.$dodStations);
	else if (system.government > 5)
		var stations = this.$corStations.concat(this.$dodStations, this.$icoStations);
Should this restrict station spawns to democratic and corporate state governments only, or will I need to change it somewhat?
Conducting a deepspace mining operation out in Orrira. Thanking various dieties for the existence of cargo shepherds. Flying the rugged Python Prospector Errant.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by spara »

Twisp wrote:
Thank you so much Spara! That really helps.
My pleasure :) .

Without testing it and just by looking at it, I would say that you're almost there :D . One typo fixed and an "else" is needed to make it work. Like this:

Code: Select all

	
	if (system.techLevel < 9 && system.government > 5)
		var stations = this.$corStations.concat();
	else if (system.techLevel <13 && system.government > 5)
		var stations = this.$corStations.concat(this.$dodStations);
	else if (system.government > 5)
		var stations = this.$corStations.concat(this.$dodStations, this.$icoStations);
	else 
		var stations = [];
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by spara »

AsteroidStorm adds a lot of variety to the asteroids, but also suppresses asteroid, asteroid-alternative, boulder and boulder-alternative from the core game. With 1.77 this is ok, but with 1.79 and replacements I would rather keep the core ones in the mix. Easy to fix, just disable Config/shipdata-overrides.plist by renaming it.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Switeck »

CaptSolo wrote:
Random Hits 1.4.18:
Reason for tweak: Did not want Seedy Space Bars spawned at every anarchy system.

Code: Select all

this.setupShips = function ()
{
    if (system.isInterstellarSpace) return;
    
    if (system.government === 0 && system.economy === 2) // only spawn at poor industrial systems
    {
        var barNumber = Math.floor(system.ID/16); // generates 0...15 (bar number 1...16) // max of 16 unique bar names
        var barPosition = new Vector3D(this.spacebarPositions[this.modulo(barNumber,5)]); // generates 0...4
        barPosition = system.mainPlanet.position.subtract(barPosition); // translate pwu into wpu
        barNumber++;
        this.setupSpacebar(barNumber, barPosition);

        // Random Bar Attacks
        if (Math.random() < 0.15)
        {
            system.addGroup("random_hits_big_boss", this.anyInt(3,6), barPosition, 10000);
            system.addGroup("random_hits_big_boss_fighter", 6, barPosition, 10000);
        }
    }
}
I on the other hand wanted more Random Hits Seedy Space Bars...at least enough that I didn't have to jump as far to find one.

So I added them to Multi-Government systems in all the Galaxy Charts except #4, which has 2x as many Anarchy systems as the others:

Code: Select all

if (system.government === 0 || (system.government === 2 && galaxyNumber != 3)) // makes them appear in Multi-Gov systems as well! But not in Galaxy Chart 4!
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Tricky »

That's going to make the Factions OXP interesting. :D
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by spara »

Not an existing oxp tweak but not really worth of a new oxp either, so I'll post it here for those interested. I've been playing as a miner (from the miner start) for a while and been missing info about the cargo hold status while scooping. This one fills that bill nicely.

1. First of all you'll need a Config folder in your AddOns folder. Create, if missing. That's the same folder you have your modified keyconfig.plist in :wink: .
2. Then you'll need to create a a script.js file into that Config folder. Assuming that you don't already have that file of course.
3. And finally put this into that file:

Code: Select all

this.name = "my_own_tweaks";

this.shipScoopedOther = function(whom) {
	player.consoleMessage("Cargo load " + player.ship.cargoSpaceUsed + " of " + player.ship.cargoSpaceCapacity + " t.");
}
And the result looks like this:

Image
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Switeck »

spara, that needs to be part of the core game! 8)
Neelix
---- E L I T E ----
---- E L I T E ----
Posts: 288
Joined: Sat May 31, 2014 9:02 pm
Location: Melbourne, Australia

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Neelix »

spara wrote:
And the result looks like this:

Image
I'm assuming this would appear for every item scooped, but (thanks to the cargo shepherd) there are times when I scoop a whole bunch of cargo containers at once. Getting a long list of them in the console messages. I'd prefer such a message to only appear once at the bottom rather than after each. How could this code be modified to wait until no cargo has been scooped for second then display the message once?

- Neelix
Talaxian Enterprises: [wiki]Vacuum Pump[/wiki] [wiki]Waypoint Here[/wiki]
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Diziet Sma »

Switeck wrote:
spara, that needs to be part of the core game! 8)
Since 1.80 is now in feature-freeze, perhaps it would be best handled with a MFD until work starts on 1.81.

Come to think of it, a MFD specifically designed for miners might be a good idea anyway. (Though I realise this particular feature would be handy for all players, not just miners)
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by spara »

Neelix wrote:
I'd prefer such a message to only appear once at the bottom rather than after each. How could this code be modified to wait until no cargo has been scooped for second then display the message once?
Since the splinters get scooped one by one, there is no (at least no practical) way of achieving that as a message. Sorry. MFD would be different case though...
Diziet Sma wrote:
Come to think of it, a MFD specifically designed for miners might be a good idea anyway. (Though I realise this particular feature would be handy for all players, not just miners)
Maybe, maybe. A general status MFD might come handy. Wasn't there something like that from Zirael some time ago? Ah yes, here. There's room in that General Info MFD to include cargo hold status too.

I'll see what changes it needs.

Edit: Checked the MFD and it would require quite a lot of tweaking to make it work properly. It would be required to use framecallback constantly monitoring the cargo status, as not all cargo changes trigger events. Especially jettisoning cargo and processing ore with ore processor. Doable, but feels a bit overkill.
vsfc
Dangerous
Dangerous
Posts: 103
Joined: Wed Jul 10, 2013 12:39 am

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by vsfc »

Hi Commanders!
Here are my 2 cents. I really like the commander log extension and wanted it to log also what equipment was bought or sold or repaired. I replaced function this.playerBoughtEquipment. See code below.

Code: Select all

this.playerBoughtEquipment = function(equip)
{
    this.clockString = clock.days + ":" + clock.hoursComponent + ":" + clock.minutesComponent + ":" +  clock.secondsComponent; 
    this.dateArray.push(this.clockString);
    var eqCounter = 0 ; 
    for(eqCounter = 0; eqCounter < player.ship.equipment.length; eqCounter++)
    {
        if(player.ship.equipment[eqCounter].equipmentKey == equip)
        { 
	    this.textArray.push(player.ship.equipment[eqCounter].name + " purchased at " + system.name + " for " + (this.oldCredits - player.credits) + "cr");
        }
    }

    this.trimArrays();
    this.oldCredits = player.credits;	
}
I know that ship entity has equipment property that returns a list of equipment ship has. It will be nice if ship had a function like GetEquipment(equip) that would return EquipmentInfo to avoid implementing a for loop every time I need just one piece of equipment. Or is there another way of getting only one equipment by the key?
At the moment above function shows if user bought Equipment with _REMOVAL. How do I detect if equip string contains “_REMOVAL” to set a proper wording when equipment was sold.
My next step will be logging message if equipment was repaired.

Thanks,
vsfc
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by cim »

vsfc wrote:
Or is there another way of getting only one equipment by the key?
EquipmentInfo.infoForKey(...)
vsfc wrote:
At the moment above function shows if user bought Equipment with _REMOVAL. How do I detect if equip string contains “_REMOVAL” to set a proper wording when equipment was sold.

Code: Select all

if (string.match(/_REMOVAL/)) { ... } else { ... }
Post Reply