Jump to content

Pause Game?


Recommended Posts

For a mod i'm working on when you start a new game you need to choose some options before you begin. I'd like to pause the game at this point to make sure at least one option is selected so I don't have to check that condition everywhere else in my code. Is it possible to pause the game and how would I do it?

Link to comment
Share on other sites

I'm not 100% sure, but I'd check the GameEvent class for a pause/unpause event, or the HighLogic class for a pause game status.

Check the TimeWarp class to see if time is passing or not might "work", but it would be pretty hacky.

D.

Link to comment
Share on other sites

If you need to pause in the flight scene, just do this:


FlightDriver.SetPause(true or false);

However, It seems you want to make sure that an option is selected from a GUI before allowing the player to continue, which can be accomplished without pausing.

Simply use an InputLock, like so:


InputLockManager.SetControlLock(ControlTypes.All, "YourUniqueLockName");

Then, when an option is selected, and you want to restore user control, just remove the input lock, like so:


InputLockManager.RemoveControlLock("YourUniqueLockName");

Also, the ControlTypes enum works like a Bitmask, so choosing multiple ControlTypes is possible using the | operator.

I'm assuming that the option-choosing GUI will pop up when the space center loads, correct me if I'm wrong.

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