Jump to content

Create Difficulty Options?


Recommended Posts

It's fairly easy since all of the major components are baked in.  Take a look at this and search for  GameParameters.CustomParameterNode:

You access these values by using  'HighLogic.CurrentGame.Parameters.CustomParams<MyGameSettings>().myGameValue' (the example on the page above uses TestCustomParams for the game setting name and has several values including  MyBool).  So your module would look something like this:

public class ExplodeParams : GameParameters.CustomParameterNode
{
... bunch of stuff to name and define the difficulty parameter node

      [GameParameters.CustomParameterUI("Allow Explosions?", toolTip = "Enable explosions!")]
      public bool explosionsEnabled = true;

... more stuff for difficulty presets
}



public class ModuleExplode : PartModule
{
... bunch of stuff about when to trigger explosions

	public void ExplodeIt()
	{
		if(HighLogic.CurrentGame.Parameters.CustomParams<ExplodeParams>().explosionsEnabled)
			this.part.explode();
	}
}

 

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