Making custom menus for mods (Adding customized buttons to main and ingame menus + customizing conne
Writing it here since I fucked something up with posting
Making a custom looking menu for the ingame menu is pretty simple. Basically all you will need to keep in it is the main MenuDef, and suggest that you keep the #define rows too.
You can delete the original code part
#include "ui_mp/ingamebg.inc"
#undef CHOICE_X_START
#define CHOICE_X_START -320
#undef CHOICE_HORIZONTAL_ALIGN
#define CHOICE_HORIZONTAL_ALIGN HORIZONTAL_ALIGN_CENTER
CHOICE_MENU_TITLE( "@MPUI_CHOOSE_TEAM" )
#include "ui_mp/tactical_map.inc";
#define BACK_OPEN ;
#include "ui_mp/navcontrols.inc"
CHOICE_HIGHLIGHT( 1, 0 )
CHOICE_BUTTON_VIS_NOHI( 1, "1. " + dvarString( g_TeamName_Allies ), play "mouse_click"; scriptMenuResponse "allies";, when( ( team( name ) == "TEAM_SPECTATOR" || team(name) == "TEAM_FREE" || team( name ) == "TEAM_AXIS" ) ); )
CHOICE_DBUTTON_VIS_NOHI( 1, "1. " + dvarString( g_TeamName_Allies ), when( team( name ) == "TEAM_ALLIES" ); )
CHOICE_HIGHLIGHT( 2, 0 )
CHOICE_BUTTON_VIS_NOHI( 2, "2. " + dvarString( g_TeamName_Axis ), play "mouse_click"; scriptMenuResponse "axis";, when( ( team( name ) == "TEAM_SPECTATOR" || team(name) == "TEAM_FREE" || team( name ) == "TEAM_ALLIES" ) ); )
CHOICE_DBUTTON_VIS_NOHI( 2, "2. " + dvarString( g_TeamName_Axis ), when( team( name ) == "TEAM_AXIS" ); )
CHOICE_HIGHLIGHT( 3, 0 )
CHOICE_BUTTON_VIS_NOHI( 3, "3. Auto-Assign", play "mouse_click"; scriptMenuResponse "autoassign";, 1 )
CHOICE_HIGHLIGHT( 4, 0 )
CHOICE_BUTTON_VIS_NOHI( 4, "4. Shoutcaster", play "mouse_click"; close self;scriptMenuResponse "shoutcast";, when( team( name ) != "TEAM_SPECTATOR" ); )
CHOICE_DBUTTON_VIS_NOHI( 4, "4. Shoutcaster", when( team( name ) == "TEAM_SPECTATOR" ); )
CHOICE_HIGHLIGHT( 5, when( team( name ) == "TEAM_FREE" ) )
CHOICE_BUTTON_VIS_NOHI( 5, "@MPUI_LEAVE_GAME", open popup_endgame, when(team(name) == "TEAM_FREE") )
execKey "1" { scriptMenuResponse "allies"; }
execKey "2" { scriptMenuResponse "axis"; }
execKey "3" { scriptMenuResponse "autoassign"; }
execKey "4" { scriptMenuResponse "shoutcast"; }
A item making is pretty simple as well
itemDef
{
visible 1
rect 30 /*This is align from left to right */ 80 /*Align from top to bottom */ 600 /* size of the item in pixels from left to right */ 300 /* size in pixels from top to bottom */
style WINDOW_STYLE_SHADER
background "ing_bg" // The item material name
decoration /* This row is optional, in ingame menu it can stay in but if you have this in main.menu file item of button then when pressing the button, it wont work*/
}
The align spot can change in rect since there is this behind some rect numbers ( HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_CENTER ) which says to mod to read start point in middle of the screen
The most common button uses 2 items off and on
Example
itemdef
{
rect 115 170 80 36
style WINDOW_STYLE_SHADER
type ITEM_TYPE_BUTTON
background "join"
visible 1
decoration
mouseenter {
play "mouse_over";
show "join_on";
}
mouseexit {
hide "join_on";
}
}
itemdef
{
name "join_on"
rect 115 170 80 36
style WINDOW_STYLE_SHADER
type ITEM_TYPE_BUTTON
background "join_on"
visible 0
decoration
action {
play "mouse_click";
close self;
scriptMenuResponse "autoassign";
}
}
I got an example which should look the 2nd item for main since you can keep the first one like in previous ones
itemdef
{
name "menu_server_on"
rect 60 170 110 55
style WINDOW_STYLE_SHADER
type ITEM_TYPE_BUTTON
background "menu_server_on"
visible 0
action
{
play "mouse_click";
open pc_join_unranked;
}
}
For asset manager. There aint many settings
Main things are
Entry - material
Materialtype - 2d
Surface - none
usage - not in editor
Blendfunc - I suggest either replace or blend (Blend is for transparent but you can use it for both)
In colormap part
no tile
nomip
Thats all
If you got additional questions, write in comments
Best Regards,
Druglord
Posted on 27.07.2017 / 21:34
REPLIES
Connect uses only the first itemDef in post since your mouse will be mainly freezed during your connection to server
Posted on 27.07.2017 / 21:35
oO interesting
Posted on 29.04.2018 / 15:50
Good job!
Posted on 17.05.2018 / 2:11
Hi, I will be very thankful. If anyone can tell me how to make materials.
Posted on 21.02.2019 / 7:42
check druglord description open bin/assetmanager
For asset manager. There aint many settings
Main things are
Entry - material
Materialtype - 2d
Surface - none
usage - not in editor
Blendfunc - I suggest either replace or blend (Blend is for transparent but you can use it for both)
In colormap part
no tile
nomip
Posted on 21.02.2019 / 10:13
This is GREAT! Thanks for the tutorial!
Posted on 22.02.2019 / 13:01
Glad people still check this thread and it is helping you make your own mods
Since I've not really been active in CFGFactory as much as I used to. If you got any questions related to this thread
Discord - @Red Mist#0414
Posted on 22.02.2019 / 20:28 - Edited by Druglord on 22.02.2019 / 20:29
Post reply
ONLY USERS CAN POST REPLIES.