Page 6 of 21

Re: Modding Tutorials

Posted: Mon Feb 26, 2018 11:23 pm
by Hazelnut
Seems a very reasonable policy, I didn't mean to imply everything should be easily moddable. However it would still be nice to be able to extend core classes to add new behaviours. Is that possible with the c# scripting facility for mods? Can you at least implement an interface from the DFU codebase?

Basically I'm trying to think how modders could add new guilds. I will need to write the hooks/events etc, that's fine as long as the guild behaviour class can be implemented by modders either by abstract class extension or interface implementation.

This may be a stupid question due to c# runtime assemblies or that kind of thing since I know almost nothing about them. (remember I'm a Java guy :geek: )

Re: Modding Tutorials

Posted: Mon Feb 26, 2018 11:38 pm
by Interkarma
I believe it should be possible for the MCS compiler to inherit from an abstract class and plug itself in if given a way to register itself. Nystul's enhanced terrain does something just like this by implementing and registering its own TerrainSampler as part of the mod. The core DaggerfallUnity class allows for a plug-in replacement TerrainSampler to be injected by an event. Load order of mods will determine which new TerrainSampler "wins" as only one can be active in this case.

Adding new guilds this way is a really intriguing concept!

One of biggest limitations is compiling new enums with the runtime C# compiler. Provided modder can just override and plug-in like the TerrainSampler model, they should be able to get a lot done.

Re: Modding Tutorials

Posted: Mon Feb 26, 2018 11:45 pm
by Hazelnut
Great, I'm off to peruse Nystul's distant terrain mod code then... :arrow:

Re: Modding Tutorials

Posted: Tue Feb 27, 2018 12:01 am
by Nystul

Re: Modding Tutorials

Posted: Thu Mar 01, 2018 12:10 pm
by Hazelnut
I tried to create a mod with a json file in it (Assets/StreamingAssets/WorldData/RESIAM10.RMB-543-building10.json) to test I can include world data override json files in a mod. Unfortunately I get this error "Unrecognized assets cannot be included in AssetBundles" and I have no idea what I can do about it. One possibility is simply have these files as loose files that need installing along with the dfmod file.

Any advice modding experts?

Re: Modding Tutorials

Posted: Thu Mar 01, 2018 12:33 pm
by Interkarma
Probably need to make it a .json.txt file and that should allow it in the asset bundle. Or just a straight .txt file should do the trick too.

Re: Modding Tutorials

Posted: Thu Mar 01, 2018 1:51 pm
by Hazelnut
This page implies to me that json extension should be supported. https://docs.unity3d.com/560/Documentat ... Asset.html

I'll try changing to .txt tonight in case it does work.

Re: Modding Tutorials

Posted: Fri Mar 02, 2018 10:29 pm
by Skipper
Is there any way to make a list of all assets and calculate how many times each one is used? It could help to decide what stuff to remake in the first place. Because who wants to spend time on stuff that is rarely seen in the game?

Re: Modding Tutorials

Posted: Sat Mar 03, 2018 6:30 pm
by Al-Khwarizmi
Skipper wrote:Is there any way to make a list of all assets and calculate how many times each one is used? It could help to decide what stuff to remake in the first place. Because who wants to spend time on stuff that is rarely seen in the game?
Perfectionists :)

But what you say makes sense, anyway.

Re: Modding Tutorials

Posted: Wed Mar 07, 2018 12:39 pm
by Hazelnut
LypyL wrote: Known Issues

enums - scripts with enum types defined will fail to compile. You can still use any of the enum types already in the project. This is an issue with the mcs compiler.

generic functions / classes - similar to the above, due to an issue with the compiler scripts that try to define generic functions will not compile.

Unity Versions - mods created in newer versions of unity might not be compatible with older versions of unity. This is noticeable if the mod is in the mod directory, but doesn't show up in the list of mods.
No idea if this is somewhere later in the thread, but we really need to update this list of known issues with this one:

Type.GetType() - You can't get the type of a class added in a mod from a class outside the mod i.e. DFU core. You have to register the type from the mod code and use that Type instance.

I spent ages trying to figure out why code would work in debug but not when packaged into a modfile.