Jump to content

issues with transparent material swap


Recommended Posts

Ok, I get it now what you are trying to do. I did some test with the Skin Overrides, since they can also change the body texture, but I couldn't get any transparency on outfits. The decal options in Texture Set doesn't seem to make a difference even if you enable Alpha Test. My next thought is about scripts. There is a function called ApplyMaterialSwap, but requires the Script Extender. Maybe the material swap could be applied to the player, or if that doesn't work, to apply it to the currently equipped outfit(occupying slot 33). I don't know, I'm not good with script stuff.

Link to comment
Share on other sites

Ok, I get it now what you are trying to do. I did some test with the Skin Overrides, since they can also change the body texture, but I couldn't get any transparency on outfits. The decal options in Texture Set doesn't seem to make a difference even if you enable Alpha Test. My next thought is about scripts. There is a function called ApplyMaterialSwap, but requires the Script Extender. Maybe the material swap could be applied to the player, or if that doesn't work, to apply it to the currently equipped outfit(occupying slot 33). I don't know, I'm not good with script stuff.

Yeah I'm not familiar with scripting aswell, but your idea is good. Perhaps the script could be part of the Skin or implemented as a perk. I will check the Creation Kit and the wiki for snippets of code I can use.

Link to comment
Share on other sites

Yeah, that's what I do, look at examples from the wiki and from other scripts, and try to keep it simple. For this particular function, the problem is, there is no property for material swap - usually at the beginning at the script are defined the properties(also variables and so on), like for example:

Armor Property ArmorToEquip Auto

So the material swap has to be defined in a different way. And this is what gets too complicated for me.

 

Another thing that can be done with script is, to attach object modification to an item(in this case armor). I think you don't even need attach point keyword in the object mod (or in the armor), just to set the type to Armor and from the properties to add the material swap. What gets complicated for me here( and also in the case of the script with material swap), is how to attach the object mod to the currently equipped armor.

 

One more thing that came to my mind is the recently released RobCo Patcher. With the patcher, you can distribute attach point keyword to all armors in the game, create object mod with material swap and constructible object for it in your plugin. The problem then is, you'll have to go to the armor workbench in order to apply this mod on clothes. So maybe it's not a good solution, but I'm just throwing it out there.

 

There just doesn't seem to be an easy way to get rid of the body meshes included with outfits. I was intrigued with this, but sadly can't do much about it. Good luck with this, hope you find a viable solution.

Link to comment
Share on other sites

Yeah, that's what I do, look at examples from the wiki and from other scripts, and try to keep it simple. For this particular function, the problem is, there is no property for material swap - usually at the beginning at the script are defined the properties(also variables and so on), like for example:

Armor Property ArmorToEquip Auto

So the material swap has to be defined in a different way. And this is what gets too complicated for me.

 

Another thing that can be done with script is, to attach object modification to an item(in this case armor). I think you don't even need attach point keyword in the object mod (or in the armor), just to set the type to Armor and from the properties to add the material swap. What gets complicated for me here( and also in the case of the script with material swap), is how to attach the object mod to the currently equipped armor.

 

One more thing that came to my mind is the recently released RobCo Patcher. With the patcher, you can distribute attach point keyword to all armors in the game, create object mod with material swap and constructible object for it in your plugin. The problem then is, you'll have to go to the armor workbench in order to apply this mod on clothes. So maybe it's not a good solution, but I'm just throwing it out there.

 

There just doesn't seem to be an easy way to get rid of the body meshes included with outfits. I was intrigued with this, but sadly can't do much about it. Good luck with this, hope you find a viable solution.

Hello again! After several attempts, I've managed to strike gold with the scripted approach. This actor script was the first to actually work.

Scriptname NPCAggressorMatSwapScript extends Actor 

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
  if akBaseObject as Armor
       MatSwap myMaterial = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap
       setMaterialSwap(myMaterial) 
       ApplyMaterialSwap(myMaterial) 
 endIf
EndEvent


It detects when a piece of armor is equipped to apply the material swap. I'm surprised that using those matswap functions directly on the whole actor would also work on the armor being worn. It wasn't even necessary to access the matswap through formlists and to obtain the armor via GetWornItem. It was actually far simpler. Here's a guy wearing an outfit that's mostly skin. The humanmale mesh is completely invisible.

 

Unfortunately the material swap doesn't persist when closing and reopening the game. I would need to make it periodically and automatically apply the material somehow, instead of having to open the inventory of the NPC and equip then unequip a piece of armor manually. Maybe using OnLoad() instead, or making it a magic effect.

 

Link to comment
Share on other sites

Hey, good for you. You managed to pull it off. Thanks for reporting back with your findings. Not sure if I'm ever going to need such thing, but more examples are always welcome, the wiki can get you only so far. Checking out the "GetFormFromFile" thingy, I'm thinking you should never convert the plugin to .esl or .esp with ESL flag, because that could mess things up and the script may not find the form(or the Form ID). Keep it in mind if things suddenly stop working :wink: .

 

I don't know how to solve this problem with matswap not being persistent. You'll have to test available possibilities, hopefully you strike gold again... and get rich. That's what I often do, test, make some edits and save the file, then test in the game again, rinse and repeat. Modding sure does take a lot of time, even for little things. I could be wrong, but OnLoad() may not be available for Actor script. Hmm, there's some interesting stuff on this page:

https://www.creationkit.com/fallout4/index.php?title=OnPlayerLoadGame_-_Actor

Link to comment
Share on other sites

 

Yeah, that's what I do, look at examples from the wiki and from other scripts, and try to keep it simple. For this particular function, the problem is, there is no property for material swap - usually at the beginning at the script are defined the properties(also variables and so on), like for example:

Armor Property ArmorToEquip Auto

So the material swap has to be defined in a different way. And this is what gets too complicated for me.

 

Another thing that can be done with script is, to attach object modification to an item(in this case armor). I think you don't even need attach point keyword in the object mod (or in the armor), just to set the type to Armor and from the properties to add the material swap. What gets complicated for me here( and also in the case of the script with material swap), is how to attach the object mod to the currently equipped armor.

 

One more thing that came to my mind is the recently released RobCo Patcher. With the patcher, you can distribute attach point keyword to all armors in the game, create object mod with material swap and constructible object for it in your plugin. The problem then is, you'll have to go to the armor workbench in order to apply this mod on clothes. So maybe it's not a good solution, but I'm just throwing it out there.

 

There just doesn't seem to be an easy way to get rid of the body meshes included with outfits. I was intrigued with this, but sadly can't do much about it. Good luck with this, hope you find a viable solution.

Hello again! After several attempts, I've managed to strike gold with the scripted approach. This actor script was the first to actually work.

Scriptname NPCAggressorMatSwapScript extends Actor 

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
  if akBaseObject as Armor
       MatSwap myMaterial = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap
       setMaterialSwap(myMaterial) 
       ApplyMaterialSwap(myMaterial) 
 endIf
EndEvent


It detects when a piece of armor is equipped to apply the material swap. I'm surprised that using those matswap functions directly on the whole actor would also work on the armor being worn. It wasn't even necessary to access the matswap through formlists and to obtain the armor via GetWornItem. It was actually far simpler. Here's a guy wearing an outfit that's mostly skin. The humanmale mesh is completely invisible.

 

Unfortunately the material swap doesn't persist when closing and reopening the game. I would need to make it periodically and automatically apply the material somehow, instead of having to open the inventory of the NPC and equip then unequip a piece of armor manually. Maybe using OnLoad() instead, or making it a magic effect.

 

 

If "setMaterialSwap(myMaterial)" doesn't work, you can always reapply the matswap manually "onLoad()" / "OnPlayerLoadGame()"

 

Event OnInit()
  Self.RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
EndEvent

Event Actor.OnPlayerLoadGame(Actor akSender)
  Self.ApplyMaterialSwap(myMaterial)
  Self.RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
EndEvent

Event OnLoad() 
  Self.ApplyMaterialSwap(myMaterial) 
EndEvent

You can ditch the "self" and maybe there is a better option, i don't know.

Edited by lee3310
Link to comment
Share on other sites

  • Recently Browsing   0 members

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