Jump to content

Help for getting a menu to toggle mod options


haytur

Recommended Posts

I know skyui doesnt work, so i have seen other mods that have different ways of doing mod options such as using a power or a item. I don't really have a solid idea on how to do this but I need to add in options to the mod I ported over. If anyone could help me i would GREATLY appreciate it.

 

Mod in question: http://www.nexusmods.com/skyrimspecialedition/mods/1863/?

Link to comment
Share on other sites

I'm working on something that can be used as a simple configuration system with SE until SKSE/SkyUI/MCM are available. It will use tokens the player can add or remove from a container to replace the actual MCM pages. My first draft of the idea (just to gauge user reaction to the approach) is in my Not So Fast Main Quest mod. The initial reaction has been positive (although I've decided that I need to use an Actor instead of Container to prevent an accidental "Take All" while looking at the container). I'm planning to switch it to use Books instead of MiscObjects to provide a place for better descriptions for each object and still working on a way to have multiple mods register themselves into some from of main configuration menu so we don't have to scatter random containers or actors all over Skyrim and worry about conflicts.

 

You can try that mod to see if the general idea seems reasonable to you. And here's a sample configuration script showing a way to set up that set of options. If you've written MCM configuration scripts this shouldn't be too hard to understand and I'm open to suggestions for ways to improve it. A very simple version where all options are toggles that should always been shown would be much less complicated.

 

 

ScriptName NSFMQ_ConfigExampleV4 extends CDC_ContainerModConfigV4
{Experimental demonstration of a very simplified, partial replacement for MCM configuration for SE.}

GlobalVariable Property NSFMQ_NoNegotiate Auto
QF_MQ104B_0002610C Property MQ104 Auto
QF_MQ106_00032926 Property MQ106 Auto
Quest Property MQ301 Auto

MiscObject Property NSFMQ_DragonDelayDays Auto
MiscObject Property NSFMQ_DelphineNoteDelayDays Auto
MiscObject Property NSFMQ_NoNegotiations Auto
MiscObject Property NSFMQ_PotionRewardMages Auto
MiscObject Property NSFMQ_PotionRewardAlways Auto

Event OnModConfigInit()
{This is called on mod initialization for anything you might need to do when the mod is first installed.}
	Debug.Notification("CMC Example Initializing")
	; filling all properties via script instead of the creation kit as an example just so I have something to do here
	MQ104 = Game.GetForm(0x2610C) as QF_MQ104B_0002610C
	MQ106 = Game.GetForm(0x32926) as QF_MQ106_00032926
	MQ301 = Game.GetForm(0x44C56) as Quest
	NSFMQ_NoNegotiate = Game.GetFormFromFile(0x3872, "NotSoFast-MainQuest.esp") as GlobalVariable
	NSFMQ_DragonDelayDays = Game.GetFormFromFile(0x4899, "NotSoFast-MainQuest.esp") as MiscObject
	NSFMQ_DelphineNoteDelayDays = Game.GetFormFromFile(0x489A, "NotSoFast-MainQuest.esp") as MiscObject
	NSFMQ_PotionRewardAlways = Game.GetFormFromFile(0x489D, "NotSoFast-MainQuest.esp") as MiscObject
	NSFMQ_PotionRewardMages = Game.GetFormFromFile(0x489C, "NotSoFast-MainQuest.esp") as MiscObject
	NSFMQ_NoNegotiations = Game.GetFormFromFile(0x489B, "NotSoFast-MainQuest.esp") as MiscObject
EndEvent


Event OnModConfigOpen()
{This event is used to set up the configuration system similar to the way MCM uses OnPageReset.
With this there's really only one option type which can act like a toggle, slider, or limited menu.}

; InitializeOptionValue is used to place tokens (with descriptive names) in the configuration container and
; in the player's inventory. The first argument is is the token object. The second is the number of tokens
; to place in the container to represent the current configuration status of the mod. The third option is
; always 1 for simple toggle options, the upper range for "slider" options, and a negative number for
; "menu" or "radio" style options in which only one of a group applies. All options with the same negative
; number need to be placed together. (I'm still working on a way to make this type of thing easier to do.
; Right now since the Always option is listed first it will override the Mages option if both are present
; and if neither is present the PotionReward setting will be set to 0.)

	if !MQ104.MQ103.IsStageDone(200)  ; set up a "slider" (0 - 101) if haven't already seen the first dragon
		InitializeOptionValue(NSFMQ_DragonDelayDays, ScaleNegToMax(MQ104.NSFMQ_DragonDelay, 101), 101)
	endif
	if !MQ106.IsStageDone(5) ; set up a "slider" (0 - 101) if haven't already talked to Delphine about being Dragonborn
		InitializeOptionValue(NSFMQ_DelphineNoteDelayDays, ScaleNegToMax(MQ106.NSFMQ_DelphineNoteDelay, 101), 101)
	endif
	if !(MQ301.IsStageDone(30) || MQ301.IsStageDone(40)) ; toggle for whether the Civil War Negotiations should happen
		InitializeOptionValue(NSFMQ_NoNegotiations, (NSFMQ_NoNegotiate.GetValue() as bool) as int, 1)
	endif
	; choice of which reward Balgruuf should give the first time (game original is some piece of armor).
	InitializeOptionValue(NSFMQ_PotionRewardAlways, (MQ104.NSFMQ_PotionReward == 2) as int, -1)
	InitializeOptionValue(NSFMQ_PotionRewardMages, (MQ104.NSFMQ_PotionReward == 1) as int, -1)
	; The third option is implied here. If neither potion option is chosen armor will be used.
EndEvent


Function OnOptionValueChanged(Form option, int newValue)
	if option == NSFMQ_DragonDelayDays
		MQ104.NSFMQ_DragonDelay = ScaleMaxToNeg(newValue, 101)
	elseif option == NSFMQ_DelphineNoteDelayDays
		MQ106.NSFMQ_DelphineNoteDelay = ScaleMaxToNeg(newValue, 101)
	elseif option == NSFMQ_NoNegotiations
		NSFMQ_NoNegotiate.SetValue(newValue)
	elseif option == NSFMQ_PotionRewardAlways
		MQ104.NSFMQ_PotionReward = 2
	elseif option == NSFMQ_PotionRewardMages
		MQ104.NSFMQ_PotionReward = newValue
	endif
EndFunction

;/  alternate way to handle the potion reward settings (instead of processing them in the OnOptionValueChanged function)
Event OnModConfigClose()
	if GetChangedOptionValue(NSFMQ_PotionRewardAlways) > 0
		MQ104.NSFMQ_PotionReward = 2
	elseif GetChangedOptionValue(NSFMQ_PotionRewardMages) > 0
		MQ104.NSFMQ_PotionReward = 1
	else
		MQ104.NSFMQ_PotionReward = 0
	endif
EndEvent
/;


; two helper functions because in my original version of the mod my
; slider went from -1 to 100 and I can't do negative numbers this time.
int Function ScaleNegToMax(int n, int max)
	if n < 0 || n >= max
		return max
	else
		return n
	endif
EndFunction

int Function ScaleMaxToNeg(int n, int max)
	if n < 0 || n >= max
		return -1
	else
		return n
	endif
EndFunction

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...