Modding Tutorials

Discuss modding questions and implementation details.
Post Reply
User avatar
JIRKA_222
Posts: 9
Joined: Wed Apr 21, 2021 5:11 pm
Location: Czech Republic

Re: Modding Tutorials

Post by JIRKA_222 »

I'm working on a mod making the bestiary from one of the demos. I would like to load the text in the gui from a .txt file.

This is what I mean by "the text":
Untitled.png
Untitled.png (528.51 KiB) Viewed 95 times
I've found this bit of code, to import text from a text file:

Code: Select all

string pathToEntry = "orc_entry.txt";
string[] entryText = File.ReadAllLines(pathToEntry);
But I don't know, what path to enter, to make it point to a the .txt, as a part of the mod. Entering a relative path makes it point into the daggerfallunity main folder, but not into the mod.
What do I have to enter, to make it point to the for example orc_entry.txt file (in the Scripts folder)?

Here is my whole mod folder:
Bestiary.zip
(48.04 KiB) Not downloaded yet
Thanks

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

Re: Modding Tutorials

Post by TheLacus »

Hi,

you can include the text file in your mod and load it with GetAsset<T>(String, Boolean):

Code: Select all

TextAsset textAsset = mod.GetAsset<TextAsset>("orc_entry");
Alternatively, look here if you want localization support.
Mod System documentation - Learn how to create mods for Daggerfall Unity.
Modder Discussion - General help and discussion for the mod system.
Github Issues - Submit a bug report for the game, including the mod system.

User avatar
JIRKA_222
Posts: 9
Joined: Wed Apr 21, 2021 5:11 pm
Location: Czech Republic

Re: Modding Tutorials

Post by JIRKA_222 »

Got it to work,
thanks.

Post Reply