Jump to content

Can I leverage another plugin's MCM to modify its behavior?


Recommended Posts

I wrote a plugin that isn't compatible with TrueHUD's Recent Loot feature. This plugin has an MCM toggle to turn it on and off. Is it possible for my plugin to test whether this feature is enabled and selectively disable it temporarily? The problem I'm having is that loot messages are appearing for items appearing in the players inventory that are temporary and don't actually exist there for the player to access.

Link to comment
Share on other sites

Answering the title: Yeah if you are saavy enough you can cleverly piggyback off of anything, native or mods, to do whatever you want. If that MCM mod uses GlobalVariables for the setting in question, you call a GetValue(). You can also change the value via script. If they use properties, you can call/change those with (WhateverQuest as NameOfTheScript).PropertyName. Etc

Link to comment
Share on other sites

It really depends heavily on how a particular MCM is implemented.    In most cases, you need to go into the MCM script source, look for handling of that particular setting, and determine where it is being stored.    

Fairly often it is stored within a property of some script.   Either MCM script itself or some other "central" script.    Suppose you looked into TrueHUD scripts and saw that this particular item is stored in a Bool property called 'EnableRecentLoot', in the script named TrueHUD_MCM, attached to TrueHUD_MCM_Quest, which has FormID 0x800 within TrueHUD.esl  (WHICH IS NOT ACTUALLY THE CASE)

Then you would need something like:

Bool isTrueHUDRecentLootEnabled = false
If Game.IsPluginInstalled("TrueHUD.esl")
	Quest _quest = Game.GetFormFromFile(0x800, "TrueHUD.esl") as Quest
	If _quest && _quest as TrueHUD_MCM
		isTrueHUDRecentLootEnabled = (_quest as TrueHUD_MCM).EnableRecentLoot
	EndIf
EndIf

Caveat - to compile the above, you would need source code of  TrueHUD_MCM script, which is not in the mod - so you would have to use Champolion to decompile it.
 

Instead, you may notice that TrueHUD actually relies on MCM Helper mod to manage its MCM.    So, if TrueHUD is installed, you can be quite certain that MCM Helper is installed as well.   You will need to install it, as well as its 'MCM SDK' file.   If you examine TrueHUD structure, Data\MCM\Config\TrueHUD\config.json, you can see that it has:   
 

{
	"id": "bEnableRecentLoot:General",
	"text": "$TrueHUD_EnableRecentLoot_OptionText",
	"type": "toggle",
	"help": "$TrueHUD_EnableRecentLoot_InfoText",
	"valueOptions": {
		"sourceType": "ModSettingBool"
	}
}

That "id" is what's important.

Then, in your script, all you need is:

Bool isTrueHUDRecentLootEnabled = false
If Game.IsPluginInstalled("TrueHUD.esl")
	isTrueHUDRecentLootEnabled = MCM.GetModSettingBool("TrueHUD", "bEnableRecentLoot:General")
EndIf

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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