Can I add custom UI with triggers in my current system?

Level 32
Joined
Aug 10, 2018
Messages
3,408
By custom UI do you mean something like replacing the Human Interface (castle stones) with alternate art? I believe this is doable although I've never done it.

It looks like the system assigns each player a Variable: AM_RaceChosen[player number]

You could reference this variable like:
  • Custom script: call CustomUIFunction(udg_AM_RaceChosen[X])
X = Player Number

CustomUIFunction() would be a function that takes the chosen race Integer and modifies the players UI depending on the value. 1 = Human, 2 = Orc, etc...

And if you mean custom UI to replace the Dialog Buttons, that's definitely possible, but you'd need to rework the system to use BlzFrameButtons instead of Dialog Buttons.
 
Level 9
Joined
Mar 26, 2017
Messages
362
It is possible now to do this for more than 4 races, but you will need to do following:
1. Hide all default UI tiles (such as the ones with paths: "ui\console\undead\undeaduitile01.blp")
You can find all available UI tiles using CascView. A good method of hiding would be to import a transparent blp file under the path of each default UI tile.
2. Import all UI tile elements for all races. For the default races they can be the ones you extracted from CascView. For added races it should be the ones you made yourself, or that you downloaded from the Hive.
3. For each player, create the UI elements with the UI functions:
-BlzCreateFrameByType (to create frames that are able to show textures for each UI element)
-BlzFrameSetSize (to appropriately size each element)
-BlzFrameSetAbsPoint (to place the frame at the correct position on the screen)
-BlzFrameSetTexture (to load in the correct image that corresponds to the UI element and the user selected race)

Be reminded that this is fair amount of work. Especially sizing and positioning the frames using this method.

I personally think if you would go as far as using these custom UI functions, it would be better to just remove the UI tiles alltogether, and add some minimalistic UI. It is preferred for a player to see as much of the game field as possible, and not have parts blocked by static images.
 
Last edited:
Level 26
Joined
Jul 18, 2010
Messages
1,829
one can do using the frame UI api In 1.32+ (Reforged) for the backgrounds. I don't know how one could change daytime clock, Dialogs, MenuButtons, Mouse and idle worker button during the game. UI-Sounds might also be a problem, like noGold, hero has fallen ....

This can be done by loading a custom "ConsoleUI" frame definition inside a fdf which is loaded before the default one that way one can give the textures names. By giving this Textures names one can set the textures during the game. The textures would than be set localy only for the player selecting the race. That way one would only have to add some text to a fdf and do some BlzFrameSetTexture lines instead of recreating them.
The loading is done in function config or in the Lua root.

In 1.31 one can not use thie frame definition overwritting. Hence one would have to overwrite the default ConsoleUI with Allow Local Files in the game folder which is dangerous because than you can't play anymore with people not having the same custom fdf.
Or one would do what pr114 said and recreate them.

I added a Test map (Reforged) to demonstrate that.

The Lua code would than be something like that
Lua:
-- replace the frame definition "ConsoleUI" to give the Textures names
BlzLoadTOCFile("war3mapImported\\myconsoleui.toc")
TimerStart(CreateTimer(), 1, false, function()
    -- give this frames handleIds at 0s, before any players UI is altered with this technique, that way you have no desync when getting them later with BlzGetFrameByName in a GetLocalPlayer() block.
    BlzGetFrameByName("ConsoleUI5T", 0)
    BlzGetFrameByName("ConsoleUI6T", 0)
    BlzGetFrameByName("ConsoleUI4T", 0)
    BlzGetFrameByName("ConsoleUI3T", 0)
    BlzGetFrameByName("ConsoleUI2TL", 0)
    BlzGetFrameByName("ConsoleUI2TR", 0)
    BlzGetFrameByName("ConsoleUI1T", 0)

    BlzGetFrameByName("ConsoleUI1B", 0)
    BlzGetFrameByName("ConsoleUI2B", 0)
    BlzGetFrameByName("ConsoleUI3B", 0)
    BlzGetFrameByName("ConsoleUI4B", 0)
    BlzGetFrameByName("ConsoleUI5B", 0)
    BlzGetFrameByName("ConsoleUI6B", 0)
    BlzGetFrameByName("InventoryCoverTexture", 0)

    -- update the used textures, this would be done in a GetLocalPlayer() block
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI5T", 0), "war3mapImported\\HumanUITile05.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI6T", 0), "war3mapImported\\HumanUITile06.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI4T", 0), "war3mapImported\\HumanUITile04.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI3T", 0), "war3mapImported\\HumanUITile03.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI2TL", 0), "war3mapImported\\HumanUITile02.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI2TR", 0), "war3mapImported\\HumanUITile02.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI1T", 0), "war3mapImported\\HumanUITile01.blp", 0, false)

    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI1B", 0), "war3mapImported\\HumanUITile01.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI2B", 0), "war3mapImported\\HumanUITile02.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI3B", 0), "war3mapImported\\HumanUITile03.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI4B", 0), "war3mapImported\\HumanUITile04.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI5B", 0), "war3mapImported\\HumanUITile05.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("ConsoleUI6B", 0), "war3mapImported\\HumanUITile06.blp", 0, false)
    BlzFrameSetTexture(BlzGetFrameByName("InventoryCoverTexture", 0), "war3mapImported\\HumanUITile-InventoryCover.blp", 0, false)

end)
 

Attachments

  • Change UI Reforged.w3x
    603.4 KB · Views: 59
Level 3
Joined
Apr 1, 2020
Messages
64
Thank you all for your input. I'm trying to get this but the deal is that I'm not that great at triggers. It took me about a month to get my map where I could train more than 3 heroes. So.... Like I said. Can anyone simply add in the ui with the triggers that are in the map I listed? I'm looking for the frames, the cursor and the sounds to match each of the new races and of course the original races to stay the same. There are great UI's here on the hive but the only tutorials on implementing them include using a campaign UI or replacing the original 4 races, which just doesn't fit the project I am doing. My partner is a sound engineer so we are doing our own sounds for many of our units and we can do the same for the ui if there is a system to quickly implement it with each race. So what I need is the system. Insert frames here. Insert Cursor here. Insert sound file here. ETC
 
Thank you all for your input. I'm trying to get this but the deal is that I'm not that great at triggers. It took me about a month to get my map where I could train more than 3 heroes. So.... Like I said. Can anyone simply add in the ui with the triggers that are in the map I listed? I'm looking for the frames, the cursor and the sounds to match each of the new races and of course the original races to stay the same. There are great UI's here on the hive but the only tutorials on implementing them include using a campaign UI or replacing the original 4 races, which just doesn't fit the project I am doing. My partner is a sound engineer so we are doing our own sounds for many of our units and we can do the same for the ui if there is a system to quickly implement it with each race. So what I need is the system. Insert frames here. Insert Cursor here. Insert sound file here. ETC
Tasyen already posted it.
 
Top