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
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

OK, I've kinda worked out how the allowOfferShip method might be used, and produced the following condition script (which, sadly, is having no effect at Lave whatsoever):

Code: Select all

	"use strict";

	this.allowOfferShip = function(shipKey) {
		if ((shipKey=="gecko-player") || (shipKey=="krait-player") || (shipKey=="sidewinder-player") || (shipKey=="adder-player")) {
			if (system.economy <= 6) {
				return true; 
			} else {
				return false;
			}
		}
		return true;
	}
I've also placed the line "condition_script = fe_conditions.js" in the new shipyard.plist entries, a single example of which I post here:

Code: Select all

	"gecko-player" =
	{
		chance = 0.5;
		"optional_equipment" =
		(
            "EQ_ECM",
			"EQ_FUEL_SCOOPS",
			"EQ_PASSENGER_BERTH",
			"EQ_ESCAPE_POD",
			"EQ_ENERGY_BOMB",
			"EQ_ENERGY_UNIT",
			"EQ_DOCK_COMP",
			"EQ_WEAPON_PULSE_LASER",
			"EQ_WEAPON_BEAM_LASER",
			"EQ_WEAPON_MINING_LASER",
			"EQ_FUEL_INJECTION",
			"EQ_SCANNER_SHOW_MISSILE_TARGET",
			"EQ_MULTI_TARGET",
			"EQ_GAL_DRIVE",
			"EQ_ADVANCED_COMPASS",
			"EQ_SHIELD_BOOSTER",
			"EQ_HEAT_SHIELD"
		);
		price = 40000;
		"standard_equipment" =
		{
			extras = "";
			"forward_weapon_type" = "EQ_WEAPON_PULSE_LASER";
		};
		techlevel = 4;
		"weapon_facings" = 1;
		"condition_script" = "fe_conditions.js";
	};
Despite it simply not working as advertized (even on a completely clean install), the latest.log is throwing no errors that might guide me. No errors relating to these OXPs, that is.

Suggestions/corrections welcomed :)
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

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

Post by montana05 »

Reval wrote: Thu Nov 05, 2020 5:03 am
Suggestions/corrections welcomed :)
Your script will prevent the ship to be sold above TechLevel 6 but it will not force a sale in the other systems. While equipment.plist offers automatically in all systems of the defined Techlevel and above shipyard.plist aka shipyard of a station is using a selection of valid ships, TechLevel and chance are 2 of the factors used.
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

Oh, I see :( So is there not a simple solution?

Edit: I guess one could include start-scenarios for the five new ships, but I was hoping to avoid that further complication. (Kinda spoils the fun of dumping the old Cobby for 50,000 creds, though, dontcha think? ;) )
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

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

Post by montana05 »

Reval wrote: Thu Nov 05, 2020 7:06 am
Oh, I see :( So is there not a simple solution?
You can use addShipToShipyard to force a sale:

system.mainStation.addShipToShipyard
(
{
short_description: "Cobra Mark I: With fuel injectors and galactic hyperdrive.",
shipdata_key:"cobramk1-player",
price:120000,
personality:Math.floor(Math.random() * 32768),
extras:["EQ_FUEL_INJECTION","EQ_GAL_DRIVE"]
}
);
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

Woo hoo, well, I wasn't aware of that little wheeze (must look at the wiki again) :)

Cheers again, montana.
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

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

Post by montana05 »

Reval wrote: Thu Nov 05, 2020 7:19 am
Woo hoo, well, I wasn't aware of that little wheeze (must look at the wiki again) :)

Cheers again, montana.
Welcome, you can find the method at "Oolite JavaScript Reference: Station", its pretty new, added V1.89. I didn't think about it first and I never tried so no experience there. :wink:
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

Cool. And that script goes... where? And do I reference it somewhere in shipdata or shipyard?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

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

Post by montana05 »

Reval wrote: Thu Nov 05, 2020 7:25 am
Cool. And that script goes... where? And do I reference it somewhere in shipdata or shipyard?
Neither, you will need a separate script. I guess the easiest approach would be to start with player.shipWillExitWitchspace = function()
Scars remind us where we've been. They don't have to dictate where we're going.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6547
Joined: Wed Feb 28, 2007 7:54 am

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

Post by another_commander »

@Reval: Just checking, I hope you start the game with shift held down when you make changes inside your scripts or plists. Doing so requests a complete cache wipe and rebuild and is the way to get any changes you make in. Otherwise, the game's cache is referenced and that will normally not contain your changes.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

Oh yes, always. It's become a reflex ;)
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
dybal
---- E L I T E ----
---- E L I T E ----
Posts: 499
Joined: Mon Feb 10, 2020 12:47 pm

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

Post by dybal »

montana05 wrote: Thu Nov 05, 2020 7:30 am
Reval wrote: Thu Nov 05, 2020 7:25 am
Cool. And that script goes... where? And do I reference it somewhere in shipdata or shipyard?
Neither, you will need a separate script. I guess the easiest approach would be to start with player.shipWillExitWitchspace = function()
Create a script, include its name in Config/world-scripts.plist , create the wroldScript event handlers in the script.

Event handlers you should create and put your the call to insert the ship in the shipyard in:

startUpComplete
shipExitedWitchspace
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

OK. Thanks for the clarification. :) I'll get onto that after some ZZZZZZZZs ;)
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
dybal
---- E L I T E ----
---- E L I T E ----
Posts: 499
Joined: Mon Feb 10, 2020 12:47 pm

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

Post by dybal »

Things you should be aware:

- there might be other stations with shipyards in the system beside the main station (if the player is running the OXPs that create them)
- not all stations in the system stations list have shipyards
- it might be worthwhile to roll the dice before inserting the ship(s) in the stations' shipyards, just to make the game a bit unpredictable. You might want to use system.scrambledPseudoRandomNumber() for that, it makes things consistent between sucessive loads of a game savefiles.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

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

Post by Reval »

Well I'm testing atm on a completely clean install. Same result as on the one OXP'd up to the hilt.

Dice roll sounds good, but I _need_ at least the Gecko and Adder at Lave.
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

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

Post by montana05 »

Agreed, some OXP's do add (a lot) more stations that will not be covered by the forced sale I suggested. Rolling the dice is very useful, I am doing it for some equipment to prevent it to show up at every station. However, for ships chance is rolling the dice for you already.
Scars remind us where we've been. They don't have to dictate where we're going.
Post Reply