Jump to content

How to Material Swap in creation Kit when the material list is blank?


vielas1

Recommended Posts

@RaidersClamoring @DieFeM

 

Oh yeah, matswapping by script. My EEE mod makes extensive use of SetMaterialSwap(); It lets user paint/color code most of the items in the mod.

But... Requires jumping through extra hoops -as per usual with the game- like having to restore the matswaps on load. Or having to disable/enable, so the matswaps actually become visible. Which is a can of worms by itself ofc, because additional OnLoad events fire on enable(). What a royal PITA.

 

ApplyMaterialSwap() otoh never worked at all for me, either it does nothing or flat out CTDs the game. Expired commented in xse discord that it was never stable and is buggy AF; Paraphrasing from memory.

Link to comment
Share on other sites

@RaidersClamoring @DieFeM

 

Requires jumping through extra hoops -as per usual with the game- like having to restore the matswaps on load.

 

Yeah, that makes it pretty useless for this use case. At the time I was developing this paint walls mod, after noticing that the material was not being kept, CDante suggested using material swaps through destruction stages.

That would be doable if I'd create new settlement objects, but what I was trying to do is material swapping already placed objects, this concrete kit in particular, which is extensively used by certain settlement builders.

Link to comment
Share on other sites

Right now I'm not exactly sure which functions and modus operandi we are talking about. And I've never tried any at all myself, but, Here's what F4SE say about SetRemapData():

; Sets the internal persistent material swap
; Adding persistent material swaps will increase save-size by a small amount
; Setting this to None will remove persistence and free up save-space
; This function does not apply a visual update, you must use ApplyMaterialSwap
; This will make the game take care of setting the material swap when the game is loaded
; ApplyMaterialSwap is a more greedy method of applying materials so the nif objects
; the game applies materials to may not match up with the ApplyMaterialSwap function
; Behavior may not be as expected when applied to living references, weapons, or armor placed in the world
Function SetMaterialSwap(MatSwap mSwap) native
So is the alleged persistence simply broken or is there some very particular way you could go about it to possibly get it working?
And then there's this:
; Returns the source/target pairs that succeeded in swapping
; Rename material allows independent control over
; [General]
; bRenamePropertiesOnMaterialSwap=0
MatSwap:RemapData[] Function ApplyMaterialSwap(MatSwap mSwap, bool renameMaterial = false) native

 

Is renaming the material something you've experimented with?

Link to comment
Share on other sites

Lies! :D SetMaterialSwap() does not persist.

It also does not update the reference until you Disable()/Enable() it.

But ultimately, it works.

 

ApplyMaterialSwap(), at least for me, does either nothing or CTDs the game.

Hence the need to Disable/Enable.

 

If you decompile PaintableMatswap.pex from my EEE mod, you'll have a SetMaterialSwap() based implementation that works reasonably well.

Link to comment
Share on other sites

Lies! :D SetMaterialSwap() does not persist.

It also does not update the reference until you Disable()/Enable() it.

But ultimately, it works.

 

ApplyMaterialSwap(), at least for me, does either nothing or CTDs the game.

Hence the need to Disable/Enable.

 

If you decompile PaintableMatswap.pex from my EEE mod, you'll have a SetMaterialSwap() based implementation that works reasonably well.

 

Bummer. :( I do think really highly of them but I suppose they can make mistakes too. They should probably update those comments or better yet troubleshoot the code.

 

Anyway, thanks! I champolionized your script and will get into it.

 

I noticed one thing that surprised me -- you can actually put conditional expressions directly in bool variables? like:

 

Bool SomeBool = OtherBool && YetAnotherBool

 

So does that mean you can put in more complex chains like:

 

Bool SomeBool = Numerical1 > Numerical2 && SomeRef is weapon && Find.InSomeArray() == 0 || SomeActor.IsDead() etc etc

 

?

 

Wow

Link to comment
Share on other sites

  • Recently Browsing   0 members

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