Jump to content

How to program a teleporter mod?


Recommended Posts

Hi,

I have a couple questions on how I would program something like this:

- I've already made a "Teleporter" part that can hold 6 kerbals.

- I want to program it so you can:

1. Select any other Teleporter within 1000km

2. Hit a button and make the Kerbals disappear from the sending pad and reappear at the recieveing pad after a short delay.

3. Have small chance of catastrophic failure. (I.E. Death of all teleportees)

How would I do that?

Cheers,

              UbuntuLinuxKing

teleporter-transporter-star-trek.jpg?int

Link to comment
Share on other sites

Hi, I'm not a coder, but I do abuse other peoples code, and know my way around some of the mods I use and make things/parts for.   Now i've not come across anything that can really teleport anything anywhere/anytime with any precision , except for Kerbal Konstructs and Hyper edit,

With KK you can teleport any craft anywhere (seriously anywhere ) with kerbals onboard, to a precise, as defined by a transform location But only when launching a craft from VAB SPH,   Whereas Hyper edit can teleport anything anywhere while in game/not in editor mode, although precision landings are not, in my experience, that easy to achieve.  

It seems there's a bit of stuff there that may point you in the right direction,  while not the complete answer it's at least perhaps a clue as to how it can be done

Link to comment
Share on other sites

49 minutes ago, SpannerMonkey(smce) said:

Hi, I'm not a coder, but I do abuse other peoples code, and know my way around some of the mods I use and make things/parts for.   Now i've not come across anything that can really teleport anything anywhere/anytime with any precision , except for Kerbal Konstructs and Hyper edit,

With KK you can teleport any craft anywhere (seriously anywhere ) with kerbals onboard, to a precise, as defined by a transform location But only when launching a craft from VAB SPH,   Whereas Hyper edit can teleport anything anywhere while in game/not in editor mode, although precision landings are not, in my experience, that easy to achieve.  

It seems there's a bit of stuff there that may point you in the right direction,  while not the complete answer it's at least perhaps a clue as to how it can be done

Thanks! I considered utilising Hyperedit or parts of it in some way, but it can't do that.

Link to comment
Share on other sites

I would take a look at Haystack and Targetron to figure out how to display a list of vessels within 1000 km. I assume they loop through FlightGlobals.Vessels and calculate distances, but I haven't checked, so they might have found something more clever. You of course would apply the further filter that a vessel should only be shown if it has one of your parts on it with an empty crew slot, which I think you can do by inspecting objects under Vessel.parts.

Beyond that you'd probably want a custom right-click menu option to open that list, which I don't know enough to advise on. And you'd need to be able to add and remove crew from your part, for which Part.AddCrewMember and Part.RemoveCrewMember look promising.

Have you considered making the teleportation fail if the two endpoints don't have a clear line of sight? That might be more fun than purely random.

(BTW, I think the device in that image is called a "transporter," if that matters.)

Link to comment
Share on other sites

13 minutes ago, HebaruSan said:

I would take a look at Haystack and Targetron to figure out how to display a list of vessels within 1000 km. I assume they loop through FlightGlobals.Vessels and calculate distances, but I haven't checked, so they might have found something more clever.

Or you require the player to set the destination vessel as target. Then you only need to check the distance, and don't need a UI.

Edited by pellinor
Link to comment
Share on other sites

1 hour ago, HebaruSan said:

Have you considered making the teleportation fail if the two endpoints don't have a clear line of sight? That might be more fun than purely random.

(BTW, I think the device in that image is called a "transporter," if that matters.)

Thanks for the suggestions! I also know it's a transporter (I do watch Star Trek all the time) I just used "teleporter" to make the thread more approachable.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...