Griff's normalmapped ship remakes

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

Moderators: winston, another_commander

User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Re: Griff's normalmapped ship remakes

Post by DaddyHoggy »

The convenience of all all-in-one is the inconvenience of big download. Given that Griff also offers all the ships as individual downloads I'd say that he's been more than accommodating.

Please leave it alone Griff!

(Although, I'm sure those with thinner pipes and less machines would appreciate smaller textures - providing it doesn't spoil this beautiful OXP)
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
DGill
---- E L I T E ----
---- E L I T E ----
Posts: 292
Joined: Thu Jan 01, 2009 9:45 am

Re: Griff's normalmapped ship remakes

Post by DGill »

Possibly still need to add AIs folder to the individual download of griff_alloys_and_wreckage
DGill
---- E L I T E ----
---- E L I T E ----
Posts: 292
Joined: Thu Jan 01, 2009 9:45 am

Re: Griff's normalmapped ship remakes

Post by DGill »

Hmmm - still seem to be getting an error or two:

11:29:00.803 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (griff_spawn_sparks 1.0): Error: Vector3D.distanceTo: Could not construct vector from parameters (undefined) -- expected Vector, Entity or array of three numbers.
11:29:00.803 [script.javaScript.exception.ooliteDefinedError]: ../AddOns/griff_alloys_and_wreckage.oxp/Scripts/griff_spawn_sparks.js, line 9.
11:29:06.279 [script.load.world.listAll]: Loaded 29 world scripts:
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post by Griff »

Thanks for spotting the mix up with the missing AIs DGill, i've copied them into the alloys and wreckage oxp (they're still also in the current all in 1 bundle too i'll remove them next time i've got something bigger to update that oxp with)

hmm, not sure about the script error, here's the offending script in case there're any passing script wizards :D

Code: Select all

this.name = "griff_spawn_wreckage"; 
this.author = "Thargoid"; 
this.copyright = "© 2008 the Oolite team."; 
this.description = "Spawn wreckage and sparks from dead ship"; 
this.version = "1.0"; 

this.shipDied = function() // event that occurs when the entity (ship) whose script this is dies
	{

	if(!player.ship || !this.ship || this.ship.position.distanceTo(player.ship.position) > 50000) return; // exit the script if the explosion happens far from the player

 		this.largeCount = (Math.ceil(Math.random() * 3)); // between 0-3 pieces of wreckage
		this.tinyCount =  (Math.ceil(Math.random() * 10) + 5); // between 5-10 tiny spark fragments
		this.sparkCount =  (Math.ceil(Math.random() * 20) + 10); // between 10-20 spin spark fragments
		this.ship.spawn("griffspark", this.tinyCount); // spawn the tiny spark fragments

	if(this.largeCount > 0) // if there is large wreckage
		{
		this.ship.spawn("griffwreckage", this.largeCount); // spawn the larger wreckage
		this.ship.spawn("spinspark", this.sparkCount); // spawn the spin sparks
		}

	}
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Griff's normalmapped ship remakes

Post by Svengali »

I'm using the following and don't get any errors. This is with your All-In-One1.2 and griff_alloys_and_wreckage.
I've changed the random number stuff to get the results as in the comments .-)

Code: Select all

this.name = "griff_spawn_wreckage";
this.author = "Thargoid";
this.copyright = "(C)2008-2011";
this.description = "Spawn wreckage and sparks from dead ship";
this.version = "1.2";

this.shipDied = function()
{
	if(!player.ship.isValid || this.ship.position.distanceTo(player.ship.position) > 50000) return;
	let largeCount = Math.floor(Math.random() * 4); // 0-3
	let tinyCount =  Math.floor(Math.random() * 6) + 5; // 5-10
	let sparkCount =  Math.floor(Math.random() * 11) + 10; // 10-20
	this.ship.spawn("griffspark", tinyCount);
	if(largeCount){
		this.ship.spawn("griffwreckage", largeCount);
		this.ship.spawn("spinspark", sparkCount);
	}
}
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Griff's normalmapped ship remakes

Post by Thargoid »

It looks like the if statement needs tweaking. Because they are logical AND rather than logical AND (|| is OR, && would be AND) the whole statement is getting checked. Hence if the player ship has ceased to exist, then player.ship.position will be undefined (which is what is happening if you look at the error in the log) but the expression will still be evaluated.

Either use Svengali's suggestion above, or split the if into two separate ones:

Code: Select all

if(!player.ship || !this.ship || this.ship.position.distanceTo(player.ship.position) > 50000) return; // exit the script if the explosion happens far from the player
into

Code: Select all

if(!player.ship.isValid || !this.ship.isValid) return; 
if(this.ship.position.distanceTo(player.ship.position) > 50000) return;
// exit the script if the explosion happens far from the player
That way the second if statement will not be reached if the player ship is non-existent (the function will bail out due to the first if statement being true and the return command getting executed), and so the error cannot happen. The other way would be to re-jig the statement a bit:

Code: Select all

if(!this.ship || (player.ship.isValid && this.ship.position.distanceTo(player.ship.position) > 50000)) return; // exit the script if the explosion happens far from the player
It amounts to the same kind of thing in the end.[/color]
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post by Griff »

Thanks for the script fix T! :D I've added in the 2nd example (where it's all on one line) and re-uploaded the oxp
User avatar
tachyon
Mostly Harmless
Mostly Harmless
Posts: 2
Joined: Fri Jul 01, 2011 7:09 pm

Re: Griff's normalmapped ship remakes

Post by tachyon »

Hello all. This is my first post here.

At first a big thank for your work, Griff. The ships are looking great.

Although I have a little problem which only seems to apply on the ship you start the game with:
It still looks "ugly". It uses the standard textures and not the new ones. I can buy a new Cobra Mk.III from the vendor which then uses the Griff textures. But the start Cobra Mk.III does not use them. Any ideas what may cause this.

PS: Maybe this issue has already been discussed here, but I don't know what to search for and reading 86 pages is somewhat cumbersome.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Griff's normalmapped ship remakes

Post by Cody »

Hi tachyon and welcome... this post should help you.
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!
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Griff's normalmapped ship remakes

Post by Mauiby de Fug »

Don't worry, it's a fairly common problem. Would it make sense for the solution to be added to the 1st post of this thread, on the assumption that newbies are more likely to check there first than trawl through 86 pages trying to find it?
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2483
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Griff's normalmapped ship remakes

Post by Griff »

that's a good idea, i'll edit my post on page one and add in a link to Capt. Murphy's guide
User avatar
tachyon
Mostly Harmless
Mostly Harmless
Posts: 2
Joined: Fri Jul 01, 2011 7:09 pm

Re: Griff's normalmapped ship remakes

Post by tachyon »

Thanks, that worked for me. I too think, that ir would be a good idea to add the hint on the first page.
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Griff's normalmapped ship remakes

Post by Capt. Murphy »

@ Griff - perhaps you could add it as a little add-on OXP for download (Default_Jameson_Ship_is_Griff_Cobra.OXP) on the assumption the not many newbies will be comfortable to immediately start making there own OXP.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Eldon
Dangerous
Dangerous
Posts: 68
Joined: Tue Jan 26, 2010 1:38 pm

Re: Griff's normalmapped ship remakes

Post by Eldon »

As an add on OXP it would probably be best as a shipdata-overrides.plist. On my system I've also got deepspace ships loaded so the stations and ships which haven't been replaced by Griff versions don't look so incredibly plain, but that means that if I just use a shipdata.plist the deepspace version gets used instead of the Griff version.
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Griff's normalmapped ship remakes

Post by Capt. Murphy »

Thanks Eldon - spot on - I was in my first week of Oolite when I worked out the original trick and had to append the add-on OXP with a Z at the beginning to stop the Neolite version Cobra displaying. Load order is alphabetical in Windows, but not other OS's necessarily.... Just changed it to a shipdata-override.plist and it works irrespective of load order.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Post Reply