1.
These I think are for menu definitions only. I would say they are line continuations for the template that makes up the defined control. There is no reason to use while makign menu, unless you are defining some new structures. This is a 'best guess' answer.
2.
The team chosen is defined in the menu but is easier to adjust by editing the GSC files.
For menu edit, these are the two lines in "team_marinesopfor.menu".
Code: Select all
Â
// Team Axis. Only visible when current team is "spectator or 'no team')
CHOICE_BUTTON_VIS( 1, "@" + dvarString( g_TeamName_Axis ), play "mouse_click"; scriptMenuResponse "axis";, when( team( name ) == "TEAM_SPECTATOR" || team(name) == "TEAM_FREE" ); )
Â
// Team Allies. Only if NOT on team Allies
CHOICE_BUTTON_VIS_NOHI( 2, "@" + dvarString( g_TeamName_Allies ), play "mouse_click"; scriptMenuResponse "allies";, when( team( name ) == "TEAM_AXIS" || team( name ) == "TEAM_SPECTATOR" || team(name) == "TEAM_FREE" ); )
Â
// Team Axis. Only visible when on team Allies.
CHOICE_BUTTON_VIS_NOHI( 2, "@" + dvarString( g_TeamName_Axis ), play "mouse_click"; scriptMenuResponse "axis";, when( team( name ) == "TEAM_ALLIES" ); )Â Â Â Â
Â
// Team Random. Always visible.
CHOICE_BUTTON_EX( 3, "@MPUI_AUTOASSIGN", play "mouse_click"; scriptMenuResponse "autoassign";, name "auto_assign" ) Â Â
Â
// Team Spectator. Only visible when NOT spectator and spectator is enabled.
CHOICE_BUTTON_VIS_NOHI( 4, "@MPUI_SPECTATOR", play "mouse_click"; scriptMenuResponse "spectator";, when( team( name ) != "TEAM_SPECTATOR" && dvarbool( scr_game_spectatetype ) ); )
[/size]
You only need two buttons. You do not need either Team Axis or Team Random.
That leaves the two. Remove the lines you no longer need.
This will now have some functionality, but you will need to move the buttons in to the correct index order.
The Spectate & Allies button will share the same button space, so they should also share the same index (1).
This button also requires a 'BG' and 'HIGHLIGHT' setting, again index (1).
Next, we want the Spacer, the spacer must share the same index of the item it will com after, so again index (1).
Then the last 3 options (controls, options, leave) (index 2-4).
Because "MENU_CONTROLS" no longer shares a button with "SPECTATOR", you can change the button type from
"CHOICE_BUTTON_VIS_NOHI", to "CHOICE_BUTTON_VIS" and also remove the corresponding 'BG' and 'HIGHLIGHT' settings.
Finally, you want to play with the "visible" settings.
When you join the game, you are set to spectator, so you should only be able to see the "Allies" button.
When you join Allies, you want them to swap.
You do not need to touch the spectator visibility, as that will show when on a team. However you will need to make sure the Allies button displays ONLY when in spectate.
The final code with all the above changes, can be found below.
Code: Select all
CHOICE_BUTTON_BG( 1, 1 )
CHOICE_HIGHLIGHT( 1, 1 )
CHOICE_BUTTON_VIS_NOHI( 1, "@" + dvarString( g_TeamName_Allies ), play "mouse_click"; scriptMenuResponse "allies";, when( team( name ) == "TEAM_SPECTATOR"); )
CHOICE_BUTTON_VIS_NOHI( 1, "@MPUI_SPECTATOR", play "mouse_click"; scriptMenuResponse "spectator";, when( team( name ) != "TEAM_SPECTATOR" && dvarbool( scr_game_spectatetype ) ); )
CHOICE_SEPARATOR( 1 )
Â
CHOICE_BUTTON_VIS( 2, "@MENU_CONTROLS", close self; open main_controls;, when( team( name ) == "TEAM_SPECTATOR" ) )
CHOICE_BUTTON_VIS( 3, "@MENU_OPTIONS", close self; open main_options; execnow "set ui_allow_graphic_change 0";, when( team( name ) == "TEAM_SPECTATOR" ) )
CHOICE_BUTTON_VIS( 4, "@MPUI_LEAVE_GAME", open popup_endgame, when( team( name ) == "TEAM_SPECTATOR" ) )
[/size]
To get the code to work in-game:
- Save the file with exact same name "team_marinesopfor.menu".
- Place this files inside:
{CoD4}/mods/{Mod_Name}/ui_mp/scriptmenus/
- Now, open "modbuilder.exe". If you do not have a CSV, click "New CSV" after selecting your mod from the drop down.
(You will NOT be able to move the menu file into the CSV from here - it is not supported.)
- Once you have saved your CSV, change to the "MOD Builder" tab.
- Select your Mod in the 1st box and your FF CSV in the 2nd box.
- You need to add the following line manually:
Code: Select all
menufile,ui_mp/scriptmenus/team_marinesopfor.menu
Now save the CSV.
- You can now build your mod.
(Before building your mod, click the "Run Game" tab and make sure MP and your mod are selected. I also add "+developer 1 +devmap mp_backlot" in the Custom Parameters box - to instantly run a map)