Jump to content

automatically load save and flight scene at startup


Recommended Posts

During plugin development, it's useful to have the game automatically load a save file and start the flight scene with a specific vessel, each time the game is started.

I had some code that did just that, I think it was borrowed from the AutoLoadGame mod (https://github.com/allista/AutoLoadGame) but maybe it was from somewhere else. Anyway, it worked on old KSP versions, but it doesn't work on 1.7. When I call, from the main menu HighLogic.LoadScene(GameScenes.SPACECENTER), it does display the space center, but something is broken and I can't click on any building or do anything.

Does anyone know how to do this kind of thing in a recent KSP version?

Edited by Youen
Link to comment
Share on other sites

  • 3 weeks later...

So no one uses this kind of technique for faster iterations during mod development? Or is there a better place to ask?

Does anyone use the LoadScene method from the main menu? Is it supposed to work?

Thanks for any hint.

Link to comment
Share on other sites

I'd say you should load a game somehow before switching to the space center.

After a quick browse of the docs, I'd say you can try something like GamePersistence.LoadGame(...).Load();

Here's a quick GitHub search to find some examples: https://github.com/search?l=C%23&q=GamePersistence.LoadGame&type=Code

Edited by peteletroll
Link to comment
Share on other sites

On 6/24/2020 at 11:59 AM, Youen said:

During plugin development, it's useful to have the game automatically load a save file and start the flight scene with a specific vessel, each time the game is started.

I had some code that did just that, I think it was borrowed from the AutoLoadGame mod (https://github.com/allista/AutoLoadGame) but maybe it was from somewhere else. Anyway, it worked on old KSP versions, but it doesn't work on 1.7. When I call, from the main menu HighLogic.LoadScene(GameScenes.SPACECENTER), it does display the space center, but something is broken and I can't click on any building or do anything.

Does anyone know how to do this kind of thing in a recent KSP version?

QuickStart does exactly that: https://spacedock.info/mod/110/QuickStart

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