Changelog
1.2
-Added fix for flickering/size changes when using default styles
1.1
-Improved fix for female shield-on-back rescaling. Will always update shield-on-back node, including after reloading a save.
Fresh install of XPMSE 4.7
New Game with ONLY XPMSE and its requirements enabled
WEAPONS FLICKER WHEN EQUIPPED
The permissions for XPMSE ask that we do not reupload/redistribute script files
THEREFORE IT IS UP TO YOU TO FIX YOUR FILES
AllGUD works perfectly fine without these fixes, this step is entirely optional
This article Includes fixes for XPMSELib, XPMSEWeaponStyleScaleEffect, and RaceMenuPluginWeapons.
Quick and dirty how-to:
(Important: Scripts for Skyrim LE go in 'Data\Scripts\Source\'. Scripts for Skyrim SE go in 'Data\Source\Scripts'. If they do not appear in the CreationKit they are in the wrong place.)
1. Extract the source scripts for skyrim from Scripts.rar in the Data folder of Skyrim.
2. Extract the source scripts from SKSE and overwrite conflicting Skyrim scripts
3. Extract the source scripts from any additional mods that XPMSE has listed as a requirement (NiOverride, Racemenu, FNIS)
4. Extract the source scripts from XPMSE.
5. Make edits by REPLACING the functions in XPMSE's scripts with the code below.
6. Compile scripts using the Creation Kit.
Gameplay -> Papyrus Script Manager -> Right-Click Compile Scripts.
If you require assistance, consult the Creation Kit wiki first to see if you can't find an answer.
IMPORTANT: Article formatting may have added new lines where there should not be new lines. If you have an error for "no viable alternative at input '\\n'" Go to the start of the next line and hit backspace.
Parentheses pairs must start '(' and end ')' on the same line.
PM me if you get this error and I'll try to fix the article formatting again.
XPMSELib.psc fixes for weapon flickering.
This is required. All the time. Even without AllGUD.
When NiOverride.UpdateNodeTransform fires, whatever is attached to that node will briefly flicker. Temporarily moving to another location, and then moving back.
XPMSE will fire this off despite nothing having changed.
This fix checks the current node scale and parent node against the new values, before attempting to update them.
Groovtama's Sage Advice: "Nah those are no fixes, some are changes just to make his own code work, but the changes are not supposed to be there (I have local helper functions for a reason) because it breaks s*** for other modders or just plainly breaks itself with older RM/SKEE versions, or does nothing at all."
Counterpoint: AllGUD does not call upon either of these functions. Any mod that uses these XPMSELib functions will have the 'XPMSE flicker'. Old versions are old versions for a reason.
Find and replace the original functions with these
Function SetNodeScale(Actor akActor, bool isFemale, string nodeName, float value, string modkey) global
If(NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, modkey) != value)
If value != 1.0
NiOverride.AddNodeTransformScale(akActor, false, isFemale, nodeName, modkey, value)
NiOverride.AddNodeTransformScale(akActor, true, isFemale, nodeName, modkey, value)
Else
NiOverride.RemoveNodeTransformScale(akActor, false, isFemale, nodeName, modkey)
NiOverride.RemoveNodeTransformScale(akActor, true, isFemale, nodeName, modkey)
Endif
NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
Endif
EndFunction
Function SetNodeParent(Actor akActor, bool isFemale, string nodeName, string newParent) global
If (NiOverride.GetNodeDestination(akActor, false, isFemale, nodeName) != newParent)
If (newParent != "")
NiOverride.SetNodeDestination(akActor, false, isFemale, nodeName, newParent)
NiOverride.SetNodeDestination(akActor, true, isFemale, nodeName, newParent)
Else
NiOverride.RemoveNodeDestination(akActor, false, isFemale, nodeName)
NiOverride.RemoveNodeDestination(akActor, true, isFemale, nodeName)
Endif
NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
NiOverride.UpdateNodeTransform(akActor, true, isFemale, nodeName)
Endif
EndFunction
XPMSEWeaponStyleScaleScriptEffect.psc fix for flickering/size-changing equipment when using default styles
This is required even when not using AllGUD
This is related to the XPMSELib fixes, as the Restyle effect calls the SetNodeParent function in multiple places. This flicker in particular rears its head because the Restyle typically uses the following pattern in its code:
SetNodeParent(Actor, gender, NiNode, NiNode_Default)
SetNodeParent(Actor, Gender, NiNode, "")
Which obviously causes UpdateNodeTransform to trigger twice. EVERY TIME EQUIPMENT USING A DEFAULT STYLE IS EQUIPPED.
In every location where this pattern is present, comment out the line for
SetNodeParent(Actor, Gender, NiNode, "")
by adding a semi-colon in front of it.Note: This is a new addition and has not been fully tested, when testing it for NiNode_Shield_Back, it successfully stopped flickering for female NPCs, which was most noticeable since it briefly changed the scale as well. If you notice any behavior you think may have been caused by this fix, leave a comment!
XPMSEWeaponStyleScaleScriptEffect.psc fix for female shield-on-back rescaling
This is required for Shield-on-Back mods.
XPMSE's current rescaling code switches the size of the ShieldBack node to two different values. Every. Single. Update. Making it constantly change size between the incorrect scale, and the correct scale.
This fix will change it to ONE value. And also updates the size when the shield isn't equipped in the hand; So shield sizes will be the same before and after loading a game.
Groovtama's Sage Advice: "Like changes in a never used else part will surely help someone, just tell people to delete that line god damn it... XD"
Counterpoint: The problem is that it ISN'T in the else part. The problem is that it's in the main procedure. Why don't you delete the line, Groovtama? Save us all the trouble.
Make changes inside
Function Rescale(bool forceUpdate = false)
1. Add the following lines above the
If diffL
check:
If (!SHIELD_SOLUTION_ALT)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD_BACK, GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND) * GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND), PWS_PLUGIN)
Else
SetNodeScale(ThisActor, Gender, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
EndIf
2. And replace the entire
If diffL
block with the following:
If diffL
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, defaultSHIELDScale, PWS_PLUGIN)
SetNodeScale(ThisActor, Gender, NINODE_PRESHIELD, defaultSHIELDScale, PWS_PLUGIN)
If (leftHandType == 1)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * GetNodeScaleRMW(ThisActor, Gender, NINODE_SWORD_LEFT), PWS_PLUGIN)
ElseIf (leftHandType == 2)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * GetNodeScaleRMW(ThisActor, Gender, NINODE_DAGGER_LEFT), PWS_PLUGIN)
ElseIf (leftHandType == 3)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * GetNodeScaleRMW(ThisActor, Gender, NINODE_AXE_LEFT), PWS_PLUGIN)
ElseIf (leftHandType == 4)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * GetNodeScaleRMW(ThisActor, Gender, NINODE_MACE_LEFT), PWS_PLUGIN)
ElseIf (leftHandType == 5) || (leftHandType == 6)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * (GetNodeScaleRM(ThisActor, Gender, NINODE_WEAPON_BACK)) * (GetNodeScaleRMW(ThisActor, Gender, NINODE_WEAPON_BACK)), PWS_PLUGIN)
ElseIf (leftHandType == 7) || (leftHandType == 12)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)), PWS_PLUGIN)
ElseIf (leftHandType == 8)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * GetNodeScaleRMW(ThisActor, Gender, NINODE_STAFF_LEFT), PWS_PLUGIN)
ElseIf(leftHandType == 10)
If (!SHIELD_SOLUTION_ALT)
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, GetNodeScaleRMW(ThisActor, Gender, NINODE_SHIELD_BACK), PWS_PLUGIN)
Else
SetNodeScale(ThisActor, Gender, NINODE_SHIELD, (1/GetNodeScaleBase(ThisActor, Gender, NINODE_LEFT_HAND)) * (1/GetNodeScaleHand(ThisActor, Gender, NINODE_LEFT_HAND)) * GetNodeScaleRMW(ThisActor, Gender, NINODE_SHIELD_BACK), PWS_PLUGIN)
EndIf
EndIf
EndIf
RaceMenuPluginWeapons.psc changes to fix an oversight when updating Right-Hand Weapon scales.
When using ShowRaceMenu to adjust your weapon positions, changing the weapon scale won't immediately update AllGUD's display weapon, because AllGUD uses the WeaponUpdate mod event as a signal to change size, which is triggered by every other transformation except this one.
Function SetNodeScale(Actor akActor, bool isFemale, string nodeName, float value, string modkey = "RMWPlugin")
XPMSELib.SetNodeScale(akActor, isFemale, nodeName, value, modkey)
int handle = ModEvent.Create("XPMSE_WeaponUpdate")
if (handle)
ModEvent.Send(handle)
endIf
EndFunction
67 comments
XPMSSE - Fixed Scripts
https://www.nexusmods.com/skyrimspecialedition/mods/26092
thank you so much!
EDIT: As I've tried it, using the .bat file on LE XPMSE makes the game crash upon loading the main menu. I don't know how it went for other people, but it didn't work for me.
please
BUT, someone had linked a .bat file to auto patch this but it was for SSE and not LE. (https://www.nexusmods.com/skyrimspecialedition/mods/26092?tab=description). Turns out if you just extract the files the /data/scripts folder instead of the /data/scripts/source folder you can run the .bat file and it will auto patch for LE.
Let me know if this works for anyone else!
LE. user
https://www.nexusmods.com/skyrim/mods/29624?tab=files
Tried this edit for XPMSELib.psc and when I tried to compile it.. this is what happen
Starting 1 compile threads for 1 files...
Compiling "XPMSELib"...
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(14,8): variable NiOverride is undefined
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(14,19): none is not a known user-defined type
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(14,1): cannot return a none from getxpmseversion, the types do not match (cast missing or types unrelated)
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(21,11): GetModByName is not a function or does not exist
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(21,11): cannot call the member function GetModByName alone or on a type, must call it on a variable
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(21,37): cannot compare a none to a int (cast missing or types unrelated)
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(22,102): GetName is not a function or does not exist
F:\The Elder Scrolls V Skyrim Legendary Edition\Data\Scripts\Source\XPMSELib.psc(28,11): GetModByName is not a function or does not exist
What the hell?
Please help.
EDIT: Well basically it failed to compile.. I don't know man..
Anyway I reinstall XPMSE back and everything back to normal though I really wish to have the fix cskriffin recommended.
Thanks
First, remember these basics, because it's important when you install mods and use the Creation Kit.
1.) Files that go in the Scipts folder are .pex files.
2.) Files that go in the Source folder are .psc files.
In your Skyrim SE main folder, youll find one of two different folder paths, which are either:
Data\Source\Scripts (The SE Default}
or
Data\Scripts\Source - You probably have the folders in this order, if you installed SKSE and drag/dropped the Data folder in there, like most people do, including myself. I also find that, more often than not, SE mods come pre-packaged this way anyways.
EITHER of these directories are fine to use!
cskriffin mentions how i'mportant it is to have the default directory (Data\Source|Scripts) in SE because this is where the CK will look for your .psc and .pex files by default, and he is correct! However there's a way to change that, despite the lack of settings to do it in the CK itself.....
First, if you have the CK properly installed, it should be in your SSE game directory, as well as the CreationKit.ini.....Open CreationKit.ini with notepad, then scroll down to [Papyrus] and add this line right below it:
sScriptSourceFolder = ".\Data\Scripts\Source"
It should now look like this:
[Papyrus]
sScriptSourceFolder = ".\data\Scripts\Source"
bPerforceEnabled = 0
iMinMemoryPageSize = 128
iMaxMemoryPageSize = 512
Your CK will now use Data\Scripts|Source as the default path.
Since we're using MO2 here, our mods are kept seperate from our base SSE file, for many differen't good reasons. However, these files are still virtually added to your game directory. So regardless of weather or not you use Data\Scripts\Source, or Data\Source\Scripts, you need to remember:
1.) Files that go in the Scripts folder are .pex files.
2.) Files that go in the Source folder are .psc files.
As a MO2 user, you probably choose the "manual" option to view the contents of the mod as you're installing it, in order to choose the correct folder to use as the data folder, more times than not.
From here on out, it's important to pay attention to the Mods that contain Scripts and/or Source files, because mod authors all have differen't ways of throwing them in there.
>>IT IS IMPORTANT TO KNOW THIS! So i will give an example....
I'll see mods packaged with both a Source AND a Scripts Folder. The scripts folder will contain nothing but good ol .pex files (like it should), but the Source file actually contains SCRIPTS folder within it, with SOURCE (.psc) files in the inside of it!
If you remember what i've said twice alreaedy, I think you can see what's wrong here.
In order to solve this situation, you need to drag the .psc file from the Source\Scripts folder, back to the Source folder, obviously because it's a .psc file....
Then go back out to that Source folder you just placed the .psc file in, and delete the empty Scripts folder that you just dragged it out of.
Now you are left with the Scripts folder with .pex files in it, and a Source folder, with .psc files in it.
Think of it as a puzzle that the mod author gave you to do as you install it. The goal is to get all the .pex files in to the Scripts folder and the .psc files in to the Source folder, which you then, have to drag in to the Scripts folder (or vis versa). and delete the duplicate folders.
If your game directory is Data\Scripts\Sources, you need to drag and drop the Source folder IN TO the Scripts folder. This Creates a Data\Scripts\Source file within the mod,
If you're game directory is Data\Sources\Scripts, You simply drag the SCRIPTS folder and drop it in to the SOURCE folder. Aaaand you guessed it! This creates a Data\Source\Scripts file within your mod.
Here's a quick way to get this done with all of your current mods...
Right click on any mod within MO2, and select "Open in Explorer"
At the top, back back to the modorganizer\mods folder, where all of your mod folders are nice and neatly packaged.
Start at the top, use the arrow keys, backspace, and enter to nagivate quickly through the mods and see which ones have Script and/or Source folders that need sorting. I have over 330 mods and it took me less than 20 minutes, not every mod comes with scripts hahah.
Now, with the Scripts (.pex) and Source (.psc) files properly sorted in their mod folders,, you should be able to run the Creation Kit (Run it with MO2....always), and click on "Gameplay > Papyrus Script Manager" which will open a window that shows you the following:
All the Scripts that are properly placed and recognized.
Whether or not the Script has a corrisponding Source file. (Some just don't have one, which is fine)
And whether or not the Scripts are compiled.
For me, they were already compiled. I don't know if this will be the case for everyone.
If it is, and you've successfully made it to this point, then you may have already figured this much out.
You (hopefully) have installed SKSE and it's data files.
You probably already know that MO2 virtually "extracts" the files within the game folder.
And You know that all of your files are already compiled, sorted correctly, and ready to go.
So there's one (or 2) last thing(s) to do before you're set.
Right click on your XPMSSE mod in MO2, and select "Open in explorer"
Follow step 4 on cskriffin's guide, and replace the lines with the ones he provided. Also keep in mind they are the .psc files he's telling you to change, and DONT FORGET the note he left about the edit's you may need to make with the parenthasis!
save them as you complete each one, then close the mod folder when you're finished.
Run FNIS again just as a precaution.
Play the game.
This process worked perfectly for me, so I hope it works for others.
Also thank you, cskriffin, for creating this guide, I learned a little more than how to fix these buggs with it!
Edit: Also, i'm just curious what extracting the files from the scripts.rar would do. I just never messed with it because I don't like touching my SSE Base Folder.
Assuming you already have the required mods for XPMSSE installed in MO2.....
1.) Made sure the SKSE data folder files are properly installed, for me this came as Data\Scripts\Source
2.) Went to Skyrim Special Edition Game folder
3.) Opened Creationkit.ini
4.) Scrolled down to [Papyrus] and added the line below:
sScriptSourceFolder = ".\Data\Scripts\Source"
It now looks like this:
[Papyrus]
sScriptSourceFolder = ".\data\Scripts\Source"
bPerforceEnabled = 0
iMinMemoryPageSize = 128
iMaxMemoryPageSize = 512
5.) Checked to make sure every mod that has Script or Source files were set up as Data\Scripts|Source (All but a few were already set up that way for me)
6.) Opened Creation Kit through MO2, clicked "Gameplay > Papyrus Script Manager" found in the tabs at the top
7.) Checked to make sure all of my Script (.pex) files were located, and possible corrisponding source (.psc) files.
8.) In the same window, I checked to make sure all of them were already compiled.
9.) In MO2, I right clicked on my XPMSSE mod, and clicked "Open in Explorer"
10.) Followed step 4 from cskriffin's guide, and saved them before closing (Take note, you're editing .PSC files when you do this! Not .PEX files!)
11.) I Ran FNIS just to be safe.
12.) Played Game. It worked.
As you can see, I was able to skip every step except 4 .because when I changed the CK Script\Source directory, It detected all files without having to add anything to my SSE base folder, and they will all be placed properly when you run the game from M02.
I hope this helps some people.
Caveat: Vortex might complain about files being updated even though they weren't if the mod is putting them inside \Source\Scripts. I actually see this as a bonus, as it serves as a warning that I have to change where that mod is putting its source files.
I wonder if there might be a way to achieve the same result without having to alter the Creation Kit's configuration by making use of NTFS junctions or symbolic links to simply redirect to the desired location?
XPMSEWeaponStyleScaleSCRIPTEffect.psc is actually XPMSEWeaponStyleScaleEffect.psc.
Thank you for this information!