Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial Making a basic Quickmessage-like Menu.
#1
Rainbow 
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_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"
to
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 Tongue
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 .. Big Grin

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"
to
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
So that it shows that pressing the 1 key will execute this function.

now change
[/code]execKey "1" { scriptMenuResponse "1"; close quickcommands; }[/code]
to
Code:
execKey "1" { scriptMenuResponse "RESPONSE_NAME_HERE"; close tutorial_example_menu; }
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
Code:
close quickcommands;
to
Code:
close tutorial_example_menu;
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:
Code:
^31. ^7
for option 2:
Code:
^32. ^7
for option 3:
Code:
^33. ^7
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!

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"] );
But skip this .. we'll use it later

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();
and your responses will work!

You can open the menu with this:
Code:
self openMenu( game["SCRIPT NAME HERE"] );
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
Code:
menufile,ui_mp/scriptmenus/THE NAME YOU CHOOSE.menu
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
(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

Reply

#2
TOP! +rep
Reply

#3
Nice one =)
--
Reply

#4
Nice tutorial, good job!
Reply

#5
Thanks, nice find! Maybe some screens Tongue?
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#6
This is what the default quickmessage menu looks like

Yours will be the same with other text

[Image: Modmenu_2.jpg]
(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

Reply

#7
Pure win thread. Great job.
Reply

#8
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
Reply

#9
Any chance you could upload a simple version of this as a mod?


<3
Reply

#10
(07-03-2011, 03:04)koil Wrote: Any chance you could upload a simple version of this as a mod?


<3

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
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Basic Mod CheeseToast 10 7,292 11-02-2013, 18:02
Last Post: Yamato
Question Help Admin menu koren30 4 5,143 10-07-2013, 20:17
Last Post: Yamato
  [Tutorial] How-To, Mod menu picture-REVISED/no iwifix needed rotceh_dnih 52 32,539 09-28-2013, 02:08
Last Post: Monkey Arms
  Making an apocalyptic themed Minecraft map AZUMIKKEL 54 29,330 08-31-2013, 02:54
Last Post: AZUMIKKEL
  Help How do I open the admin menu for GeKKos QS Mod? conorr 1 3,098 08-15-2013, 13:52
Last Post: Yamato
  Trying to compile a modified menu DidUknowiPwn 7 5,742 07-05-2013, 21:55
Last Post: DidUknowiPwn
  Making a Heli's angles match my angles? akillj 1 2,739 06-16-2013, 15:01
Last Post: Yamato
  Making a harrier crash into the map? akillj 6 4,983 06-09-2013, 05:57
Last Post: akillj
Brick Lesson 3: Making game in C++ Nekochan 2 3,586 06-03-2013, 15:25
Last Post: Nekochan
  Preview Admin / Mod Menu Hologramm 5 7,024 05-29-2013, 00:35
Last Post: sleepunknot

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.