Maybe. Forgot to mention, if you have an OXP that modifies sun distance then remove that line. You might want to play with ambient_level too, the interstellar value of 0.1 maybe too dark for some.Cody wrote:A thought, Tricky - would thatsun_distance_modifier
override an OXP'ssun_distance_modifier
, or possibly clash with it, causing a very distant sun?
Tinkerer's Workshop - OXP tweaking for fun and profit!
Moderators: winston, another_commander
- Tricky
- ---- 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!
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
<nods> Yeah, I've had that happen before, I think - it looked cool, but made the sunward trip very time consuming.Tricky wrote:Maybe. Forgot to mention, if you have an OXP that modifies sun distance then remove that line.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Okay then, here's what I did.
For the Taxi Galactica, open "taxi_galactica_main.js" in the scripts folder. Take out what is on lines 211 through 269:
and replace it with:
And for the laser booster (which is actually what was put in earlier for the cargo spotter), open the "laserBooster_worldScript.js" and take what is on 14-20:
and replace it with
There may be a better way to do either, or probably both of these, but, as far as I have seen, will work.
(By the way, this seems to make it so that the laser breaks more often... I'm not sure if it has a timer that it uses to decide how likely it is to break that counts up starting when it is turned on, but that seems to be the case. Once I had my fore and aft lasers break within five minutes, and while I was fighting five or seven pirates.)
We need spoiler tags to hide these long strings of code until someone is ready to see it...
For the Taxi Galactica, open "taxi_galactica_main.js" in the scripts folder. Take out what is on lines 211 through 269:
Code: Select all
// Random chance (%) for pirate encounters:
this._piraterandomnumber = Math.floor(Math.random() * (100 - 1 + 1) + 1);
// If current contract is Easy difficulty then 20% chance pirates will be spawned:
if (missionVariables.taxi_diff === 0)
{
if (system.ID === missionVariables.taxi_dest)
{
// If current system is contract destination spawn 3 pirates:
if (this._piraterandomnumber > 80) system.addShipsToRoute("taxi_pirate", 3, null, "wp");
}
else
{
// If current system is not contract destination spawn 1 pirate:
if (this._piraterandomnumber > 80) system.addShipsToRoute("taxi_pirate", 1, null, "wp");
}
}
// If current contract is Medium difficulty then 40% chance pirates will be spawned:
else if (missionVariables.taxi_diff === 1)
{
if (system.ID === missionVariables.taxi_dest)
{
// If current system is contract destination spawn 4 pirates:
if (this._piraterandomnumber > 60) system.addShipsToRoute("taxi_pirate", 4, null, "wp");
}
else
{
// If current system is not contract destination spawn 2 pirates:
if (this._piraterandomnumber > 60) system.addShipsToRoute("taxi_pirate", 2, null, "wp");
}
}
// If current contract is Hard difficulty then 60% chance pirates will be spawned:
else if (missionVariables.taxi_diff === 2)
{
if (system.ID === missionVariables.taxi_dest)
{
// If current system is contract destination spawn 5 pirates:
if (this._piraterandomnumber > 40) system.addShipsToRoute("taxi_pirate", 5, null, "wp");
}
else
{
// If current system is contract destination spawn 3 pirates:
if (this._piraterandomnumber > 40) system.addShipsToRoute("taxi_pirate", 3, null, "wp");
}
}
// If on special mission #1 then separatist ships might be spawned:
else if (missionVariables.taxi_diff === 3)
{
// If current system is mission destination spawn 8 separatist fighters:
if (system.ID === missionVariables.taxi_dest)
{
system.addShipsToRoute("taxi_separatist", 8, null, "wp");
}
// If current system is not mission destination there is 70% chance to spawn 4 separatist fighters:
else
{
if (this._piraterandomnumber > 30) system.addShipsToRoute("taxi_separatist", 4, null, "wp");
}
}
}
Code: Select all
// Check to make sure that the player is carrying a passenger.
if (missionVariables.taxistatus === "ON_THE_JOB")
{
// Random chance (%) for pirate encounters:
this._piraterandomnumber = Math.floor(Math.random() * (100 - 1 + 1) + 1);
// If current contract is Easy difficulty then 20% chance pirates will be spawned:
if (missionVariables.taxi_diff === 0)
{
if (system.ID === missionVariables.taxi_dest)
{
// If current system is contract destination spawn 3 pirates:
if (this._piraterandomnumber > 80) system.addShipsToRoute("taxi_pirate", 3, null, "wp");
}
else
{
// If current system is not contract destination spawn 1 pirate:
if (this._piraterandomnumber > 80) system.addShipsToRoute("taxi_pirate", 1, null, "wp");
}
}
// If current contract is Medium difficulty then 40% chance pirates will be spawned:
else if (missionVariables.taxi_diff === 1)
{
if (system.ID === missionVariables.taxi_dest)
{
// If current system is contract destination spawn 4 pirates:
if (this._piraterandomnumber > 60) system.addShipsToRoute("taxi_pirate", 4, null, "wp");
}
else
{
// If current system is not contract destination spawn 2 pirates:
if (this._piraterandomnumber > 60) system.addShipsToRoute("taxi_pirate", 2, null, "wp");
}
}
// If current contract is Hard difficulty then 60% chance pirates will be spawned:
else if (missionVariables.taxi_diff === 2)
{
if (system.ID === missionVariables.taxi_dest)
{
// If current system is contract destination spawn 5 pirates:
if (this._piraterandomnumber > 40) system.addShipsToRoute("taxi_pirate", 5, null, "wp");
}
else
{
// If current system is contract destination spawn 3 pirates:
if (this._piraterandomnumber > 40) system.addShipsToRoute("taxi_pirate", 3, null, "wp");
}
}
// If on special mission #1 then separatist ships might be spawned:
else if (missionVariables.taxi_diff === 3)
{
// If current system is mission destination spawn 8 separatist fighters:
if (system.ID === missionVariables.taxi_dest)
{
system.addShipsToRoute("taxi_separatist", 8, null, "wp");
}
// If current system is not mission destination there is 70% chance to spawn 4 separatist fighters:
else
{
if (this._piraterandomnumber > 30) system.addShipsToRoute("taxi_separatist", 4, null, "wp");
}
}
}
}
Code: Select all
{
missionVariables.laserBooster = "INACTIVE";
this.callCount = 0;
this.laserTemp = 2;
this.findLaser();
this.callbackID = addFrameCallback(this.checkTemp.bind(this));
}
Code: Select all
{
if(player.ship.equipmentStatus("EQ_LASERBOOSTER") == "EQUIPMENT_OK")
{
missionVariables.laserBooster = "ACTIVE";
this.callCount = 0;
this.laserTemp = 2;
this.findLaser();
this.callbackID = addFrameCallback(this.checkTemp.bind(this));
}
else
{
missionVariables.laserBooster = "INACTIVE";
this.callCount = 0;
this.laserTemp = 2;
this.findLaser();
this.callbackID = addFrameCallback(this.checkTemp.bind(this));
}
}
(By the way, this seems to make it so that the laser breaks more often... I'm not sure if it has a timer that it uses to decide how likely it is to break that counts up starting when it is turned on, but that seems to be the case. Once I had my fore and aft lasers break within five minutes, and while I was fighting five or seven pirates.)
We need spoiler tags to hide these long strings of code until someone is ready to see it...
"May Duralium ever stand between you and the Vacuum."
-
- Quite Grand Sub-Admiral
- Posts: 6680
- Joined: Wed Feb 28, 2007 7:54 am
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Stickied since it contains useful tips and can inspire people to play with OXP and core game code. But we should probably unstickify something else from this subforum; there are just way too many sticky threads here.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
"Orphaned OXPs" and "1.77 for OXPers" can probably go, I think.
- maik
- Wiki Wizard
- Posts: 2028
- Joined: Wed Mar 10, 2010 12:30 pm
- Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
"Where are the expansion packs..." is redundant with information in the wiki and could go IMHO.
- Venator Dha
- ---- E L I T E ----
- Posts: 329
- Joined: Sun Feb 23, 2014 11:26 am
- Location: Sweden
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
I think this is a great thread, and have adopted some of the changes already mentioned, so I'll add some of my own small changes to Random Hits -which I think is a great OXP but found that the Seedy Space Bar a little unbalancing to the game.
Similar to the post that started this thread,
I changed line 763 in oolite-randomHits.js
to
Thus giving a 50% chance of a space bar in any anarchy system.
in shipdata.plist changed line 1637 to
to reduce the chance of a ship yard at the bar - which I found a little strange anyway.
I also changed some details in each space bar to make them more varied in equipment price and tech level. I disliked that you could access high tech in any anarchy system, now you have to be lucky, and you will pay more if it's there
e.g.
a high quality bar
to
and a low quality bar
to
I also modified the commodities.plist to make the pricing less extreme.
Similar to the post that started this thread,
I changed line 763 in oolite-randomHits.js
Code: Select all
if (system.government === 0){
Code: Select all
if (system.government === 0 && Math.random() < 0.50){
in shipdata.plist changed line 1637 to
Code: Select all
has_shipyard = 0.75; // changed to 75% has shipyard
I also changed some details in each space bar to make them more varied in equipment price and tech level. I disliked that you could access high tech in any anarchy system, now you have to be lucky, and you will pay more if it's there
e.g.
a high quality bar
Code: Select all
"random_hits_griff_spacebar38" = {
"display_name" = "The Raxxla Ritz Hotel";
"equipment_price_factor" = "1.18";
"equivalent_tech_level" = 13;
Code: Select all
"random_hits_griff_spacebar38" = {
"display_name" = "The Raxxla Ritz Hotel";
"equipment_price_factor" = "2.00";
"equivalent_tech_level" = 15;
Code: Select all
"random_hits_griff_spacebar16" = {
"display_name" = "Joe's Bar and Grill";
"equipment_price_factor" = "1.12";
"equivalent_tech_level" = 12;
Code: Select all
"random_hits_griff_spacebar16" = {
"display_name" = "Joe's Bar and Grill";
"equipment_price_factor" = "1.05";
"equivalent_tech_level" = 4;
Code: Select all
{
random_hits_spacebar = (
("Food", 0, 0, 19, -1, -1, 250, 5, 5, 0), // modified reduced price
("Textiles", 0, 0, 18, -1, 0, 250, 5, 10, 0),
("Radioactives", 0, 0, 53, -2, -3, 0, 7, 15, 0),
("Slaves", 0, 0, 40, -5, -1, 0, 15, 15, 0), // modified price & quantity
("Liquor/Wines", 0, 0, 83, -2, -1, 250, 10, 5, 0), // modified reduced price
("Luxuries", 0, 0, 190, 8, -1, 250, 9, 21, 0),
("Narcotics", 0, 0, 30, -2, 20, -4, 100, 30, 0), // modified price & quantity
("Computers", 0, 0, 150, 14, -1, 250, 3, 21, 0),
("Machinery", 0, 0, 120, 6, 1, 250, 31, 10, 0),
("Alloys", 0, 0, 68, 2, 1, 5, 31, 10, 0), // modified price & quantity
("Firearms", 0, 0, 100, 13, 0, 0, 63, 0, 0),
("Furs", 0, 0, 176, -9, -9, 220, 63, 63, 0), // modified price & quantity = main station algorithm
("Minerals", 0, 0, 25, -1, -1, 25, 5, 3, 0), // modified reduced price & quantity
("Gold", 0, 0, 100, 0, 0, 0, 4, 0, 1),
("Platinum", 0, 0, 181, 0, 0, 0, 21, 0, 1),
("Gem-Stones", 0, 0, 50, 0, 0, 0, 10, 0, 2),
("Alien Items", 0, 0, 125, 1, 0, 0, 31, 0, 0)
);
}
Taurus Driving through the galaxy since... .
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
To keep things persistent, I suggest using system.scrambledPseudoRandomNumber("salt") rather than Math.random(). That way the space bar will still be there the next you visit the system.Venator Dha wrote:I changed line 763 in oolite-randomHits.jstoCode: Select all
if (system.government === 0){
Thus giving a 50% chance of a space bar in any anarchy system.Code: Select all
if (system.government === 0 && Math.random() < 0.50){
- Venator Dha
- ---- E L I T E ----
- Posts: 329
- Joined: Sun Feb 23, 2014 11:26 am
- Location: Sweden
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Thanks Spara,
that's the other good thing with this thread, great advice on code that's beyond my understanding
I'll give it a try, although I kind of like that the bar can disappear, I see it as the criminals who attack the bar as having won and destroyed it.
that's the other good thing with this thread, great advice on code that's beyond my understanding
I'll give it a try, although I kind of like that the bar can disappear, I see it as the criminals who attack the bar as having won and destroyed it.
Taurus Driving through the galaxy since... .
- Keeper
- ---- E L I T E ----
- Posts: 273
- Joined: Fri Feb 01, 2013 7:44 am
- Location: Indian Hills, Nevada, USA
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Hmm, perhaps something like this can make constores persistent, instead of changing brands every jump...?spara wrote:To keep things persistent, I suggest using system.scrambledPseudoRandomNumber("salt") rather than Math.random(). That way the space bar will still be there the next you visit the system.
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
The tricky thing about that is that the constore brands are stored in separate OXPs which may or may not be installed. Something like:Keeper wrote:Hmm, perhaps something like this can make constores persistent, instead of changing brands every jump...?
Code: Select all
constoreTypes = Ship.keysForRole("constore");
currentConstoreType = Math.floor(system.scrambledPseudoRandomNumber(31514)*constoreTypes.length);
system.addShips("["+constoreTypes[currentConstoreType]+"]", ...);
The catch is that
Ship.keysForRole
is 1.79-only. In previous versions you'd probably need to put a small script into each of the ad packs so that the main script could detect it, and build the list of available roles up that way.Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Does the result of keysForRole remain the same over time? If not, then the array should be sorted before selecting.cim wrote:Code: Select all
constoreTypes = Ship.keysForRole("constore"); currentConstoreType = Math.floor(system.scrambledPseudoRandomNumber(31514)*constoreTypes.length); system.addShips("["+constoreTypes[currentConstoreType]+"]", ...);
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Here's a way to make constores persistent in 1.77.1
* From YAH main oxp, open the file your_ad_here.js from the Scripts folder
* line 42 looks like this:* replace it with this:
* From YAH main oxp, open the file your_ad_here.js from the Scripts folder
* line 42 looks like this:
Code: Select all
var ships=system.addShips(role, count, offset,radius);
Code: Select all
if (role === "constore") {
var conStores = ["constore-A", "constore-B", "constore-C", "constore-D", "constore-E", "constore-F", "constore-G"];
var ships = null;
while (ships === null && conStores.length !== 0) {
var storeRole = conStores.splice(Math.floor(system.scrambledPseudoRandomNumber() * conStores.length), 1);
ships = system.addShips(storeRole, count, offset,radius);
}
}
else
var ships = system.addShips(role, count, offset, radius);
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
In practice, yes, so long as you don't change operating system, OXP list, or Oolite build. Sorting the list before using it is probably a good idea.spara wrote:Does the result of keysForRole remain the same over time?
- CaptSolo
- ---- E L I T E ----
- Posts: 909
- Joined: Wed Feb 23, 2011 10:08 pm
- Location: Preying Manta
- Contact:
Re: Tinkerer's Workshop - OXP tweaking for fun and profit!
Random Hits 1.4.18:
Reason for tweak: Did not want Seedy Space Bars spawned at every anarchy system.
HyperRadio 1.26:
Reason for tweak: Did not like podMusic quiting with condition Red Alert (i.e. I like radio blasting during battle).
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);
}
}
}
Reason for tweak: Did not like podMusic quiting with condition Red Alert (i.e. I like radio blasting during battle).
Code: Select all
this.alertConditionChanged = function(condition)
{
if(this.doInit) this.doInit();
if(this.hyperRadio)
{
if(condition===4) this.failPlay(); // There is no alert condition 4
else if(!player.ship.docked && !system.isInterstellarSpace && !this.tempDisabled) this.canPlay = true;
}
};