Skyrim Special Edition

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.

Groovtama is willfully ignorant of these bugs
Fresh install of XPMSE 4.7
New Game with ONLY XPMSE and its requirements enabled
WEAPONS FLICKER WHEN EQUIPPED


Groovtama has declared that "XPMSE development is finsihed, kkthxbye (for real)"
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 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

Article information

Added on

Edited on

Written by

cskriffin

31 comments

  1. ACGreen4Real
    ACGreen4Real
    • premium
    • 0 kudos
    Skip all cheatcode - https://www.nexusmods.com/skyrimspecialedition/mods/44252
    1. livipup
      livipup
      • premium
      • 41 kudos
      Thanks for sharing :) I had downloaded this, but I also downloaded about 600 other mods, so I forgot and was really considering if this was worthwhile, lol
  2. SionCross
    SionCross
    • member
    • 4 kudos
    Is doing this still necessary or did they eventually fix it?
  3. lucase5
    lucase5
    • premium
    • 0 kudos
    Is there a way to remove the MCM menu part to avoid increased saving times?
  4. Eliadon
    Eliadon
    • supporter
    • 52 kudos
    https://www.nexusmods.com/skyrimspecialedition/mods/26092

    Bless this community, someone made a bat file that will automatically patch the scripts.
    1. Crestfall69
      Crestfall69
      • member
      • 1 kudos
      Pin this thing.
    2. Murdernickle
      Murdernickle
      • premium
      • 0 kudos
      This is the way. My god that was easy.
    3. ReikuzoSennin
      ReikuzoSennin
      • member
      • 1 kudos
      how exactly do I use it? I placed it inside the folders with .pex --> clicked the .batch --> start the game --> still flicker
    4. Vardet
      Vardet
      • member
      • 0 kudos
      Same
    5. megapatato
      megapatato
      • premium
      • 107 kudos
      There's now a mod with the pre-compiled files, so you could probably just over-write with the fixed versions:

      https://www.nexusmods.com/skyrimspecialedition/mods/44252
    6. LinkIsEpic101
      LinkIsEpic101
      • member
      • 9 kudos
      wait megaoatato so do I just use the XP32 Maximum Skeleton Special Extended - Fixed Scripts that you linked instead of doing the whole lengthy process?
  5. PierreDespereaux
    PierreDespereaux
    • premium
    • 749 kudos
    I appears that XPMSSE has gone open source. Think we can see these fixes rolled directly into AllGUD in the future?

    ?Author's instructionsSkeleton files:
    Skeleton .nifs and .hkx files are permission free, because they are based on Bethesdas original files.
    Please for fucks sake don't do custom races with seperate skeleton paths,
    every time a mod user asks me why his custom race doesn't work with
    XPMSE, my niceness dies more inside of me.

    Animation files:
    Animation files included in this file are bound to the permission of the authors they were taken from.

    Script files:
    Do what you want with them.

    You are free to upload XPMSE on other mod sites as long as you give me
    credit, if you do an extra translation in the process just tell me and I
    add them to the files and you get in the credits.
  6. Vardet
    Vardet
    • member
    • 0 kudos
    Hi! First off all, thanks for trying to help and for the awesome mod. I saw videos in YT of it with no flickering at all, and that led me to try this.

    I write this after 5 hours of trying. My only problem was and is the flickering when changing weapons. I tried everything, the auto patch, doing it manually, fresh installs, etc... 

    The mod works flawlessly, I just want to get rid of the flickering. I would appreciate it if someone can help me. I think i have all my SKSE, and other mods/scripts sorted and installed properly. I use MO2. 

    Thanks again for everything!! 
  7. sweetrolls4life
    sweetrolls4life
    • premium
    • 1 kudos
    Does anyone know if this keeps XPMSSE from spamming the Papyrus log?

    I've often had crashes in long playthroughs and had to disable Papyrus logging in the end, because the files became huge due to errors.
    And I honestly don't see why I should disable logging just because someone doesn't want to fix buggy scripts.
  8. Dobr0mysl
    Dobr0mysl
    • premium
    • 116 kudos
    Hi, cskriffin! I recompiled the source code of XPMSELib and FINALLY no weapon flickering!
    1. IGSpelly
      IGSpelly
      • member
      • 12 kudos
      Could you upload the fix for those of us who break computers when trying to compile?
    2. FluffySpacePrincess
      FluffySpacePrincess
      • member
      • 0 kudos
      Pleeeeease please please, my brain hurts just looking at these instructions >.<
    3. Dobr0mysl
      Dobr0mysl
      • premium
      • 116 kudos
      OK guys, FluffySpacePrincess, IGSpelly: I really sorry that currently I can not help you but I used these instructions to rewrite the source code of XPMSE for Legendary Edition, not Special Edition.
    4. cskriffin
      cskriffin
      • member
      • 137 kudos
      Scripts aren't different from LE to SE. I pm'd fluffy the current scripts. Hope someone else from the XPMSE team fixes these some day.
      If only these bugs were genital related, they woulda been fixed in no time.
    5. m1cmou
      m1cmou
      • premium
      • 2 kudos
      Any chance you can send me the scripts aswell it seems that no matter what I try I get a compile error T-T
    6. orty1982
      orty1982
      • member
      • 0 kudos
      I am soooo struggling to understand these instructions. I'm a serious noob!

      Can someone be so kind as to send me the new files and tell me where to copy them into!
    7. RS678
      RS678
      • premium
      • 38 kudos
      I would also like the scripts if you don't mind taking time to send them. I would use the instructions given here, but I'm not sure I understand them completely and don't want to cause any mishaps with any mods or my game.
    8. chillmaxed
      chillmaxed
      • premium
      • 8 kudos
      Did you guys not read the rules?

      "Groovtama has declared that "XPMSE development is finsihed, kkthxbye (for real)"
      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 without these fixes, this step is entirely optional"
  9. 2Dimm
    2Dimm
    • member
    • 12 kudos
    why cant we all just be friends and allow fixed versions of mods by default, cskriffin literally just wants to help... sigh
  10. Ithuza
    Ithuza
    • member
    • 4 kudos
    I thought I was doing good being brave enough to do little patch in ssedit and game not crashing first time in eternity (level 9 lol, 250 mods +enb +textures) just when you think you're doing good some mysterious new horror like papyrus compile comes along.  Everything's working fine but I want the *$%^ flickering gone now so I finally have free time and like 'I'll read that technical scary article to compile xpmse script'   100% fail days later.  what a nightmare.  anyways not to complain I'm still stoked most the stuff is working on a base level i guess. (next I have to figure out how to fix navmeshes at whiterun gate..  smh  i should quit modding and just play)
     
    on to my real comment:  so my understanding of how this works is you just put all the damned source scripts in one folder (so for sse it's Source/scripts   i guess LE is  scripts/source   eff it i tried em in both   anyways   so I put em all in there).   supposedly compiler should work right?  I did the simple edits no prob.  right click 'compile'  just 'FAIL  FAIL FAILF AIFLALIFLF AIL  FAIL  '  thing doesn't even have enough memory sometimes or just can't find a million things in the script(s?)  (I have 16 gb mem, 6gb vid mem etc)    am I retarded or why is every instruction in every google search written so confusingly like leaving half the explanation out (lol /rant maybe noone speaks english in which case their posts are actually good   and who knows what changes between versions of installs).   let's explain every mouse click I do.  I load CK (for newbs that involves making a stupid bethesda account then editing stupid ini file to allow multiple masters btw that was two separate annoying stories),   I click Gameplay   Papyrus Script Manager     (this is where instruction just stops so i'm purely guessing btw)   so I see 15,000 scripts there  I search for the 3 scripts I edited   I right-click one of them    then the options to click are different than all instructions  but there's  'New...'  'Open in external editor'  'Compile'  (and seven other things).   So I guess I click Compile.    brings up a window   click on the script    starts compiling   says   Fail        so ya that's about it.     I've given up (I've given up probalby hundreds err  dozens  of times since started this game but at least this time game still works just can't stop flickering)   Next I'll have to try to get a damn third party compiler   figure out how to link notepadd++  or who the 'f' knows    (sorry for semi-cursing four times sometimes in rare instances there's no substitute to accurately get your point across)    I hate asking for handouts if someone wants to send me the script that's fine though someday I'd like to do clean install of what I learned on brother's computer for him as a gift teaching him along the way   and I dont' want to teach him something he can't do himself    let's face it noone in my life is ever going to play modded skyrim so really it's just me lol   thank God.   and remember I'm only level 9 out of my 350 mods I'm still testing I can't imagine fixing these last two errors is going to result in a game that works flawlessly  I super appreciate ur mod AllGUD thanks for sharing  love ya'll and have a nice day!