Torchlight II

Torchlight II

UI Display Toggle (v.48)
roberto tomás  [utvikler] 17. mars 2014 kl. 8.54
How to modify custom classes to work with this mod
Each charge bar element in the game has it's own Menu Definition, so this mod must detect the class to know which UI Menu element to toggle.

These changes should be made to your mod. There's no reason for me to recompile my mod to include every else's classes when those classes may not be loaded by people, so keep your mess in your own project. :) Alternatively, if you wanted to adapt a class that is not your own, you could download it and unpack it so you have the source handy, but then put the files created and altered in these steps into your own new project.

create a stat to identify your class
To get your class to work with this mod, you must create a new stat that you will toggle in your class. Open Data Editors -> Stats. Create a new stat (click the plus sign), and name it with the convention "class_myclassname" —where you change "myclassname" to the one-word name of your class. Set the value type to "TYPE_BOOL", and then save (click the disk icon — in case you are too young to remember what disks are, it's the icon to the left of the plus sign).

add the stat to your class' base
Now toggle that stat in your class. Open Data Editors -> Units -> Players, and select your class file's base (there are three for each class usually, a base, and one for each gender that inherit variables from the base). When it loads it should open with the Stats tab open on the bottom half of the window. Towards the right is a Stats enumerable list, composed of 2 columns 'STAT' and 'VALUE'. Click on the first blank in the STAT column, and it becomes a drop-down select menu. Select your stat, that you named according to the convention "class_myclassname". Then click in the VALUE column beside the STAT you just added, and set it to "1". Save (click the disk icon in the top left).

ensure your charge bar has a menu name
I'm not even sure it is possible to make a displayable ui element that does not have a menu definition with a name defined. In any case, ensure that yours has one and make a note of the menu name. In the main window's left column, select the UI tab along the bottom of the column. Then select File -> Open, and open your class' charge bar. If your class is reusing a base class' charge bar (not changing it), then navigate up from the mods folder and look in MEDIA/UI/UNITUNIQUEITEMS.

Once open, select the Menu Definition. In the right column, select the Properties tab at the bottom of the column. In that column now, 'MENU NAME' is under 'UI PROPERTIES'.

If this is your own Charge bar and you don't have a menu definition, well add it! Copy the settings from another class' charge bar, but set the 'MENU NAME' wth the convention "MYCLASSNAMECHARGEBAR". Now your charge bar is addressable for UI events.

create the logic for toggling the ui
Build this layout in the UI Layout Manager:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=243609445
Just to be clear the HUD Display controller at the top should be pointed to the UI Element named "HUD"

At this point your class should be working fine with this mod. Recompile it and give it a spin.
Sist redigert av roberto tomás; 29. mars 2014 kl. 9.35