M_*.lua files and BGEE.lua
Dee
Member Posts: 10,447
in UI Modding
So you want to change a table in BGEE.lua, right? You don't like the portraits that are in the list by default, you want to replace them with your own portrait pack's portraits. But you don't want to have to override the entire BGEE.lua file; what if an update comes out that changes that file? You want to be able to get all the juicy fixes.
We can help.
The v2.2 update adds native support for M_*.lua files. Drop any .lua file with a prefix of M_ into override, and the engine will load it just like BGEE.lua.
You can do a whole lot with an M_*.lua file. But today, let's focus on this fun thing: overwriting the contents of BGEE.lua, without having to overwrite ALL of BGEE.lua.
Start by opening BGEE.lua, and copy the entire portraits table into a new file. That whole file should look something like this:
You can also use an M_ file to overwrite variables, too; want to change a single fontcolor entry in the fontcolor table? Just put this into an M_ file:
Obviously, BGEE.lua contains more than just fonts and portraits, and that means you can do a lot more with M_*.lua files. But if you're working on UI mods, an M_ file can make the difference between "This mod will break after the next update" and "This mod will work with no problems even with future updates".
Enjoy!
We can help.
The v2.2 update adds native support for M_*.lua files. Drop any .lua file with a prefix of M_ into override, and the engine will load it just like BGEE.lua.
You can do a whole lot with an M_*.lua file. But today, let's focus on this fun thing: overwriting the contents of BGEE.lua, without having to overwrite ALL of BGEE.lua.
Start by opening BGEE.lua, and copy the entire portraits table into a new file. That whole file should look something like this:
portraits =Now, in that new file, let's get rid of all those portraits except for Neera's portrait and Dorn's portrait. We all love Neera and Dorn, right? Now the table should look like this:
{
{'MAN1', 1},
{'MAN2', 1},
{'GENDWRF', 1},
{'GENMELF', 1},
{'GENMHLF', 1},
{'NHORC', 1},
{'AJANTIS', 1},
{'CORAN', 1},
{'EDWIN', 1},
{'ELDOTH', 1},
{'GARRICK', 1},
{'KAGAIN', 1},
{'KHALID', 1},
{'KIVAN', 1},
{'MINSC', 1},
{'MONTAR', 1},
{'QUAYLE', 1},
{'TIAX', 1},
{'XAN', 1},
{'XZAR', 1},
{'YESLICK', 1},
{'RASAAD', 1},
{'DORN', 1},
{'BAELOTH', 1},
{'GLINT', 1},
{'VOGHILN', 1},
{'NEDWIN', 1},
{'NMINSC', 1},
{'MANLEY0', 1},
{'MANLEY3', 1},
{'MANLEY6', 1},
{'MANLEY7', 1},
{'MANLEY8', 1},
{'MANLEY9', 1},
{'BDSHAM1L', 1},
{'BDORCM1L', 1},
{'WOMAN1', 2},
{'WOMAN2', 2},
{'ALORA', 2},
{'BRANWE', 2},
{'DYNAHEI', 2},
{'FALDORN', 2},
{'IMOEN', 2},
{'BDIMOEN', 2},
{'JAHEIRA', 2},
{'SAFANA', 2},
{'SHARTEL', 2},
{'SKIE', 2},
{'VICONIA', 2},
{'BDVICON', 2},
{'NEERA', 2},
{'SCHAEL', 2},
{'DSCLARA', 2},
{'NJAHEIR', 2},
{'NVICON', 2},
{'MANLEY1', 2},
{'MANLEY2', 2},
{'MANLEY4', 2},
{'MANLEY5', 2},
{'MANLEYX', 2},
{'BDSHAF1L', 2},
{'BDORCF1L', 2}
}
portraits =Save that file as M_PORT.lua into your override folder. Now start the game and go into character creation; choose either gender, and you'll see that the list of available portraits has been completely overwritten!
{
{'DORN', 1},
{'NEERA', 2}
}
You can also use an M_ file to overwrite variables, too; want to change a single fontcolor entry in the fontcolor table? Just put this into an M_ file:
fontcolors['1'] = 'FFCAE2E9' -- titleChange the value to whatever you want, save it, and it'll show up as the new color in-game.
Obviously, BGEE.lua contains more than just fonts and portraits, and that means you can do a lot more with M_*.lua files. But if you're working on UI mods, an M_ file can make the difference between "This mod will break after the next update" and "This mod will work with no problems even with future updates".
Enjoy!
16
Comments
Even so--being able to make changes to the specific tables in BGEE.lua that directly impact the UI is a valuable tool.