Modding Tutorials: Asset-Injection

Discuss modding questions and implementation details.
User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

TheLacus wrote: Sat Sep 28, 2019 12:51 pm
MasonFace wrote: Sun Sep 22, 2019 12:24 am Hey TheLacus!

I was wanting to take a crack at making a mod that extends the behaviors of doors, but first I need a little help understanding how DFU handles placing particular doors in interiors and how a modder would inject a new prefab for specific doors.

I've had some success with replacing static props with a new prefab. I made a new fireplace with a slightly higher polycount mesh, a light source, PBR material, and a particle system. I just named the prefab "41116", included it in my dfmod and it worked! But now I'm getting confused on how to do the same with doors...

It looks like all the doors inherit from the base mesh 55000. From there, I'm guessing it relies on the tag system to assign it a specific material based on Climate and Season, but I'm having difficulty understanding how DFU maps "55000" to material 374_0-0, for instance in Privateer's hold. I'm guessing it's done with DaggerfallMesh.cs, but I'm not seeing how it all works together.

Anyhow, long story short, I've tried overriding the base 55000 mesh with a custom mesh expecting that all interior doors would fallback to this new mesh since I didn't include any climate or season tags, but I'm not seeing any results or errors in console.

How should I proceed with trying to create unique door prefabs that get injected properly?

Thanks!
If you look inside Assets/Prefabs/Scene you can find prefabs for interior doors. When they are loaded a DaggerfallMesh component is added directly and climate is set without seeking injected models, so unfortunately it's not possible to replace them right now. I opened an issue on Github.
This is now supported (not yet in builds). Quoting my commit:
Added support for injection of custom models of action doors used inside buildings and dungeons. The entire action door prefab is replaced, so mod authors need to ensure that DaggerfallActionDoor, DaggerfallAudioSource and other required components (or compatible replacements) are present.
I suggest playing the game inside the Unity Editor to retrieve ids for all doors (i.e. 9000 for buildings).

Ax31
Posts: 8
Joined: Sat Jul 11, 2020 4:48 am

Re: Modding Tutorials: Asset-Injection

Post by Ax31 »

Hello, i'm a 3d modeller and i'd like to switch walking npcs to 3d ones, but i can't even change them for a cube. i load a save, hit pause just to be in a city, then drag the mobilepersonasset prefab with the mobilepersoncube component added to it and nothing happens. if i assign the script to the prefab the npc's dissapear and get moved to the scene's origin, their names in the hierarchy tab change to the name of the prefab, the best i got so far was getting 2 or 3 npcs working (though they dont' stop when im near them) and the rest are invisible and have a light blue color in the hierarchy tab.
EDIT: i figured how to get it done, but still all but a few npc instances are unticked in the inspector tab, shift selecting them makes them show up is this a bug? all i did was delete the billboards child from the main npc prefab and instead assign the cube referenced in the script, i can't make sense of it but i'll continue to push forward until i get a responnse.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

You need to include a prefab named MobilePersonAsset in a mod, which will be instantiated automatically as needed (see MobilePersonAsset as reference. I don't expect it will do much if you drag it in the scene yourself.

There is actually a known issue with this component, so keep that in mind. ;)

Ax31
Posts: 8
Joined: Sat Jul 11, 2020 4:48 am

Re: Modding Tutorials: Asset-Injection

Post by Ax31 »

TheLacus wrote: Sat Jul 11, 2020 12:20 pm You need to include a prefab named MobilePersonAsset in a mod, which will be instantiated automatically as needed (see MobilePersonAsset as reference. I don't expect it will do much if you drag it in the scene yourself.

There is actually a known issue with this component, so keep that in mind. ;)
So i need to make aseparate mod with the MobilePersonAsset and import it? i got as far a the edit in my previous post and kept going finishing the script as per the tutorial, and i got CS1061 and 0120 errors on the setperson() part, which may have something to do with the issue you linked, if that's the case then i guess i'll leave this be and maybe come back to it after it's fixed, as i've done little to nothing on C#.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

Any compilation error or warning is due to your code, is not related to the bug I mentioned.

The reported issue shouldn't affect the basic example that was used to showcase core functionalities, but is your decision if you prefer to wait for this feature to be more polished and the reported issue to be fixed. 😉

Ax31
Posts: 8
Joined: Sat Jul 11, 2020 4:48 am

Re: Modding Tutorials: Asset-Injection

Post by Ax31 »

That's great, i'll keep going then, but i still have a problem understanding the "bundled in a mod" part, i read the documentation and all but i'm still lost, after making and naming the cript i assigned it to the MobilePersonAsset cube and nothing happended, dragging it to the screen changed nothing, what kind of worked was finding the "DaggerfallMobilePerson [Standalone]" empty and replacing the billboard with my cube but most npc were unticked, so i ticked them and went on, which i guess i shouln't do, since it should be automatic.
So my doubt is Should i make a separate mod and import it to the unity editor or what? im at a loss as the replacement wasn't automatic
i hate taking your time with such noobish matters but this all seems to simple to cause me issues

as for the compiling errors they al came from the setperson part, unity didn't know what gameobject was in that context. iguess i did something wrong even if i just pasted the Mod mod; section above the MeshRenderer meshrenderer; one and added the last part to the tut where it should be.
Either way i started from scratch now and im of course facing the same issue as before, people should be cubes but they aren't.

User avatar
Midknightprince
Posts: 1324
Joined: Fri Aug 11, 2017 6:51 am
Location: San Antonio TX
Contact:

Re: Modding Tutorials: Asset-Injection

Post by Midknightprince »

Do I need a script for a music mod ?

Edit one: so I put it together in unity editor and it seems to work in 10.25, does not show up in .24, but I guess that's to be expected.

When I add the assets can I just grab everything from the folder including the json file, and put it all in there or only add the music ( I did the former)?

Do I need to put anything special in the mod settings ?
What can I put, nothing shows up.

I want to put a bass slider and a trible slider in my mod settings can I do that ?

Should I change the load type for each .ogg ?
It's on decompress on load, because some of the files are pretty big is that right ?
What about dependencies, is there anything else I need to do other than just drop the files in there and that's it?

It's working I just don't know what else I can do with it..
What all options can I add to it ?
Is there like a list I can look at so you don't have to write a book ?

Sorry man it's working I just don't know what I'm doing (kinda).
Check out my YouTube Channel!

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

You need to select and add all sound files and build your mod. This should be enough for a working replacement of sounds and songs in game.

Settings can be accessed via scripts included with the mod. However this is not needed for a simple replacement of sound files.

fosley
Posts: 48
Joined: Wed Sep 23, 2020 1:33 am

Re: Modding Tutorials: Asset-Injection

Post by fosley »

Two problems.

Problem the First

I'm having difficulty trying to do an upscaled replacement for the joystick calibration screen textures.

They don't show up at all in the base DFU as far as I can tell (the joystick screen has been replaced by something custom), but the one texture, CNFG04I0.IMG, is used for the interface in the Decorator mod.

When I put the texture in my game folder, it replaces the texture in the mod, but the scaling is really wonky. I've tried several versions of .xml files. I named the file CNFG04I0.IMG.xml and placed it right beside CNFG04I0.IMG.png.

Code: Select all

<?xml version="1.0"?>
<info>    
	<scaleX>0.1</scaleX>
	<scaleY>0.1</scaleY>
</info>

Code: Select all

<?xml version="1.0"?>
<info>    
	<scaleX>10</scaleX>
	<scaleY>10</scaleY>
</info>

Code: Select all

<?xml version="1.0"?>
<info>    
	<width>1080</width>
	<height>1300</height>
</info>

Code: Select all

<?xml version="1.0"?>
<info>    
	<width>108</width>
	<height>130</height>
</info>
None of these seem to have any affect on the in-game texture I'm seeing. Any assistance would be appreciated.

Problem the Second

I want to replace the spell icons in the game. DREAM gives me replacements for custom spells, but not the standard spells. So I'm in the process of copy/pasting/recoloring some of the DREAM icons into a replacement map for the original file, ICON00I0.IMG, and it's working fine. But from this UESP page, it seems only a few icons get used for standard spells, so there are a lot of duplicates.

An even better solution would be if I could replace each base effect with its own icon. And it appears there's a way to do that. The iconpack.txt files include the line "suggestedEffects": null for each icon, suggesting "null" could be replaced by an effect name to do exactly what I want.

In SpellIconCollection.cs, there's a property for suggestedEffects as well. It looks like it's an array of strings, so I tried "suggestedEffects": ["Fortify"], which at least didn't drop my framerate to 6 fps while it apparently kept failing at loading the file (as other attempts did), but had no effect in game. I also tried "Fortify Endurance", "Fortitude" and "FortifyEndurance".

Am I doing something wrong, or am I not understanding what that's for?

User avatar
Magicono43
Posts: 1139
Joined: Tue Nov 06, 2018 7:06 am

Re: [GUIDE] Mesh, Texture and Sound replacement

Post by Magicono43 »

TheLacus wrote: Thu Jul 20, 2017 10:39 pm
Arl wrote: How exactly should I name the files? BUTTONS.CIF_3-0.png or BUTTONS.RCI_3-0.png show no result in game, they are in the right folder and all.
Textures\CifRci\BUTTONS.RCI_3-0.Png
Just wanted to note that this post helped me solve an issue I was having just now. So thanks Arl for asking the original question and TheLacus for answering it, lol, much appreciated.

Post Reply