Due to the likelihood of lots of mods conflicting with playerhudcomponents.gfx, mod authors may not want to make tons of combination patches for every possible combination of mod.

This article will show how to port the changes from this mod to another mod and have it as a baseline feature. You can then release that mod without having to make a patch (and an extra installation step). Please remember to credit me if you include this mod in yours.

Open both this mod and the .gfx file you wish to port your changes to. Having both open will allow you to easily copy elements and code from one mod to another.

To start, add a new class with this name to the scripts node and copy the entire contents of this class to it:
FSNovask.PowerNameSettings



This class parses a text file ("ShowPowerNameHUDTranslate.txt") for power name translations. 

Next, you will want to start changing the BottomRightGroup script:

Add this line with the other imports:
import FSNovask.PowerNameSettings;
Copy these lines and add them to your own mod:


Copy this first if/else block within this event handler. This sets the text and visibility if the player has a spell equipped:


The code has now been ported and you can move on to porting the sprites and text field. 

In this mod, find the tag named "PowerName_mc" under Frame 1 of the BottomRightGroup sprite. Right-click and choose "Copy tag with dependencies to" (Do not use "Copy tag to" here! Very important!) to your own mod .gfx file. The next step will show you where to place this in your mod.


In your mod, you will want to copy this tag to the same relative position (just above "ShowFrame") in Frame 1 of the BottomRightGroup sprite. If additional tags have been added to this frame in your mod, and there's already something at Depth 44, you will want to change the Depth to a number that isn't used.


If additional tags have been added to this frame and there's already something at Depth 44, you will want to change the Depth to a number that isn't used. It's also helpful to keep the depth numbers in order. You can move the tag around to keep that order.

Now open Frame 31 in this mod and find the PlaceObject3 tag at Depth 44. "Copy tag to" and select your mod file and place it in Frame 31 in the same relative position. Do not use "Copy tag with dependencies to" for these next steps!


The destination for Frame 31:


Repeat this process for Frames 61 and 91:

---



Frame 91:

---


For playerhudcomponents_lrg.gfx, you will repeat this step. These _lrg interface files are used when the user has "Enable Large Menu Fonts" turned on in Accessibility settings. You should copy things from this mod's playerhudcomponents_lrg.gfx to your mod's _lrg file. Copying things from playerhudcomponents.gfx to a _lrg file results in positioning problems.

Once you have copied all of the tags, you should be able to save the entire .gfx file and rename it playerhudcomponents.gfx and see it in-game.

Remember to disable any mods in your mod manager that changes this same file. If Vortex deploys a mod to your interface folder that also has this file, it will rename the existing one. In case that happens, you should disable the mod in Vortex and deploy again. Don't delete things or you might lose your changes. Remember to back up your work too.

You can also make changes to this file while the game is running, but you will need to load a save to see it in the game. The game loads this interface file once and only loading a save refreshes it. This saves time by not having to restart the entire game if you need to make small, iterative changes to the file.

If you do not see the health bar and other elements (or the power name if you equip one), try to revisit each step and go slowly to see if there was anything missed. Things can fail silently or may crash the game.

Imgur Album of steps for reference: https://imgur.com/a/bUDSeAR

Article information

Added on

Edited on

Written by

FSNovask

0 comments