Page 53 of 118

Re: Scripters cove

Posted: Thu Oct 18, 2012 7:54 am
by Switeck
Try Switeck's Shipping OXP. You will need to give the Police Vipers (or whatever) cargo capacity above zero and a fuel scoop though.

Re: Scripters cove

Posted: Thu Oct 18, 2012 8:00 am
by Rese249er
Grazie. I've had that for some time.

Re: Scripters cove

Posted: Sat Nov 03, 2012 4:23 pm
by Rorschachhamster
Hi all!

I just started with my first OXP, a ship. I built it in wings3d, turned it upsite-down, when it was orientated to the wrong end of the y axis (*cough*), and coded the script after the how-to at the wiki, and then I looked at it's tiny size and made the model a lot bigger, and it finally works. 8)
The problem is, when I put into the code the coordinates that I can pinpoint in the original model in wings3d, it won't work as expected. :?
E.g., if I put the coordinates I took for the muzzle of the laser from the model in wings 3d into weapon_position_forward, I have x -4.065 y -2.58 and z 26.42. BUT this comes out a long way too low, too starboardish :oops: and too much in front. I started to try to slowly approach the correct position by reloading, changing the coordinates, reloading... etc., but... :x I am getting frustrated. :x
Well, at least the exhaust was easy... :roll:
Somebody here can give me a hint? Please? :D

Re: Scripters cove

Posted: Sat Nov 03, 2012 4:37 pm
by Commander McLane
Generally the coordinates in Wings3D are the same as in Oolite. So: 1 unit in Wings = 1 meter in Oolite.

Obvious question: have you got your x- and y-axes right? x is left-right, y is up-down.

Also, I think there's still an inconsistency between Wings3D and Oolite, in that the x-axis points in the opposite direction. Thus, x -4.065 in Wings will change into X 4.065 in Oolite.

Re: Scripters cove

Posted: Sat Nov 03, 2012 4:41 pm
by Rorschachhamster
Tha x axis thing I already realized the hard way. :lol: Thanks.

I think I'll try to resize that ship again (could be a little bigger, still) and then try it with the new coordinates... wish me luck. :wink:

Re: Scripters cove

Posted: Sat Nov 03, 2012 5:04 pm
by Commander McLane
What strikes me with your laser coordinates is that they're excentric. x = -4.065 means that the laser muzzle is not in the centre of the ship, but slightly to the left of the centre. Is this deliberate? If it's a single laser, I'd usually suspect it to be at x = 0. For the forward view position I'd also usually expect x = 0. Second, I'd expect view position y > weapons position y. Thus the laser appears to originate from the bottom centre of the screen.

Are you using external views for testing the positions? I'd recommend that. When using the normal forward view, you also have to take the view position into account.

Finally: it is not overly important that the laser's z position is correct. On the contrary, I'd advise that you let the laser beam begin somewhere inside the ship, thus with z < 26.42. This is to make sure that the beam originates indeed from the bottom of the screen. If you put the laser origin too much forward, inside the field of view of the screen, the player will see the beam starting abruptly at some point on the screen, which looks odd in my opinion. Here two screenshots for comparison:

First my normal shipdata, weapons position z about 15m behind view position z:
Image

Then a tweaked shipdata, weapons position z about 15m in front of view position z:
Image

To me the second one looks odd. I like the first one better.

Re: Scripters cove

Posted: Sat Nov 03, 2012 5:23 pm
by Rorschachhamster
The right tilt of the originating laser is deliberate (the model has a laser slightly on the right from the main body). I'll try with the z axis, I was irrational afraid, the laser could hurt my ship... :oops:

I just tried to use the coordinates, this time, the laser just originated too much in front. So, if it doesn't harm my ship :oops: , it should work by reducing the z axis just a little more... Missiles start still to much away from where I want them, but the exhaust fit s spot on... :roll: :lol:

Re: Scripters cove

Posted: Sat Nov 03, 2012 5:38 pm
by Commander McLane
Useful to know: the laser position moves back on the z-axis when the ship moves. The faster the speed, the more the laser moves backwards. The reason is that your ship has already moved forward a little when the laser gets drawn, after you press the button. It is especially noticeable for the aft laser, which will look like the second screen shot at high speed, if it's z-position isn't sufficiently greater than the view position z-position.

This is also the reason why side lasers "wander" towards the back of the ship when flying at speed.

Re: Scripters cove

Posted: Sat Nov 03, 2012 6:59 pm
by Eric Walch
Rorschachhamster wrote:
Missiles start still to much away from where I want them,.... :roll: :lol:
Missiles are not fully following the coordinates. If they are positioned inside the bounding box, they are moved outward on addition. And for some ships, the bounding box is much bigger than the ships surface.

Re: Scripters cove

Posted: Sat Nov 03, 2012 10:22 pm
by Rorschachhamster
Eric Walch wrote:
Missiles are not fully following the coordinates. If they are positioned inside the bounding box, they are moved outward on addition. And for some ships, the bounding box is much bigger than the ships surface.
Ok. Good to know.

Is there an easy way to alternate the place the missiles start from? Say, first missile starts on the right side, the next on the left and ad finitum? Or even just random starting from one side or the other?

Re: Scripters cove

Posted: Sat Nov 03, 2012 10:40 pm
by Eric Walch
What is easy? It depends on the person. :D

Since 1.75 we have an event for the ship firing a missile.

Code: Select all

this.shipFiredMissile = function (missile, target){}
When you give the ship a shipScript, you can use this to relocate missiles on launch and override the original location. :wink:

Re: Scripters cove

Posted: Sat Nov 03, 2012 10:43 pm
by Thargoid
If you want an example of one, Griff and I put just such a thing together a while back (the Cobra with external missiles). It's the second one in Griff's download area (here), although you will probably need the rest of his normal map ship pack installed too.

Re: Scripters cove

Posted: Sat Nov 03, 2012 10:45 pm
by Cody
Thargoid wrote:
If you want an example of one, Griff and I put just such a thing together a while back (the Cobra with external missiles).
That Cobra is great - I always enjoy watching those missiles launch, especially up-close!

Re: Scripters cove

Posted: Sat Nov 03, 2012 10:54 pm
by Rorschachhamster
Thargoid wrote:
If you want an example of one, Griff and I put just such a thing together a while back (the Cobra with external missiles). It's the second one in Griff's download area (here), although you will probably need the rest of his normal map ship pack installed too.
I have his ships installed!
And I will look into it. Downloading...

At the moment, the missiles start a few meters away from their launchpad, (outside the bounding box, probably :) ), but as I finally managed to put them at least right in front of the launch pad the look of it is ... well, acceptable.

Edit: OK, that's definitely out of my league... Is there a way to built a second missile_launch_position into the shipdata.plist and then alternate?

Re: Scripters cove

Posted: Sun Nov 04, 2012 3:10 am
by Wildeblood
Eric Walch wrote:
What is easy? It depends on the person. :D

Since 1.75 we have an event for the ship firing a missile.

Code: Select all

this.shipFiredMissile = function (missile, target){}
When you give the ship a shipScript, you can use this to relocate missiles on launch and override the original location. :wink:
Something like...?

Code: Select all

this.shipFiredMissile = function (missile, target) {
if (this.launch == "odd")
   {
   this.launch = "even";
   missile.position.x = missile.position.x - 20;
   } 
else // this.launch == "even"
   {
   this.launch = "odd";
   missile.position.x = missile.position.x + 20;
   }
}