Modding Tutorials: Asset-Injection

Discuss modding questions and implementation details.
Post Reply
User avatar
Igor
Posts: 32
Joined: Sun Nov 19, 2017 10:06 am

Re: [GUIDE] Mesh, Texture and Sound replacement

Post by Igor »

TheLacus wrote:Hi, you must define a material, see First Person Weapons section here.
Please tell me if you need more specific help ;)
Thank you!

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

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

Starting from the most recents builds, textures can also be imported from dfmods. Priority order follows mods load order, with loose files in the last position. Everything that come last, override textures from the previous mod position. A typical situation is to have a few big texture pack mods at the top, and then smaller mods and loose files for individual texture swaps. This should be particularly helpful for texture translations.

You can refer to Lypyl tutorial for mod building. Is to note that UI, billboard and terrain images (of any format supported by unity) are included as simple textures. For textures used on 3d meshes (buildings and props) you need to create a material (archive_record-frame.mat, like individual textures). This is very handy if you want to set physical properties such as smoothness, normal map etc. When you build the mod select only the material, do not include individual textures applied to it.

If a texture is not shown correctly and the log says it couldn't be edited because it was read-only, you need to tick Read/Write Enabled option in Unity inspector for specific texture. Be warned that this increase ram usage so enable it only when necessary (ex: UI texture cut to get individual buttons).

Spoiler!
TextureImportExample.png
TextureImportExample.png (372.12 KiB) Viewed 5021 times

User avatar
Kamer
Posts: 583
Joined: Mon Mar 05, 2018 9:26 pm

Re: Modding Tutorials: Asset-Injection

Post by Kamer »

What do you use to edit xml files? I can't seem to get them to work at all with Notepad++ so I'm assuming I need a different program.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Modding Tutorials: Asset-Injection

Post by Hazelnut »

XML files are plain text files that can be edited using any text editor. Some will make it easier by providing folding and syntax highlighting etc.

What do you mean when you say you can't get it to work?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

Kamer wrote: Sun May 27, 2018 6:39 am What do you use to edit xml files? I can't seem to get them to work at all with Notepad++ so I'm assuming I need a different program.
Did you take the xml from website? For some reason it shows a wrong char

Code: Select all

<?xml version=”1.0″?>
as opposed to

Code: Select all

<?xml version="1.0"?>
This doesn't happen if i set text as "preformatted" rather than quote, so i'll go for it now.

User avatar
Kamer
Posts: 583
Joined: Mon Mar 05, 2018 9:26 pm

Re: Modding Tutorials: Asset-Injection

Post by Kamer »

I'm trying to get a sprite to scale to twice the height. You were right, some of them weren't formatted correctly so that would seem to be a fix but I still can't manage to actually get the sprites to scale.

Code: Select all

<?xml version="1.0"?>
<info>
	<scaleX>1</scaleX>
	<scaleY>2</scaleY>
</info>
They are saved in the right format and placed with the textures in the StreamingAssets folder but it seems that they are ignored.

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

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

Please tell me which sprite and i will test it :)

User avatar
Kamer
Posts: 583
Joined: Mon Mar 05, 2018 9:26 pm

Re: Modding Tutorials: Asset-Injection

Post by Kamer »

TheLacus wrote: Sun May 27, 2018 3:11 pm Please tell me which sprite and i will test it :)
I'm trying it out on Villager sprites at the moment. 386 and 455. I'm trying to fix sprites getting parts cut off and adding some horseback riders. On this particular code I'm trying to scale horseback riders to replace select citizens in the game.

User avatar
Kamer
Posts: 583
Joined: Mon Mar 05, 2018 9:26 pm

Re: Modding Tutorials: Asset-Injection

Post by Kamer »

New issue I've found. When you replace all of a villager's sprites, they start disappearing and reappearing when you walk so far away. This only happens when all the sprites are replaced. Not sure if having an xml file will help.

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

Re: Modding Tutorials: Asset-Injection

Post by TheLacus »

Kamer wrote: Sun May 27, 2018 8:35 pm
TheLacus wrote: Sun May 27, 2018 3:11 pm Please tell me which sprite and i will test it :)
I'm trying it out on Villager sprites at the moment. 386 and 455. I'm trying to fix sprites getting parts cut off and adding some horseback riders. On this particular code I'm trying to scale horseback riders to replace select citizens in the game.
Custom scale is implemented for interior npcs and enemies but not for mobile persons. I can do it but i need to take care of vertical alignment on ground for individual billboards. The idea is to set position according to first frame size, after person is set and texture is chosen. Then is up to modder to be consistent with all frames.

@Interkarma
I would assign position to billboard gameobject in UpdateMobiles, just after call to RandomiseNPC(). AlignBillboardToGround should handle applying position due to custom scale as well as set original position after recycle since it uses current size. I don't see any evident issues from testing, do you foresee any trouble?

Post Reply