Oolite Bulletins

For information and discussion about Oolite.
It is currently Thu Oct 18, 2018 2:44 am

All times are UTC




Post new topic  Reply to topic  [ 1432 posts ]  Go to page Previous 192 93 94 95 96 Next
Author Message
 Post subject: Re: Scripters cove
PostPosted: Sun Nov 05, 2017 11:58 pm 
Online
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 2194
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Part of the problem may lie in the function stacking your doing in this line:
Code:
this.startUpComplete = this.equipmentAdded = this.playerBoughtNewShip = function()
This code will run whenever you start up from a save game (as you've noted), and theoretically would run every time any equipment is added, or whenever the player buys a new ship.

I think it would be better to do something like this:
Code:
this.startUpComplete = function()
{	
	this.$adjustSpeed();
}

this.equipmentAdded = function(equipmentKey) 
{
	log(this.name, "adding equipment " + equipmentKey);
	if (equipmentKey == "EQ_TRANSIT_DEFAULT" || equipmentKey == "EQ_TRANSIT_GRADE" || equipmentKey == "EQ_PERFORMANCE_DEFAULT" || equipmentKey == "EQ_PERFORMANCE_GRADE")
		this.$adjustSpeed();
}

this.playerBoughtNewShip = function(ship, price) 
{
	log(this.name, "new ship " + ship);
	this.$adjustSpeed();
}

this.$adjustSpeed = function() 
{
	var p = player.ship;
	var td = p.equipmentStatus("EQ_TRANSIT_DEFAULT");
	var tg = p.equipmentStatus("EQ_TRANSIT_GRADE");
	var pd = p.equipmentStatus("EQ_PERFORMANCE_DEFAULT");
	var pg = p.equipmentStatus("EQ_PERFORMANCE_GRADE");

	log(this.name, "transit def " + td + ", gde " + tg);
	log(this.name, "perform def " + pd + ", gde " + pg);
	log(this.name, "maxspeed pre  = " + p.maxSpeed);
	if(tg == "EQUIPMENT_OK" && td != "EQUIPMENT_OK" && pd != "EQUIPMENT_OK") {p.maxSpeed -= 50;}
	if(pg == "EQUIPMENT_OK" && pd != "EQUIPMENT_OK" && td != "EQUIPMENT_OK") {p.maxSpeed += 50;}
	if(tg == "EQUIPMENT_OK" && pd == "EQUIPMENT_OK") {p.maxSpeed -= 100;}
	if(pg == "EQUIPMENT_OK" && td == "EQUIPMENT_OK") {p.maxSpeed += 100;}
	log(this.name, "maxspeed post = " + p.maxSpeed);
}
This way you can see which of the events is not firing, plus the equipmentAdded function won't keep adjusting your speed when non-related equipment items are added.

_________________
My OXP's
YouTube: Oolite Teaser Trailer


Top
   
 Post subject: Re: Scripters cove
PostPosted: Mon Nov 06, 2017 1:49 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 20, 2013 10:22 pm
Posts: 1181
Thanks so much phkb! :D

I knew about the 'any' equipment issue (planning to add conditions later), so that was to come.
I didn't know that 'this.' statements could be nested however, so that opens up some new possibilities :-)

I'll try out the script and report back.

_________________
"With our thoughts, we make the world" :-)


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Nov 07, 2017 1:02 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 20, 2013 10:22 pm
Posts: 1181
Tried the above script. Same problem, namely this.equipmentAdded isn't firing (no log entries and no speed change using numeric hud).

The equipment is definitely being added (listed on the in game equipment list).
The way it is added may be unsual however...
Player buys transit re-fit which in turn grants (amongst other things) transit grade via script (working).

The fact that desired behaviour occurs from this.startUpComplete but not from this.equipmentAdded (with any of the three scripts so far) is curious.

I've tried swapping 'grades' for 're-fits' but to no avail.
I'll try this.playerBoughtEquipment else I might have to go down the replaceShip route...

_________________
"With our thoughts, we make the world" :-)


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Nov 07, 2017 1:07 am 
Online
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 2194
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Can you send me the entire script file?

_________________
My OXP's
YouTube: Oolite Teaser Trailer


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Nov 07, 2017 1:30 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 20, 2013 10:22 pm
Posts: 1181
I could but I think I've just solved it...

There were two seperate checks for equipment added which were somehow interfering (I wasn't aware that one might prevent another). I've just tried combining them and suddenly there are log entries...

It's currently applying the adjustment twice but I think I might know why that is:
this.equipmentAdded = this.playerBoughtEquipment = function(equipment)
As refits are both purchased and added then that's potentially two triggers.

this.playerBoughtEquipment should be unnecessary in the presence of this.equipmentAdded

Thanks for all your help phkb :)
...and apologies for the wild goose chase :oops:

_________________
"With our thoughts, we make the world" :-)


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Nov 07, 2017 3:04 am 
Offline
Deadly
Deadly
User avatar

Joined: Mon May 30, 2016 3:54 am
Posts: 178
Some noob questions of mine:

If I use scan class="CLASS_BUOY" is the player rewarded a kill and a bounty if defined ? From my first observation it seems not to be the case.

In which OXP I could find the tanker anaconda ? Once in a while it shows up on my scanner but I really dont remember anymore where this ship belong to.

_________________
Trying to survive behind the controls of a Caduceus Psi XT in Alpha test :lol:


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Nov 07, 2017 10:10 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon May 20, 2013 9:53 pm
Posts: 2525
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Quote:
If I use scan class="CLASS_BUOY" is the player rewarded a kill and a bounty if defined ? From my first observation it seems not to be the case.
If you tested then it is true. Sounds logical.
Quote:
In which OXP I could find the tanker anaconda ?
I think this:
Code:
wildShips_anaconda = {
                like_ship = "anaconda";
                name = "Anaconda Tanker";
                roles = "wildShips_tanker wildShips_anaconda";
};

_________________
OXPs by Norby


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Nov 07, 2017 10:35 am 
Offline
Deadly
Deadly
User avatar

Joined: Mon May 30, 2016 3:54 am
Posts: 178
Quote:
Quote:
Quote:
If I use scan class="CLASS_BUOY" is the player rewarded a kill and a bounty if defined ? From my first observation it seems not to be the case.
If you tested then it is true. Sounds logical.
Actually I first faced the problem while adapting the Star Destroyer, the escorts are defined as buoy and therefore no kills or bounties are rewarded even if they are fugitives. Even "counts_as_kill" = yes; doesn't change that. After massLockedBehaviour = "OO_MASSLOCKED_NEVER"; is working this shouldn't be a problem anymore.
Quote:
Quote:
In which OXP I could find the tanker anaconda ?
I think this:
Code:
wildShips_anaconda = {
                like_ship = "anaconda";
                name = "Anaconda Tanker";
                roles = "wildShips_tanker wildShips_anaconda";
};
WildShips it is, thank you a lot

_________________
Trying to survive behind the controls of a Caduceus Psi XT in Alpha test :lol:


Top
   
 Post subject: Re: Scripters cove
PostPosted: Fri Dec 01, 2017 9:36 am 
Offline
Deadly
Deadly
User avatar

Joined: Mon May 30, 2016 3:54 am
Posts: 178
Is there any way that I can assign specific pilots to all escape pods of a ship ? Its easy to have 8 pods with different designs but Oolite seems to accept only 1 assigned pilot and fills the remaining ones with random characters.

Update: Never mind, I found a solution already, not perfect but close enough.

_________________
Trying to survive behind the controls of a Caduceus Psi XT in Alpha test :lol:


Top
   
 Post subject: Re: Scripters cove
PostPosted: Mon Dec 04, 2017 2:05 am 
Offline
Deadly
Deadly
User avatar

Joined: Mon May 30, 2016 3:54 am
Posts: 178
A simple way to assign multiple characters to a ship:

create your character(s) in the characters.plist

in the shipdata.plist using "like_ship" create for every character an escape pod.

with "pilot =" you can assign each character to his pod, don't forget to set "unpiloted" = no;

include to your ship like following lines:

"death_actions" =
(
"spawn: my-escape-capsule_01 1",
"spawn: my_escape-capsule_02 2"
);


Voila, multiple pods with custom made characters. For sure not the most elegant method but east to implement.

_________________
Trying to survive behind the controls of a Caduceus Psi XT in Alpha test :lol:


Top
   
 Post subject: Re: Scripters cove
PostPosted: Fri Feb 09, 2018 6:14 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 20, 2013 10:22 pm
Posts: 1181
Using a visual effect stolen from Norby's telescope oxp...

Image

Note the target displayed in the bottom right of the HUD.

Any way to light it up when it is (presumably) subject to very similar lighting conditions to those of the target which it replicates?

_________________
"With our thoughts, we make the world" :-)


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sun Feb 11, 2018 12:51 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Sep 07, 2010 2:23 pm
Posts: 824
For some reason I have decided to be somewhat obsessive about the balance of the ships and stations in my Ooniverse. I've been looking through the wiki at the new roles that the populator uses (or at least, new since I last properly played) and am very interested in [wiki]http://wiki.alioth.net/index.php/Oolite ... le_Weights[/wiki]. I am a big fan of variety in my game, but I would like to tweak the chances of seeing lots of the oxp ships to make them more of a rarity and not outweigh the core ships too much.

My question: is there a way to use the debug console to list all the ships that Oolite is choosing from and to print out their role weights? I've found ship.roleWeights, which is great, but I'd need to be able to spawn one of every ship to check them. Which is more awkward than going through all the shipdata.plists by hand (which was my first thought, but I thought I'd see if there was a way to automate and speed up the process)...


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sun Feb 11, 2018 2:28 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 20, 2013 10:22 pm
Posts: 1181
This may not be quite what you're looking for Mauiby, but it could save you time if you're using additional shipsets (with many ships per shipdata.plist).

Most role weights are <=1, right?

Therefore find and replace 'trader(0.' with 'trader(0.0' and you now have traders that appear only 10% as often as before.
You could also use replace 'trader ' (note the space) and 'trader"' (note the quotes) with 'trader(0.1)' and trader(0.1)" respectively. As long as trader (or whatever role you're editing) does not occur in the ship name then I think you'll be fine (even if it does, you won't break anything).

You'd nead to repeat for the various roles of course.

It wouldn't be very quick but it should still be much quicker than editing each role weight individually...
Better suggestions welcome because I have a similar problem.

_________________
"With our thoughts, we make the world" :-)


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sun Feb 11, 2018 2:34 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Wed Aug 15, 2012 4:19 am
Posts: 2530
Location: Finland
A fellow balancer :). Don't know about a simple debug-command, but a simple script using keysForRole followed by shipDataForKey should do the get you a list of key and roles. Don't know what you plan to do with that though :). I find it best to go through oxps I'm using one by one comparing role weights with the core roles. Tedious job, but I just can't play the game if there's a noticable spawn balance problem. Somewhere around the forum should still float my old rebalancer for Griff's extra ship, if you need some inspiration :).


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sun Feb 11, 2018 2:54 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Thu Jun 20, 2013 10:22 pm
Posts: 1181
Could the problem be solved largely in game by a condition script?

Not actual code but the rough idea:

this.allowSpawnShip
if shipKey != core ship && random 1-5 >3
else
spawn core ship of same role

In this example core ships would number 60% of the ships appearing.

Core ships might need to be listed in their entirety (not sure) but at least you'd only have to do it once.

_________________
"With our thoughts, we make the world" :-)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1432 posts ]  Go to page Previous 192 93 94 95 96 Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited