Scripters cove

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

Moderators: winston, another_commander

Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Scripters cove

Post 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.
User avatar
Rese249er
---- E L I T E ----
---- E L I T E ----
Posts: 647
Joined: Thu Jun 07, 2012 2:19 pm
Location: Well, I WAS in G3...

Re: Scripters cove

Post by Rese249er »

Grazie. I've had that for some time.
Got all turned around, lost my nav connection... Where am I now?
User avatar
Rorschachhamster
---- E L I T E ----
---- E L I T E ----
Posts: 274
Joined: Sun Aug 05, 2012 11:46 pm
Contact:

Re: Scripters cove

Post 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
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:

Re: Scripters cove

Post 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.
User avatar
Rorschachhamster
---- E L I T E ----
---- E L I T E ----
Posts: 274
Joined: Sun Aug 05, 2012 11:46 pm
Contact:

Re: Scripters cove

Post 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:
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:

Re: Scripters cove

Post 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.
User avatar
Rorschachhamster
---- E L I T E ----
---- E L I T E ----
Posts: 274
Joined: Sun Aug 05, 2012 11:46 pm
Contact:

Re: Scripters cove

Post 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:
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:

Re: Scripters cove

Post 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.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Scripters cove

Post 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.
User avatar
Rorschachhamster
---- E L I T E ----
---- E L I T E ----
Posts: 274
Joined: Sun Aug 05, 2012 11:46 pm
Contact:

Re: Scripters cove

Post 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?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Scripters cove

Post 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:
Last edited by Eric Walch on Sat Nov 03, 2012 10:44 pm, edited 1 time in total.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Scripters cove

Post 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.
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: Scripters cove

Post 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!
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
Rorschachhamster
---- E L I T E ----
---- E L I T E ----
Posts: 274
Joined: Sun Aug 05, 2012 11:46 pm
Contact:

Re: Scripters cove

Post 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?
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Scripters cove

Post 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;
   }
}
Post Reply