Page 4 of 4

Re: Ship names and origins

Posted: Tue Jun 21, 2011 5:14 pm
by Thargoid
Wildeblood wrote:
Smivs wrote:
I don't know, would you really want to be a "Demoralizer of Little Girls" ? :shock:
I thought I was being a "Teaser of Thargoids". I hope he's got a sense of humour.

(My own favourite was "Solace of Scaredy Cats" which I thought could be appropriate for a "personal base".)
He has, although next time I might take a leaf out of aforesaid Iain M Banks book(s) and give them really daft names to go with it ;)

I don't think the ship's name is stored, only it's MAC number. I might have to change that in the next version of the script, just for record-keeping purposes. Although of course that won't help existing Vortex pilots.

Re: Ship names and origins

Posted: Tue Jun 21, 2011 5:45 pm
by Wildeblood
Thargoid, I've grabbed your script for naming the NPC Vortexes, and started working it into a name-gen for the Anacondas. Apart from changing the name - in a flash of creativity I thought "anaconda_names.js" - is there anything I need to do to avoid confusing my poor computer? (I ask this from the perspective of a person who can't tell the difference between a local variable and global variable and so on.)

Re: Ship names and origins

Posted: Tue Jun 21, 2011 6:52 pm
by Zireael
Whatever you do, I hope you two release it as a naming OXP - it would be beautiful...

Re: Ship names and origins

Posted: Tue Jun 21, 2011 7:40 pm
by Thargoid
Wildeblood wrote:
Thargoid, I've grabbed your script for naming the NPC Vortexes, and started working it into a name-gen for the Anacondas. Apart from changing the name - in a flash of creativity I thought "anaconda_names.js" - is there anything I need to do to avoid confusing my poor computer? (I ask this from the perspective of a person who can't tell the difference between a local variable and global variable and so on.)
As long as the this.name line (the first line) of the script is changed as well as the filename (for simplicity have them both as anaconda_names.js for example) then things should be fine.

It works based on the role by which the shipis spawned, so in the case of the Vortex it is trader/sunskim trader (the first pair of cases, lines 12-23), pirate (lines 24-34), hunter (lines 35-46), police (lines 47-57) and the specific "NPC_vortex" (lines 58-62). So these will probably need to be tweaked to match the roles list of the Anaconda (for example I don't think they are spawned as hunters or police).

Oh and of course change the names involved to something more appropriate, and swap the Vortex references to Anaconda. All of the variables are just inside that script, but of course you need to assign the script to the Anaconda in the shipdata.plist entry for the ship.

Re: Ship names and origins

Posted: Tue Jun 21, 2011 8:39 pm
by Selezen
This might be another cool idea for an OXP, but wouldn't it be cool to have a soundpack that provided a ship AI with a voice...?

Re: Ship names and origins

Posted: Tue Jun 21, 2011 9:27 pm
by RyanHoots
Selezen wrote:
This might be another cool idea for an OXP, but wouldn't it be cool to have a soundpack that provided a ship AI with a voice...?
Cool! But too bad you can't talk to them... 8)
"Anaconda, this is Lynx of Destruction. Do you have your ears on? I'm being chased by a smoky..." :lol:

Re: Ship names and origins

Posted: Wed Jun 22, 2011 12:05 am
by Wildeblood
Zireael wrote:
Whatever you do, I hope you two release it as a naming OXP - it would be beautiful...
It can't be an OXP proper - just drop in and it works - because folks would need to edit their shipdata files to attach the script to the ships. Which brings me to my first problem, I've done that to attach Griffed-up fancy explosions to all my ships. But as I expected, this:-

Code: Select all

	script = "griff_explosionScript.js";
	script = "trader_names.js";
results in ships with fancy names, but un-fancy explosions. No doubt in the opposite order, it would cause un-named ships. I'm not even bothering to check that - I have no doubt.

Another query: how do I test which sort of ship is calling this script? I don't won't a Neolite Anaconda being named "Ramon's Delight" or a Ramon Anaconda being called "Simon's Delight".

Re: Ship names and origins

Posted: Wed Jun 22, 2011 1:27 am
by RyanHoots
I'm going to try to build a ships names OXP, based on Vortex's script. I'm about to download the Vortex OXP. Who knows, random ship name generation might become a core part of Oolite 2.0.

Re: Ship names and origins

Posted: Wed Jun 22, 2011 8:44 am
by Wildeblood
Would someone who's got a clue tell me if this is sufficient and correct, or does it need more {...}; {...}; to make it happen?

Code: Select all

this.name			= "monkGunshipNames.js";
this.author		= "Wildeblood";
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike";
this.description		= "Black Monks Gunships naming script.";
this.version		= "1.0";

this.shipSpawned = function()
	{	// Eleven should be plenty...
		this.monkname1 = ["Affirmation", "Assertion", "Assurance", "Averment", "Avouchment", "Avowal", "Declaration", "Profession", "Restatement", "Statement", "Zenith"];
		this.random1 = (Math.floor((Math.random() * this.monkname1.length) - 0.000000001));
		if(this.random1 < 0 || this.random1 > (this.monkname1.length - 1)) { this.random1 = 0; }
		this.shipTitle = "Gunship - " + this.monkname1[this.random1] + " of Faith";
		this.ship.displayName = this.shipTitle;
	}

Re: Ship names and origins

Posted: Wed Jun 22, 2011 4:44 pm
by Thargoid
Wildeblood wrote:
Zireael wrote:
Whatever you do, I hope you two release it as a naming OXP - it would be beautiful...
It can't be an OXP proper - just drop in and it works - because folks would need to edit their shipdata files to attach the script to the ships. Which brings me to my first problem, I've done that to attach Griffed-up fancy explosions to all my ships. But as I expected, this:-

Code: Select all

	script = "griff_explosionScript.js";
	script = "trader_names.js";
results in ships with fancy names, but un-fancy explosions. No doubt in the opposite order, it would cause un-named ships. I'm not even bothering to check that - I have no doubt.

Another query: how do I test which sort of ship is calling this script? I don't won't a Neolite Anaconda being named "Ramon's Delight" or a Ramon Anaconda being called "Simon's Delight".
It can, in two separate ways.

Either use a shipdata-override.plist file to add the script line to the other OXP, or have the script add the name automagically when the player target locks onto it (before then how would the player know whether the ship has a name or not? ;) )

For me the latter option would work nicely.

Re: Ship names and origins

Posted: Wed Jun 22, 2011 4:58 pm
by Wildeblood
Thargoid wrote:
Wildeblood wrote:
Zireael wrote:
Whatever you do, I hope you two release it as a naming OXP - it would be beautiful...
It can't be an OXP proper - just drop in and it works - because folks would need to edit their shipdata files to attach the script to the ships.
Either use a shipdata-override.plist file to add the script line to the other OXP, or have the script add the name automagically when the player target locks onto it (before then how would the player know whether the ship has a name or not? ;) )

For me the latter option would work nicely.
For you it would. You know where to put the semi-colons. I'll go with the first option. Anyway, so that's sorted - yes, we can add a script to ships without editing the original shipdata. Cool.

Now, what about my question: how to attach two scripts to a ship?

Re: Ship names and origins

Posted: Wed Jun 22, 2011 5:34 pm
by Svengali
Wildeblood wrote:
Now, what about my question: how to attach two scripts to a ship?
No way to add two scripts - only monkeypatches are possible to change it on the fly, but it is dangerous and will add unnecessary incompatabilities/clashes.

A better way is to use a copy with changed names (entity, AI and script) and will avoid trouble.