The Shipyard at the End of the Ooniverse. Modeller's bit.

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

Moderators: winston, another_commander

Post Reply
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

DaddyHoggy wrote:
@Thargoid found the thread it's here: https://bb.oolite.space/viewtopic.php?t= ... sc&start=0

HTH
Thanks. I think you've just saved me at least one problem (offender cargo pods). But as usual this thread and the board are giving many very useful hints, tips and helps to a confused alien. Now got a lot of things to play with and try, and probably annoy the other half by sitting at the PC all night (again) :oops:

It definitely sounds like your work was on a similar line to mine, so who knows maybe you could do a re-skin on it and rebirth the Tescoo ;) presuming of course I can get the thing working myself...

Added - ship coding are now switched over to JS (except demoships.plist, I presume that has to stay XML as I've not seen it JS anywhere?). Not a very hard re-code, was most pleasantly surprised (says he before he's been able to actually test they still work ;) ).

I'm gonna be glad when I can finally send this OXP on it's way, although after all that it'll just be 6 new ships I guess...
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Maybe a subentity can't spawn anything. It could be hard-coded. What should work is letting the mother spawn something with a JS command.

Give the subentity a ship-script like:

Code: Select all

this.shipDied = function() 
{ 
    this.ship.owner.spawn("My_Item")
    player.commsMessage("There goes my subentity.", 5);
}
This should work. I tested it with a message and with setting the owners fuel level.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Looks good to me, the code below works, to generate 2 cargo pods per sub-entity.

The only thing I'd like to do now is randomise the number of pods. What would I have to replace the "2" with to do that? I tried d25_number to generate 1-25, but all it did was make Oolite hang... :roll: I'd also like to use the same randomisation for the number of escort ships in the shipdata.plist (now in JS).

Anyway, thanks for the code pointer :)

Code: Select all

this.name			= "conger_script";
this.author			= "Original script by Kaks (Kestrel&Falcon OXP), mangled here by Thargoid with invaluable advice from Eric Walsh";
this.copyright			= "Creative Commons: attribution, non-commercial, sharealike.";
this.description		= "Conger ship cargo pod actions and reactions";
this.version			= "0.2";

this.subpleas={
	'conger_pod_1':'[pod-1-destroyed]','conger_pod_2':'[pod-2-destroyed]',
	'conger_pod_3':'[pod-3-destroyed]','conger_pod_4':'[pod-4-destroyed]'};

	
this.shipSpawned = this.shipWillLaunchFromStation = function(){
	let e=this.ship.subEntities;
	e.items= function(){for (let i = 0; i < this.length; i++) yield this[i];}
	for (let i in e.items()) {
		i.script.plea= this.subpleas[i.primaryRole];
		i.script.owner=this.ship;	//1.70 workaround
		i.script.shipDied = function(){
			//all instances of 'this' inside this function refer to the subentity script
			this.owner.call('commsMessage:',this.plea);
			this.owner.call('spawn:', 'cargopod 2');
		};
	}
}

this.shipDied = function()
	{

	this.ship.call('spawn:', 'explosive_shrapnel 6');
	}


[/color]
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

The random generation function in Javascript is called Math.random(). This will create (pseudo)random numbers between 0 and 1. If you want to create whole numbers between 1 and 25 (that's quite a lot, isn't it?), you would have to multiply this by 25 and then round up to the next whole number. So:

Code: Select all

Math.ceil(Math.random()*25)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Thanks, will give it a try later.

The 1-25 range is cargo per hauler pod (the ship has 4 pods). The ship is envisaged as performing the same kind of function as an Anaconda, so the overall load range would be similar. But once it's running a beta-test can see if it's too much in practice.

In terms of escorts, I was thinking of max 4, or perhaps 6.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I just noticed the code contains a "call". This is a method to use old type legacy scripts in JS. It will not work with 1.72. (Kestrel&Falcon OXP has to be updated before 1.72)

Code: Select all

this.owner.call('commsMessage:',this.plea); 
this.owner.call('spawn:', 'cargopod 2'); 
should be replaced by:

Code: Select all

player.commsMessage('this.plea', 5); 
this.owner.spawn('cargopod', 2); 
and the last line should be:

Code: Select all

this.ship.spawn('explosive_shrapnel', Math.ceil(Math.random()*6));
Spawns a random number between 1 and 6 explosive_shrapnel's. But probably you want to spawn something else as the explosive_shrapnel is not in Oolite itself.

This should also work with 1.71 AND with 1.72

EDIT: Your this.plea contains expandable text. So I think you must use: player.commsMessage(expandDescription('this.plea'), 5); instead of the line above.
Last edited by Eric Walch on Wed Aug 13, 2008 2:02 pm, edited 1 time in total.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Thargoid wrote:
The 1-25 range is cargo per hauler pod (the ship has 4 pods). The ship is envisaged as performing the same kind of function as an Anaconda, so the overall load range would be similar.
The load range, yes. But does an Anaconda actually spawn that much cargo pods when killed? Just asking, it's a while since I've annihilated my last unsuspecting Anaconda...
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I've had a few which have generated quite a cloud of pods. But your point is a valid one, I've downgraded it to 1-15 units per pod, and may lower it a little more once I've tried it in proper testing. And given it's a random number (well 4 of them), the bonanza hauls are going to be balanced by the meagre ones.

The other thought was that it gives the player a dilemma, do they chase the pods down and let the remainder of the craft go, or keep on the craft and then have to spend time rounding up all the cargo from all four pods...
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Eric Walch wrote:
EDIT: Your this.plea contains expandable text. So I think you must use: player.commsMessage(expandDescription('this.plea'), 5); instead of the line above.
Sadly it doesn't quite work. The comms message is "this.plea" (literally that as text, unexpanded) using either the above or the original.

Editted to add - sorted it, your code above, without the single quotes around the this.plea works as it should :D Yet again many thanks!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

OK, job done, my first ever OXP is complete. Just some ships, but you gotta start somewhere!

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

Post by DaddyHoggy »

well done. I will put it on my list!
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
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

Post by Griff »

very good tutorial for creating battle scarred metal textures
http://www.arildwiro.com/tutorials/mate ... metal.html

His main page http://www.arildwiro.com/ has links to a few more of his tutes including some modeling and UV unwrapping ones although they may be 3D Studio Max specific.

Loads and loads of graphics tutorials here covering a lot of subjects & software,
http://www.computerarts.co.uk/tutorials ... _animation
there are a lot of pop-ups and flash animations on this site though so it can be annoying to search through.
User avatar
Star Gazer
---- E L I T E ----
---- E L I T E ----
Posts: 633
Joined: Sat Aug 14, 2004 4:55 pm
Location: North Norfolk, UK, (Average Agricultural, Feudal States,Tech Level 8)

Post by Star Gazer »

Blimey!! Certainly shows off what the pros can achieve! Some extraordinarily beautiful end-effects.

The technique seems to be a transposition of painting metal AD&D models, with layering and dry brushing to produce realistic metal textures. And I really need to master the use of masks for layering effects!

Nice site!
Very funny, Scotty, now beam down my clothes...
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Griff wrote:
very good tutorial for creating battle scarred metal textures
http://www.arildwiro.com/tutorials/mate ... metal.html

His main page http://www.arildwiro.com/ has links to a few more of his tutes including some modeling and UV unwrapping ones although they may be 3D Studio Max specific.
its quite cool, but note the shineniness of the armour... is a max only thing... you would have to remove that before export and use oolite shaders to archive something similar....

while 3d max unwrap is quite good, its default flattening breaks up the faces, making it quite hard to use it in a paint program...

the unwrapping is really tedious work... especially for complex models...

on my first read, i thought that texporter did a flatten first... but it seems it just exports the uvmap... gonna try it though, since max render to texture is allways just a tad unprecise...
Bounty Scanner
Number 935
User avatar
chomann
Above Average
Above Average
Posts: 29
Joined: Mon Oct 27, 2008 6:21 pm

external views

Post by chomann »

this is my first ship build, and im having problems with the external views, meaning when I hit "v" the views do not cycle. The ship shows up fine in the shipyard, and on the loading screen but i can't get a single external view of it while in game. Is there some "golden Rule" for setting the views or a certain range that I need to stay with in for the views to work. If i use custom views and set my own do the coordinates go in x,y,z order and are they in meters just like wings3d? Thanks
"To boldly go where no man has gone before, and drop off my Trumbles." ~ Ashby
Post Reply