In this tutorial I will be showing you how to make a basic menu with a quickmessage layout. This tutorial will be quite easy, so if you are not familiar with .menu files then this might be a good start!
Keep in mind that I assume that you know the basics of GSC modding.
SETUP
Make a new mod folder or use an existing one (Make a new one if you want to be sure) and create a new folder in the modroot called "ui_mp" then in the ui_mp folder you make another folder called "scriptmenus".
Then we want the layout of the menu, open your black ops folder and go to
Black Ops > Raw > ui_mp > scriptmenus > And open quickcommands.menu with notepad. Now go to: file > save as > save it in the scriptmenus folder you made and call it: mod_menu.
THE START
at the very start of quickcommands.menu you will see this:
Change the name between the quotes ( " " ) to the name of your new menu, but make sure that it doesnt exist already, in this tutorial the menu will be called "tutorial_example_menu"
so we change to
EDITING THE TITLE
Now we can start editing the file. The quickcommands.menu file is not that big and there is not that much stuff in it.
First off we want to search for: "//Title" because everything above it won't be changed. (the stuff above it is the layout) If you did it right you will find this:
As you see its quite self explaining but if you don't get it here's an explanation:
To change the title, All you do is change the text so right now its a localized string "@QUICKMESSAGE_QUICK_MESSAGE" because there is a @ symbol in front of it, you can change it to whatever you want. In this tutorial we will call it "This is the title" so all I do is change
to
EDITING THE OPTIONS
Changing the options is just as easy as the title, but it needs one extra thing. First off search for "@QUICKMESSAGE_1_FOLLOW_ME", You will find another "itemDef" function but its a little different:
Again change the text to whatever your first option is but, make sure it starts with:
So that it shows that pressing the 1 key will execute this function.
now change
[/code]execKey "1" { scriptMenuResponse "1"; close quickcommands; }[/code]
to
RESPONSE_NAME_HERE can be anything, but make sure that it doesn't exist already. Like for example this function will give me an L96A1 then I name it: "give_l96a1_mod" or something like that. Remember the name! Write it down somewhere or paste it in another text file because you will have to use the name again.
Also as you may have noticed, I changed to because this is the name of my menu.
For more options in your menu, just change the itemDef functions underneath the one we just did. The only difference between them is that the execKey "KEY" is changed so make sure you use the right prefix:
For option 1:
for option 2:
for option 3:
and so on
USING THE MENU TRU SCRIPTS
Now that we have created our menu, we will be able to use it in combination with .gsc scripts!
Make a new file in maps\mp\gametypes and call it whatever you want, mines will be called: mod_menu.gsc
open the file and copy & paste the following in there:
http://pastebin.com/sDuwdbTk
In that file you will see some things you have to change on init(), I hope you wrote down or remember the names you used for your options and menu name because you will need them now!
change SCRIPT NAME HERE to whatever you want, it doesn't matter really. and then change MOD MENU NAME HERE to the name you used in the menu file.
The menu can be opend with the following function
But skip this .. we'll use it later
Go to the onMenuResponse() function and after
you will put an if statement for each option you have in your menu.
so lets say my menu has 4 options and the response names I used were:
"give_l96a1_mod"
"say_stupid_stuff"
"say_stupid_stuff_2"
"suicide_now_mod"
then my onMenuResponse() function looks liek this in the end:
Now all we have to do is load this .gsc file so open _load.gsc and on the init() function there are a lot of threads, just add this to it:
and your responses will work!
You can open the menu with this:
as I told you above. Just open it whenever you want, for example onPlayerSpawned()
COMPILING IT
The .menu files need to be in a FastFile so we add the following line to our zone source
and your menu should be good to go!
credits:
iAegle, for making the tut and some research
Pozzuh, for learning me how to use .menu files and responses
Keep in mind that I assume that you know the basics of GSC modding.
SETUP
Make a new mod folder or use an existing one (Make a new one if you want to be sure) and create a new folder in the modroot called "ui_mp" then in the ui_mp folder you make another folder called "scriptmenus".
Then we want the layout of the menu, open your black ops folder and go to
Black Ops > Raw > ui_mp > scriptmenus > And open quickcommands.menu with notepad. Now go to: file > save as > save it in the scriptmenus folder you made and call it: mod_menu.
THE START
at the very start of quickcommands.menu you will see this:
Code:
menuDef
{
name "quickcommands"
fullscreen 0
rect 0 0 640 480
focuscolor 1 1 1 1
disablecolor 0 0 0 0
style WINDOW_STYLE_EMPTY
Change the name between the quotes ( " " ) to the name of your new menu, but make sure that it doesnt exist already, in this tutorial the menu will be called "tutorial_example_menu"
so we change
Code:
name "quickcommands"
Code:
name "tutorial_example_menu"
EDITING THE TITLE
Now we can start editing the file. The quickcommands.menu file is not that big and there is not that much stuff in it.
First off we want to search for: "//Title" because everything above it won't be changed. (the stuff above it is the layout) If you did it right you will find this:
Code:
// TITLE
itemDef
{
name "title"
type ITEM_TYPE_TEXT
visible 1
rect 0 0 224 32
origin ORIGIN_QUICKMESSAGETAB
style WINDOW_STYLE_FILLED
forecolor 1 1 1 1
backcolor 0 0 0 0.7975
text "@QUICKMESSAGE_QUICK_MESSAGE"
textfont UI_FONT_NORMAL
textscale .24
textaligny 24
textalign ITEM_ALIGN_CENTER
decoration
}
As you see its quite self explaining but if you don't get it here's an explanation:
Quote:name The name of the "itemDef"
type The type of this part
visible Visible? 1 = Yes, 0 = No
rect The position of this part
origin The origin of this part
style .. No idea really
forecolor The forecolor of this part
backcolor I think this is the Shadow color
text The text, make sure its between quotes ( " " )
textfont The text font
textscale Text scale
textaligny Text Align Y
textalign Text Align X
decoration No idea ..
To change the title, All you do is change the text so right now its a localized string "@QUICKMESSAGE_QUICK_MESSAGE" because there is a @ symbol in front of it, you can change it to whatever you want. In this tutorial we will call it "This is the title" so all I do is change
Code:
text "@QUICKMESSAGE_QUICK_MESSAGE"
Code:
text "This is the title"
EDITING THE OPTIONS
Changing the options is just as easy as the title, but it needs one extra thing. First off search for "@QUICKMESSAGE_1_FOLLOW_ME", You will find another "itemDef" function but its a little different:
Code:
itemDef
{
name "window"
group ingamebox
type ITEM_TYPE_TEXT
visible 1
rect 16 20 0 0
origin ORIGIN_QUICKMESSAGEWINDOW
forecolor 1 1 1 1
textfont UI_FONT_NORMAL
textscale .24
textaligny 8
text "@QUICKMESSAGE_1_FOLLOW_ME"
decoration
}
execKey "1" { scriptMenuResponse "1"; close quickcommands; }
Again change the text to whatever your first option is but, make sure it starts with:
Code:
^31. ^7
now change
[/code]execKey "1" { scriptMenuResponse "1"; close quickcommands; }[/code]
to
Code:
execKey "1" { scriptMenuResponse "RESPONSE_NAME_HERE"; close tutorial_example_menu; }
Also as you may have noticed, I changed
Code:
close quickcommands;
Code:
close tutorial_example_menu;
For more options in your menu, just change the itemDef functions underneath the one we just did. The only difference between them is that the execKey "KEY" is changed so make sure you use the right prefix:
For option 1:
Code:
^31. ^7
Code:
^32. ^7
Code:
^33. ^7
USING THE MENU TRU SCRIPTS
Now that we have created our menu, we will be able to use it in combination with .gsc scripts!
Make a new file in maps\mp\gametypes and call it whatever you want, mines will be called: mod_menu.gsc
open the file and copy & paste the following in there:
http://pastebin.com/sDuwdbTk
In that file you will see some things you have to change on init(), I hope you wrote down or remember the names you used for your options and menu name because you will need them now!
Code:
game[ "SCRIPT NAME HERE" ] = "MOD MENU NAME HERE";
precacheMenu( game[ "SCRIPT NAME HERE" ] );
change SCRIPT NAME HERE to whatever you want, it doesn't matter really. and then change MOD MENU NAME HERE to the name you used in the menu file.
The menu can be opend with the following function
Code:
self openMenu( game["SCRIPT NAME HERE"] );
Go to the onMenuResponse() function and after
Code:
self waittill( "menuresponse", menu, response );
you will put an if statement for each option you have in your menu.
so lets say my menu has 4 options and the response names I used were:
"give_l96a1_mod"
"say_stupid_stuff"
"say_stupid_stuff_2"
"suicide_now_mod"
then my onMenuResponse() function looks liek this in the end:
Code:
onMenuResponse()
{
self endon( "death" );
self endon( "disconnect" );
while( true )
{
self waittill( "menuresponse", menu, response );
if( response == "give_l96a1_mod" )
{
self giveWeapon( "l96a1_mp" );
self switchToWeapon( "l96a1_mp" );
}
else if( response == "say_stupid_stuff" )
{
self sayAll( "Hi there bitches <3" );
}
else if( response == "say_stupid_stuff_2" )
{
self sayAll( "Love and peace my friends!" );
}
else if( response == "suicide_now_mod" )
{
self suicide();
}
}
}
Now all we have to do is load this .gsc file so open _load.gsc and on the init() function there are a lot of threads, just add this to it:
Code:
level thread maps\mp\gametypes\mod_menu::init();
You can open the menu with this:
Code:
self openMenu( game["SCRIPT NAME HERE"] );
COMPILING IT
The .menu files need to be in a FastFile so we add the following line to our zone source
Code:
menufile,ui_mp/scriptmenus/THE NAME YOU CHOOSE.menu
credits:
iAegle, for making the tut and some research
Pozzuh, for learning me how to use .menu files and responses
(08-10-2011, 12:58)Pozzuh Wrote:Se7en Wrote:Stealed, from cod4 mod ...look who's talking
[Release] Old School Mod v2.2
[Release] Scroll menu