Page 6 of 24
Posted: Tue Aug 12, 2008 12:46 pm
by Thargoid
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)
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...
Posted: Tue Aug 12, 2008 5:16 pm
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.
Posted: Tue Aug 12, 2008 9:48 pm
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... 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]
Posted: Wed Aug 13, 2008 8:36 am
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:
Posted: Wed Aug 13, 2008 8:49 am
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.
Posted: Wed Aug 13, 2008 9:15 am
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.
Posted: Wed Aug 13, 2008 11:13 am
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...
Posted: Wed Aug 13, 2008 12:00 pm
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...
Posted: Wed Aug 13, 2008 8:49 pm
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 Yet again many thanks!
Posted: Sat Aug 16, 2008 6:17 pm
by Thargoid
OK, job done, my first ever OXP is complete. Just some ships, but you gotta start somewhere!
Introducing
The Aquatics. Enjoy...
Posted: Sat Aug 16, 2008 6:42 pm
by DaddyHoggy
well done. I will put it on my list!
Posted: Thu Aug 28, 2008 11:02 pm
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.
Posted: Sat Aug 30, 2008 12:29 pm
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!
Posted: Sat Aug 30, 2008 12:51 pm
by Frame
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...
external views
Posted: Thu Oct 30, 2008 3:19 am
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