Scripters cove

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

Moderators: winston, another_commander

User avatar
CaptSolo
---- E L I T E ----
---- E L I T E ----
Posts: 909
Joined: Wed Feb 23, 2011 10:08 pm
Location: Preying Manta
Contact:

Re: Scripters cove

Post 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?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Scripters cove

Post 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.
User avatar
CaptSolo
---- E L I T E ----
---- E L I T E ----
Posts: 909
Joined: Wed Feb 23, 2011 10:08 pm
Location: Preying Manta
Contact:

Re: Scripters cove

Post by CaptSolo »

Thanks, Thargoid. My bare bones main script for handling this task works.
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 »

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).
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 »

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>
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
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Scripters cove

Post 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. :)
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
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 »

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

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.
Got all turned around, lost my nav connection... Where am I now?
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 »

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.
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 »

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.
Got all turned around, lost my nav connection... Where am I now?
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 »

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).
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 »

... I see... Now to figure out how to translate that into an OXP equipment...
Got all turned around, lost my nav connection... Where am I now?
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2409
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: Scripters cove

Post 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.
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 »

Wildeblood wrote:
...grab Okti's tractor beam equipment...
Link please? Seems just about all the code I use is ripped off his work.
Got all turned around, lost my nav connection... Where am I now?
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Scripters cove

Post by Smivs »

Okti's tractor beam is awarded during the Coyote's Run mission. :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply