Page 50 of 117

Re: Scripters cove

Posted: Mon Jul 30, 2012 8:23 pm
by CaptSolo
I'm a total noob with scripting, but I would like to know what event or condition that checks to see what kind of station the player has docked with? To be more specific, what event handler is passed when the player has docked with a rock hermit?

Re: Scripters cove

Posted: Mon Jul 30, 2012 8:41 pm
by Thargoid
The two pages you want as reference are Javascript World Script Events and Javascript Ship Script Events.

The former are basically events that happen to the player (or the player ship), in world scripts which run in the background for the player. The latter are scripts associated with (usually NPC) ships and stations.

So specifically for your question, you want the events this.shipWillDockWithStation(station) and this.shipDockedWithStation(station). In both cases station is the identify of the station you docked with. So you could use the event to trigger a check using station.hasRole to see if that matches the role of a rock hermit in this case (via an if statement check) and then if true act on that accordingly.

WillDock occurs just prior to docking (at the beginning of the rings effect) and Docked occurs after docking (after the rings). See the links above for more details.

Re: Scripters cove

Posted: Wed Aug 01, 2012 1:25 am
by CaptSolo
Thanks, Thargoid. My bare bones main script for handling this task works.

Re: Scripters cove

Posted: Thu Aug 02, 2012 7:10 pm
by Commander McLane
Ahruman wrote:
Commander McLane wrote:
Okay, here's a tricky one: is there a way to transfer information across a startUp event?
If so, it’s a bug.
I've got an alternative solution. I found out that I can display a mission screen after the player died, triggered by the shipDied event, which is totally sufficient for my purpose. The only downside seems to be that no model can be displayed at this point (probably because the player isn't docked).

Re: Scripters cove

Posted: Thu Aug 02, 2012 7:39 pm
by Cody
Commander McLane wrote:
I found out that I can display a mission screen after the player died, triggered by the shipDied event
<looks up, intrigued>

Re: Scripters cove

Posted: Wed Aug 08, 2012 4:11 pm
by CommonSenseOTB
Commander McLane wrote:
I found out that I can display a mission screen after the player died, triggered by the shipDied event
That's very cool, I can think of many uses for that. :)

Re: Scripters cove

Posted: Thu Aug 09, 2012 9:05 am
by Eric Walch
Commander McLane wrote:
I found out that I can display a mission screen after the player died, ....
But, who is going to read that screen. The player is dead after all..... :lol:

Re: Scripters cove

Posted: Thu Aug 09, 2012 9:17 am
by Rese249er
Quick question: how would one script a forced change to the player's ship to a point along a vector?

I'm attempting to create an OXP with equipment designed to keep the player following the currently locked target, intended as an assist for various escort contracts.

Re: Scripters cove

Posted: Thu Aug 09, 2012 12:55 pm
by Commander McLane
Rese249er wrote:
Quick question: how would one script a forced change to the player's ship to a point along a vector?
Image player.ship.orientation is your friend. But it's a quaternion, not a vector.

Note, however, that the player can change the orientation of their ship any time, with just a fingertip.

Re: Scripters cove

Posted: Thu Aug 09, 2012 1:06 pm
by Rese249er
Distance is a greater concern for my purposes.

If I wanted just orientation, I'd use Target Tracker and be done with it.

I'm actually wanting to keep the script from doing anything with player.ship.orientation. My intention is for the player to be able to yaw, pitch and roll while keeping a set distance from the target. The name of the OXP will be Grapple Beam.

Re: Scripters cove

Posted: Thu Aug 09, 2012 9:20 pm
by Commander McLane
Seems I misread the question.

If you want to position the player ship, then it's Image player.ship.position (reading the documentation helps, by the way).

Re: Scripters cove

Posted: Thu Aug 09, 2012 9:26 pm
by Rese249er
... I see... Now to figure out how to translate that into an OXP equipment...

Re: Scripters cove

Posted: Fri Aug 10, 2012 1:46 am
by Wildeblood
The easiest way would be to grab Okti's tractor beam equipment (not Thargoid's tractor beam which works differently), which keeps the target at a position fixed relative to the player, and reverse the polarity of the plasma conduits.

Re: Scripters cove

Posted: Fri Aug 10, 2012 2:25 am
by Rese249er
Wildeblood wrote:
...grab Okti's tractor beam equipment...
Link please? Seems just about all the code I use is ripped off his work.

Re: Scripters cove

Posted: Fri Aug 10, 2012 7:24 am
by Smivs
Okti's tractor beam is awarded during the Coyote's Run mission. :)