Frictional Games Forum (read-only)

Full Version: Loading custom assets (graphics) into mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm stuck on this and after hours of trying I am getting desperate. I am making a mod that involves unlocking and locking doors from a computer terminal (similar to the theta map where you had to get down the elevator). However I am having difficulties loading my own map on the computer monitor.

I had looked over the code used in the theta map and I copied it. One part of this code involved loading the 'background map' which was an image of the theta rooms and hallways.

Code:
settings.mMapBackground = cImGuiGfx("theta_securitymap", eImGuiGfx_Texture);

This file was simply called 'theta_securitymap' which was located in the 'graphics/imgui/station/theta_securitymap' directory. Whenever I edited the actual file (.dds) in Paint.Net it changed, however when I tried to change the image and put it in a different location in cImGuiGfx() to something like;

Code:
settings.mMapBackground = cImGuiGfx("mods/test/graphics/theta_securitymap.dds", eImGuiGfx_Texture);

It simply showed the original map again. It seems like it doesn't point to any file not in the predefined '/graphics' folder in the original game folder.

When I renamed the file to something like;

Code:
settings.mMapBackground = cImGuiGfx("mods/test/graphics/upsilon_securitymap.dds", eImGuiGfx_Texture);

no background on the terminal was displayed (obviously the file wasn't found). I looked around and I found that I needed to change my resources.cfg file to point to a '/graphics' folder in my mod folder . So I did;

Code:
<Resources>
    <Directory Path="/config" AddSubDirs="true"/>
    <Directory Path="/graphics" AddSubDirs="true"/>
    <Directory Path="/maps" AddSubDirs="true"/>
</Resources>

and in my mod folder I added the directory 'graphics/imgui/station/theta_securitymap/' and added the 'theta_securitymap.dds' file in it but I still got the original image and not my modified one.

WTF? - to put it simply. Why isn't this working? Can someone give me a good explanation on how I would add my own textures (in this case for the cImGuiGfx() function) into my mod?

Cheers.
To clarify, are you adding those lines to your mod's resources file, or are you editing the existing SOMA resources file? And are you running your mod in the SomaDev.Bat or through the ModLauncher?

Also, I'm not 100% certain, but I'm pretty sure that when a non-script file gets loaded, it gets ignored if an asset of the same name already exists. Try renaming your updated security map to some other name. (Any particular reason you're trying to leave it as the same name?)
(04-15-2016, 11:07 AM)Abion47 Wrote: [ -> ]To clarify, are you adding those lines to your mod's resources file, or are you editing the existing SOMA resources file? And are you running your mod in the SomaDev.Bat or through the ModLauncher?

Also, I'm not 100% certain, but I'm pretty sure that when a non-script file gets loaded, it gets ignored if an asset of the same name already exists. Try renaming your updated security map to some other name. (Any particular reason you're trying to leave it as the same name?)

I'm running this game through SomaDev.bat. And those lines are in my mod's resources.cfg file. I was leaving it as the file as the same name because when I try to replace a script I needed to include the '/script' folder in my mod along the same file name with a reference to it in my resources.cfg file. So I figured it was the same for my graphics. I will try running it through soma.exe -mod and see what happens.
Never mind. Running it as a mod worked as it actually read the entry.hpc file. However how would I run this 'mod' in developer mod so that it loads my custom assets and allows me to reload the map? (So I can test what the new security map would look like)
(04-16-2016, 03:52 AM)ghoststeam217 Wrote: [ -> ]Never mind. Running it as a mod worked as it actually read the entry.hpc file. However how would I run this 'mod' in developer mod so that it loads my custom assets and allows me to reload the map? (So I can test what the new security map would look like)

At the end of SOMA's resource file (in the root), add a directory for the "/mods" folder, with true for adding subdirectories. That should include it when SomaDev.bat is run.
SomaDev.bat behaved weird for me as far as I remember, so I just use the non steam modlauncher, and edit the profile to have dev settings.