Jump to content

Trying to Understand MCM


nekollx

Recommended Posts

So I'm making a MCM Menu for my mod but i'm having trouble figuring out a couple things, not with the script itself but nuances. My mod Adds new racial skills as well as several Quality of Life additions and I'm just not sure what am i suppose to attach a MCM script to so it will load?

(since in Skyrim CK you need to attach a script to a object first off instead of Fallout where you write a script first, set one of 4 types, then ties that to the object after)

 

My other question is more about specific commands, one MCM option changes the damange of a power (Khajit claws for example) what is the code i would use to do something like:

 

Set KhajitClaws.Damage = 15?

 

another part of the mod needs to check the players race and see what they have. In a more specific Example of Psydo Code:

 

If (PlayerRace == Khajiit)

if (Player.hasSkill == NightEyes)

player.removeSkilll NightEyes

if (player.hasSkill != AdaptiveNightKhajiit)

player.addSkill = AdaptiveNightKhajiit

endif

endif

endif

 

I have a few variations on that concept but once i know the right variables and methods i'll be fine, i'm just not sure what items fit that bill.

Link to comment
Share on other sites

  On 9/1/2013 at 12:18 AM, nekollx said:

(since in Skyrim CK you need to attach a script to a object first off instead of Fallout where you write a script first, set one of 4 types, then ties that to the object after)

Incorrect. You can write scripts in an external editor such as UltraEdit and compile them from within the editor via the Papyrus command-line compiler (if you have configured the editor correctly) - without having to attach the script in the CK. But besides that, you should attach the MCM menu configuration script to a Quest form:

 

In the Object Window, navigate to Quest under the Character category. Create a new quest by right-clicking on the list and choosing 'New'. Make sure that "Start Game Enabled" is enabled in the "Quest Data" tab and that "Run Once" is not. Attach your MCM menu configuration script to the Quest via the Scripts tab.

 

All that the MCM options should basically do is set global variables (eg/ set a variable to 1 if an option is enabled), or perhaps set Properties on scripts that you have put elsewhere. Then the scripts that you have put on specific items or actors should read the value of the global variables or Properties and decide what to to.

 

Example from skyBirds mod:

 

GlobalVariable Property _APB_MaxBirdSpawns auto		; maximum number of birds that any spawner can spawn

Event OnOptionSliderOpen(int option)
	if option == bOID
		bVal = _APB_MaxBirdSpawns.GetValueInt()
		SetSliderDialogStartValue(bVal)
		SetSliderDialogDefaultValue(default_bVal)
		SetSliderDialogRange(1, 20)
		SetSliderDialogInterval(1)
	endIf
EndEvent

Event OnOptionSliderAccept(int option, float value)
	if option == bOID
		bVal = value as int
		SetSliderOptionValue(bOID, bVal, "{0}")
		_APB_MaxBirdSpawns.SetValueInt(bVal)
	endIf
EndEvent
Then somewhere in my spawner script I have:

	GlobalVariable Property _APB_MaxBirdSpawns auto			; maximum number of birds that any spawner can spawn

Function Spawn()
	int quantity = _APB_MaxBirdSpawns.GetValueInt()
		;(the rest of my code not shown in this example)
EndFunction
Edited by steve40
Link to comment
Share on other sites

well what i'm mainly trying to do is use the MCM to add/remove powers to the player, and that seems easy enough right?

 

IE The below should work

	elseIf (a_option == _toggleAddClaws_B)
		_toggleStateAddClaws = !_toggleStateAddClaws
		SetToggleOptionValue(a_option, _toggleStateAddClaws)
			if (_toggleAddClaws_B == true)
				;check if player is not Khajiit, then check if has KhajitClaws Power, if they don't add it
				if ((PlayerRace != KhajiitRace) OR (PlayerRace != KhajiitRaceVampire) OR (PlayerRace != WerewolfBeastRace))
					if (!Game.GetPlayer().HasSpell(RaceKhajiitClaws))
					player.addSpell 000AA01E
					;Adds RaceKhajiitClaws to the player
					endIf
				endif
			elseIf (_toggleAddClaws_B == false)
				if ((PlayerRace != KhajiitRace) OR (PlayerRace != KhajiitRaceVampire) OR (PlayerRace != WerewolfBeastRace))
					if (Game.GetPlayer().HasSpell(RaceKhajiitClaws))
					player.RemoveSpell 000AA01E
					;removes RaceKhajiitClaws from the player
					endIf
				endif
			endif
Edited by nekollx
Link to comment
Share on other sites

  • Recently Browsing   0 members

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