ignorantslave Posted July 23 Share Posted July 23 Hello, I need suggestions on how to make this F4SE script work again. Scriptname AggressorMaterialSwapEffectScript extends activemagiceffect int liltimer = 33 Actor guy Event OnInit() guy = GetCasterActor() MatSwap alphaMat = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap guy.setMaterialSwap(alphaMat) guy.ApplyMaterialSwap(alphaMat) StartTimer(5, liltimer) EndEvent Event OnTimer(int aiTimerID) If aiTimerID == liltimer MatSwap alphaMat = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap guy.setMaterialSwap(alphaMat) guy.ApplyMaterialSwap(alphaMat) if guy.GetMaterialSwap() == alphaMat Debug.Notification("Material applied!") EndIf StartTimer(5, liltimer) EndIf EndEvent I made it in 2023 to apply a transparent material swap of the human male mesh on an actor and any worn clothes, but it recently stopped working correctly, possibly due to the next gen update. It no longer periodically applies the material swap on the actor (despite the debug notifications working), and only reloading the actor makes the mesh turn transparent. The code is part of a magic effect meant for a custom robot race, with the objective of turning invisible the human mesh part of any outfit showing skin. So for example, if the actor equips a harness, the script should replace the flesh with a transparent material like so (this is how it worked before and when reloading the actor), leaving the robot mesh underneath. But now the setMaterialSwap function no longer applies the material swap during the events, and the actor looks like this. So if it only works on actor reloads, and the only commands that reload the actor that I know of are "setrace" and "sexchange", do I simply set the script to periodically switch between races so the skin part stays invisible, or is there a better way? Link to comment Share on other sites More sharing options...
ignorantslave Posted July 25 Author Share Posted July 25 So the "setrace" method updates the material as expected, but causes various glitches and stuttering. "Sexchange" is not a papyrus function and "QueueUpdate" which should update the actor doesn't seem to do anything. The "reset" function is also not ideal. There has to be a better way to reload the actor. Link to comment Share on other sites More sharing options...
ignorantslave Posted July 26 Author Share Posted July 26 It turns out what I wanted material swaps to do could already be done by effect shaders. There's literally an "affect skin only" tick box that applies the shader to the human mesh part of an outfit while the rest stays normal. So ticking that box on the "gooify" plasma death effect shader makes the skin melt away from clothes. By having a script-based magic effect tied to a race ability constantly apply the shader to the character, and by setting the robot mesh armor addon to use the "facegen head" biped slot instead of the "BODY" one, I can make my metal man wear any outfit no matter how much skin it shows, without even needing F4SE! So, if you want to rig Liberty Prime to the human skeleton (essentially what I did) so he can wear a pretty dress, now you know how to do it. 1 Link to comment Share on other sites More sharing options...
lilkandeekid Posted August 16 Share Posted August 16 (edited) Glad you found a resolution! But for others (aka me lol) reference, I think the issue with your script was ApplyMaterialSwap not SetMaterialSwap. Having more or less the same issue with a script not working anymore. Looking at changes in F4SE after nextgen update (mainly ObjectReference.pex where the function is defined), ApplyMaterialSwap seems to have been edited in a way that disables it. The function went from: Quote matswap:remapdata[] Function ApplyMaterialSwap... to Quote matswap#remapdata[] Function ApplyMaterialSwap... Wondering if somethin in nextgen broke it as it was a wonky function to begin with. Edited August 16 by lilkandeekid Link to comment Share on other sites More sharing options...
PJMail Posted August 16 Share Posted August 16 I assume you used champilion to decode the PEX as it puts a # in place of the : (so it is actually the same code). The issue is the NG version of F4SE broke matswaps. I reported this months ago and it was acknowledged but nothing has been done about it. Perhaps if more people report the bug they might fix it... Link to comment Share on other sites More sharing options...
lilkandeekid Posted August 16 Share Posted August 16 Yeah dont doubt the pex browser I was using runs on Champillion lol, thx. Sadly looking at F4SE, it might be awhile before there's an update. Link to comment Share on other sites More sharing options...
PJMail Posted August 16 Share Posted August 16 Unfortunately I agree. Unless Bethesda creates another NG update I don't think there will be any further work on F4SE. Ian noted NG changed the matswap code so it is probably non-trivial to fix. Link to comment Share on other sites More sharing options...
Recommended Posts