Jump to content

[Configuration Menu] Configurable perk


Recommended Posts

Hello, I have question to anybody willing to help me. In the configuration menu you can change values of certain item for example. But can you make perk (from charactername.lua in scripts folder) switchable between on and off option ? I have no clue how to start it, so I am here for help.

 

	local handle = inst.sg.sg.actionhandlers[ACTIONS.PICK]
    handle.deststate = function(inst) return "doshortaction" end

 

Here's where did I get this perk

@no_signal's solution in this topic

 

Link to comment
Share on other sites


	{
		name = "BedrollCanSleepAtDay",
		label = "SR Usable At Day",
		hover = "Straw Roll: Usable at day?\nMake players be able to use Straw Rolls at daytime?",
		options =	{
						{description = "Enabled", data = true},
						{description = "Disabled", data = false},
					},
		default = false,
	},

 

Link to comment
Share on other sites

8 minutes ago, Ultroman said:

Expanding on the example I posted before, you'd do this to get the setting values.


local myValue = GetModConfigData("BedrollCanSleepAtDay")

 

additional information:
GetModConfigData only works in modmain (and in scripts you import via modimport from modmain). So it wont work within your custom prefab file.
To still get the value there, you can save it within the TUNING list or within your own GLOBAL variable.
So eg.
TUNING.MY_UNIQUE_VARIABLE_NAME = GetModConfigData("BedrollCanSleepAtDay")
And then use this TUNING within your prefab file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...