Jump to content

Custom Material Swapping problem


StantonCree

Recommended Posts

I'm having a problem where I would make a static object out of a magazine or crafting component and then swap the material for it with an existing one. The texture changes inside the CK but ingame they all revert back to the texture that the original base object has. I tried generating the precombined visibility for the cell but its not working. Ideas?

Link to comment
Share on other sites

Well I found a temporary workaround for this. What I did was select all the static objects I placed for decoration and then I right clicked the selection in the render window and I selected "Make static collection". After that I generated new previs and precombined meshes for the cell and it seems like it now maintains the custom material swaps I assigned to them.

Not sure if this is the way to do it but its what worked for me so far........ I'm still open to other suggestions...

Edited by StantonCree
Link to comment
Share on other sites

When generating precombines, any custom material swaps you make on static items will be broken and the objects revert to their default material setting...that’s just the way it works (or doesn’t). It’s OK for things like magazines if they aren't static (as in you can pick them up, add them to your inventory like the vanilla ones). The vanilla game uses custom swaps on the magazines.

 

Your best option for static objects is to make a material swap the “proper” way under the Material Swaps section of the Object Window (under Misc, I think). Then apply it to the object(s) in the Extras tab of the reference placed into your cell. This tutorial should help getting started with that. Swaps made in this way won't break when generating precombines/previs.

 

I’m surprised your custom swaps didn’t break when creating your SCOLS. They will generally break making SCOLs like they when generating precombines.

Edited by RedRocketTV
Link to comment
Share on other sites

Nope they didn't break, and I generated new precombines several times since I posted. I'm probably not going to mess with it too much for now since its working.

 

"It just works!"

Edited by StantonCree
Link to comment
Share on other sites

  • 4 months later...

Try this:

unit ApplyMatSwap;

    // called for every record selected in xEdit
    function Process(e: IInterface): integer;
    var
        baseForm, baseMatSwap, refMatSwap: IInterface;
    begin
        Result := 0;
        
        if (Signature(e) <> 'REFR') then begin
            exit;
        end;
        
        baseForm := LinksTo(ElementBySignature(e, 'NAME'));
        
        if (Signature(baseForm) = 'STAT') or (Signature(baseForm) = 'SCOL') then begin
        
            baseMatSwap := LinksTo(ElementByPath(baseForm, 'Model\MODS'));
            refMatSwap := LinksTo(ElementByPath(e, 'XMSP'));
        
            if ((assigned(baseMatSwap)) and (not assigned(refMatSwap))) then begin
                AddMessage('Doing '+FullPath(e));
                SetElementEditValues(e, 'XMSP', IntToHex(GetLoadOrderFormID(baseMatSwap), 8));
            end;

        end;

    end;

end.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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