![]() |
|
[Tutorial] Making a basic Quickmessage-like Menu. - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: [Tutorial] Making a basic Quickmessage-like Menu. (/Thread-Tutorial-Making-a-basic-Quickmessage-like-Menu.html) |
Making a basic Quickmessage-like Menu. - iAegle - 07-02-2011 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: Code: menuDef
{
name "quickcommands"
fullscreen 0
rect 0 0 640 480
focuscolor 1 1 1 1
disablecolor 0 0 0 0
style WINDOW_STYLE_EMPTYChange 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" 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. ^7now 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. ^7Code: ^32. ^7Code: ^33. ^7USING 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.menucredits: iAegle, for making the tut and some research Pozzuh, for learning me how to use .menu files and responses RE: Making a basic QM Menu. - d0h! - 07-02-2011 TOP! +rep RE: Making a basic Quickmessage-like Menu. - Eekhoorn - 07-02-2011 Nice one =) RE: Making a basic Quickmessage-like Menu. - aosma8 - 07-02-2011 Nice tutorial, good job! RE: Making a basic Quickmessage-like Menu. - Nekochan - 07-02-2011 Thanks, nice find! Maybe some screens ?
RE: Making a basic Quickmessage-like Menu. - iAegle - 07-02-2011 This is what the default quickmessage menu looks like Yours will be the same with other text
RE: Making a basic Quickmessage-like Menu. - Madnesslink5 - 07-02-2011 Pure win thread. Great job. RE: Making a basic Quickmessage-like Menu. - clxyeah - 07-03-2011 You know how you did execKey 1, do we need to put that in our mod_menu and is "1" the key that is used to do the function that bit there I'm stuck on RE: Making a basic Quickmessage-like Menu. - koil - 07-03-2011 Any chance you could upload a simple version of this as a mod? <3 RE: Making a basic Quickmessage-like Menu. - d0h! - 07-03-2011 (07-03-2011, 03:04)koil Wrote: Any chance you could upload a simple version of this as a mod? this can be easily added (thx to this great tut) to your mod. just take your time and you will manage it. it also improves your modding level if you try to add it by yourself cause you learn to understand how it works |