can you .foreground=true the hud?
If not, then you're mostly boned due to the fact that player-opened menus are different...
Hm, I don't see a way to foreground all the 2d stuff or the .menu
Gonna just put the dvar things in hud.menu, since that is displayed without any precaching/opening
timescale 0.01
replace your wm_quickmenu with a short placeholdermenu containing only that for every quickmenu:
and in gsc update the corresponding var:Code:onOpen { openmenuondvar ui_quickmenu myquickmenu1 quickmenu1; openmenuondvar ui_quickmenu myquickmenu2 quickmenu2; openmenuondvar ui_quickmenu myquickmenu3 quickmenu3; //optionally: //closemenuondvarnot ui_quickmenu myquickmenu1 quickmenu1; //closemenuondvarnot ui_quickmenu myquickmenu2 quickmenu2; //closemenuondvarnot ui_quickmenu myquickmenu3 quickmenu3; }
opening a menu via wm_quickmenu prevents me from hiding allhuds when opening a custom menuCode:openQuickMenu( menu ) { player setClientCvar( "ui_quickmenu" , menu ); player execClientCommand( "wm-quickmenu" ); //dont know the command when pressing [V] }
Last edited by serthy; 2nd February 2014 at 06:39.
kung foo man (2nd February 2014)
Script Menus will by default hide hud elements. You can get your mouse to work with them by using a dvar to allow it, but hud elements are typically hidden. They fixed this in COD4, and you now have to manually put in an aspect to the hud element to get hidden when a menu is open.
The only menus that don't hide hud elements are ones that are called straight from ui_mp (ie. none-script menus). There is, of course, the stock hud.menu. This is open all the time, and does not prevent hud elements from showing. I created my own one so that I didn't have to keep editing hud.menu (it was already too big), and you call these by hud.txt:
You will notice dpadhud.menu. This is opened on the player when he joins the server - whether he is in spectator or spawned. And it was designed to take over many hud elements because my mod draws too many hud elements, and I had reached the element limit. So, you might consider doing the same thing.Code:// hud menu defs // { loadMenu { "ui_mp/hud.menu" } loadMenu { "ui_mp/dpadhud.menu" } }
There is one major drawback with these menus, and it may not suit your purposes because of it: the itemDef{} are limited: you can't use a dvar to show text; and you have to use an ownerdraw of some sort in order for the item to show.
Here is my dpadhud.menu with examples of ownerdraw:
I use 2 ownerdraw: 1) CG_PLAYER_WEAPON_MODE_ICON = this draws text; 2) CG_PLAYER_COMPASS_BACK = this draws all my shaders.PHP Code:
#include "ui_mp/menudef.h"
{ // DPAD HUD
// KEYBOARD MAP
menuDef
{
name "keyboardmap"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 450 425 640 40
itemDef
{
name "hud_keyboardmap"
rect 0 5 50 50
forecolor 1 1 1 .4
ownerdraw CG_PLAYER_COMPASS_BACK
background "hud_keyboardmap"
visible MENU_TRUE
decoration
dvartest "scr_demon_dynamic_perks"
showDvar { "1" }
}
itemDef
{
name "hud_keyboardmap"
rect 0 52 70 70
text "[ K ]"
forecolor 1 1 1 .6
textstyle ITEM_TEXTSTYLE_SHADOWED
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textscale .25
textalignx 14
dvartest "scr_demon_dynamic_perks"
showDvar { "1" }
}
}
//Binoculars
menuDef
{
name "binoculars"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 370 428 640 40
itemDef
{
name "binoculars"
rect 5 5 34 34
forecolor 1 1 1 .4
background "weapon_binoculars"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_binoculars"
showDvar { "1" }
}
itemDef
{
name "binoculars"
rect -1 50 70 70
text "[ L ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 14
dvartest "cg_player_binoculars"
showDvar { "1" }
}
}
//Tactical Insertion
menuDef
{
name "insertion"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 300 428 640 40
itemDef
{
name "insertion"
rect 7 7 30 30
forecolor 1 1 1 .4
background "hud_insertion"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_insertion"
showDvar { "1" }
}
itemDef
{
name "insertion"
rect -1 50 70 70
text "[ M ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 14
dvartest "cg_player_insertion"
showDvar { "1" }
}
}
//First Aid
menuDef
{
name "firstaid"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 300 428 640 40
itemDef
{
name "firstaid"
rect 7 7 30 30
forecolor 1 1 1 .4
background "hud_firstaid"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_firstaid"
showDvar { "1" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "[ ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 14
dvartest "cg_player_firstaid"
showDvar { "1" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "0"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 19
dvartest "cg_player_firstaid_value"
showDvar { "0" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "1"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 19
dvartest "cg_player_firstaid_value"
showDvar { "1" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "2"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 19
dvartest "cg_player_firstaid_value"
showDvar { "2" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "3"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 19
dvartest "cg_player_firstaid_value"
showDvar { "3" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "4"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 19
dvartest "cg_player_firstaid_value"
showDvar { "4" }
}
itemDef
{
name "firstaid"
rect 0 50 70 70
text "5"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 19
dvartest "cg_player_firstaid_value"
showDvar { "5" }
}
}
// TRIPWIRES
menuDef
{
name "tripwires"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 230 428 640 40
itemDef
{
name "tripwire"
rect 5 3 35 35
forecolor 1 1 1 .4
background "hud_tripwire_dpad"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_tripwire"
showDvar { "1" }
}
itemDef
{
name "tripwire"
rect 0 50 70 70
text "[ ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_tripwire"
showDvar { "1" }
textalignx 14
}
itemDef
{
name "tripwire"
rect 0 50 70 70
text "2"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_tripwire_count"
showDvar { "2" }
textalignx 19
}
itemDef
{
name "tripwire"
rect 0 50 70 70
text "1"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_tripwire_count"
showDvar { "1" }
textalignx 19
}
itemDef
{
name "tripwire"
rect 0 50 70 70
text "0"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_tripwire_count"
showDvar { "0" }
textalignx 19
}
}
// LANDMINES
menuDef
{
name "landmines"
fullScreen MENU_FALSE
visible 1
rect 230 428 640 40
itemDef
{
name "landmine"
rect 5 1 35 35
forecolor 1 1 1 .4
background "hud_landmine"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_landmine"
showDvar { "allies" }
}
itemDef
{
name "landmine"
rect 5 1 35 35
forecolor 1 1 1 .4
background "hud_tellermine"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_landmine"
showDvar { "axis" }
}
itemDef
{
name "landmine"
rect 0 50 70 70
text "[ ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_landmine_brackets"
showDvar { "1" }
textalignx 14
}
itemDef
{
name "landmine"
rect 0 50 70 70
text "2"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_landmine_count"
showDvar { "2" }
textalignx 19
}
itemDef
{
name "landmine"
rect 0 50 70 70
text "1"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_landmine_count"
showDvar { "1" }
textalignx 19
}
itemDef
{
name "landmine"
rect 0 50 70 70
text "0"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_landmine_count"
showDvar { "0" }
textalignx 19
}
}
//==================== HARDPOINTS ===========================
//Artillery
menuDef
{
name "artillery"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 150 428 640 40
itemDef
{
name "artillery"
rect 9 -2 39 39
forecolor 1 1 1 .4
background "hud_artillery"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_artillery"
showDvar { "1" }
}
itemDef
{
name "artillery"
rect 0 50 70 70
text "[ 1 ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
textalignx 14
dvartest "cg_player_artillery_count"
showDvar { "1" }
}
}
//Airstrike
menuDef
{
name "airstrike"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 150 428 640 40
itemDef
{
name "airstrike"
rect 5 2 37 37
forecolor 1 1 1 .4
background "hud_airstrike"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_airstrike"
showDvar { "1" }
}
itemDef
{
name "airstrike"
rect 0 50 70 70
text "[ 1 ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_airstrike_count"
showDvar { "1" }
textalignx 14
}
}
//Carepackage
menuDef
{
name "Carepackage"
fullScreen MENU_FALSE
visible MENU_TRUE
rect 150 428 640 40
itemDef
{
name "Carepackage"
rect 6 -2 39 39
forecolor 1 1 1 .4
background "hud_carepackage"
ownerdraw CG_PLAYER_COMPASS_BACK
visible MENU_TRUE
decoration
dvartest "cg_player_carepackage"
showDvar { "1" }
}
itemDef
{
name "Carepackage"
rect 0 50 70 70
text "[ M ]"
textstyle ITEM_TEXTSTYLE_SHADOWED
textscale .25
forecolor 1 1 1 .6
ownerdraw CG_PLAYER_WEAPON_MODE_ICON
visible MENU_TRUE
decoration
dvartest "cg_player_carepackage_count"
showDvar { "1" }
textalignx 14
}
}
}
Last edited by Tally; 2nd February 2014 at 09:52.
kung foo man (2nd February 2014),Mitch (2nd February 2014)
Thanks for the input, I'm not sure which way I will use, maybe a mix of both
Hm, I just commented the ownerdraw out and now it prints my dvar "test".
You tested that out? I wonder why it didn't work for you (testing on 1.2 here)PHP Code:
//text "[ ]"
//ownerdraw CG_PLAYER_WEAPON_MODE_ICON
dvar test
My setup is very simple atm: clean CoD2, made a fs_game, start with an link: in the fs_game-folder test_menu I have the ui_mp folder which contains:
- ui_mp.iwd: this contains only the ui_mp/hud.txt, because otherwise it's not loaded
- ui_mp/dpadhud.menu, this is not zipped, so I just type "map_restart" after each change for very fast testing
timescale 0.01
Ok, back to the menu work ^^
That's also possible.PHP Code:
dvarTest "menu_show"
showDvar {"1"}
I needed some time figuring out why nothing at all were shown. Till I compared every menu-attribute with a working menuDef: the difference was "visible 1". It's even needed when every itemDef has "visible 1" already.
Edit:
Had to use:
PHP Code:
// format: uiScript openMenuOnDvar $cvarname $cvarvalue $menuname
uiScript openMenuOnDvar menu_ondvar mapvote mapvote;
Last edited by kung foo man; 12th February 2014 at 13:36. Reason: Update
timescale 0.01
I'm writing a dynamic quickchat atm, it's working quite nice, but I have one "big" problem: I can't close the menu quickmessage by script (only ESC). Does somebody know how to close it?
Tried a mix of:
PHP Code:
player closeMenu();
player closeMenu("quickmessage");
// failed lol:
//player setClientCvar("menu_ondvar", "quickmessage");
//player openMenu("quickmessage");
//player setClientCvar("menu_ondvar", "");
//player setclientcvar("clientcmd", "closemenu quickmessage");
player setclientcvar("clientcmd", "say quickmessage"); // printed AFTER menu is closed by ESC
player openMenu("clientcmd");
When I execute "closemenu quickmessage" by hand it works, but by script it's stuck by quickmessage-menu or so :SPHP Code:
wm_quickmessage.menu:
uiScript closeMenuOnDvar menu_ondvar quickmessage quickmessage;
clientcmd.menu:
onOpen
{
exec "vstr clientcmd";
close clientcmd;
close quickmessage;
}
Kinda running out of ideas
timescale 0.01
Open it manually using openmenu().
Then you can closemenu() it
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem