Moh Menu

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Moh Menu

Post by Ophisâ„¢ »

I'm thinking about editing the moh menu... only i can't work out which files do what. I've found all the images needed so techniqly i could just re texture but i want the buttons moved and to change their size too.

I've looked into the Modern Warefare files and tried to see how you guys did it but with no joy.... anyone fancy giving me a quick run down on which file does what and how its done?

EDIT: i've just found this while looking for something else
/forum/viewtopic.php?t=7229&highlight=random+pick

I'm going to have a bash at it. While i do so, how do i go about scripting a thread that will randomly select the players skin from a selection of my choosing. (in this case im using a few custom ones).

EDIT2: that link was sort of ok, but it only talks about in game menu like select weapon.. i wanted the actually main menu.
Image[ Formerly Known As Snakeâ„¢ ]
c_los
Private
Posts: 7
Joined: Tue Jul 03, 2007 7:53 pm

Post by c_los »

well, i dont now much about the ui files, but for the random selection of a player skin you just have to generate a random number and make a case for each model you need-

Code: Select all

level waittill spawn
thread pick_model
...

pick_model:
local.model_choices = ## // however many models choices you have
local.rand_model = randomint(local.model_choices - 1)
for(local.i=0; local.i < $player.size; local.i++)
{
  if(player[local.i].dmteam == allies)
  {
    switch(local.rand_model)
    {
      case 0:
        $player[local.i].model = "models/player/alliedmodelname1.tik"
        break
      case 1:
        $player[local.i].model = "models/player/alliedmodelname2.tik"
        break
      case n:
...
    }
  }'
  if(player[local.i].dmteam == axis)
  {
    switch(local.rand_model)
    {
    ...
}
end
[/code]
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I would help you but its not clear what you want to do . Give an example of what you where thinking of doing . The player selects his model on the multiplayeroptions menu in multiplayeroptions.urc

Code: Select all

resource
Button
{
name "Axis Player Model"
rect 360 56 192 24
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.75 0.75 0.75 0.00
borderstyle "NONE"
shader "menu_button_trans"
hovershader "menu_button_glow"
clicksound "sound/menu/scroll.wav"
stuffcommand "playermodel 1"
//shader "textures/mohmenu/quit"
//hovershader "textures/mohmenu/quit_h"
font facfont-20
//textalign right

}
that is card coded and will go though each model one at a time although you can probably stuffcommands into the player console .

Code: Select all

resource
Button
{
name "Default"
rect 536 448 96 24
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "NONE"
shader "textures/mohmenu/apply"
hovershader "textures/mohmenu/apply_h"
clicksound "sound/menu/apply.wav"
stuffcommand "ui_applyplayermodel;ui_checkrestart;Popmenu 0"
}

ui_applyplayermodel is a hard coded ui script so no help there

Code: Select all

resource
Label
{
title "modelentry"
name "Default"
rect 64 88 240 32
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "NONE"
linkcvar "ui_dm_playermodel"
font facfont-20
textalign xcenter

}
if you type cvarlist into the console you would get this

Code: Select all

 U  A   dm_playermodel "american_army"
still no help :) point being it won't help you , you would be better off using a scirpt . Now if you are thinking of something else like adding some kind of a custom button linked to a cvar that can be done . Cvars can be used to hide menu items as well or offer choises . I made a menu editor that will come out with the TA mod that is close to being finished that will help but who knows Airbourne is out soon too so ppl maybe playing that instead if it is any good .

Image
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

Theres a bit of help above, thank you.. but basicly..

I wanted a custom moh main menu screen (like the one in modern warefare total conversion mod). So i wanted to know if anyone new the basics of which ui file control which button on the main menu etc etc.

The second bit about the randomness was asking how to start a thread that randomly selects a skin for the player and spawns them in it. At the moment ive got all the axis to force spawn in one skin and all the allies to force spawn in the other.

ALSO... i can't seem to get "local.player weaponcommand dual notdroppable" to work. Is it for Single Player only?

(p.s. whats that program your using there to edit menus?!?!)
Image[ Formerly Known As Snakeâ„¢ ]
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Hard to answer you , main.urc is the menu you see when you start mohaa the controls menu lets you make settings . Each item on the menu can be one of several types

Label
Button
CheckBox
Field
Slider
List
ListBox
PulldownMenuContainer
FakkBindList
LANGameClass
FakkLoadGameClass

Things like labels can be made into spinners like the stop watch

Code: Select all

resource
Label
{
name "stopwatchhand"
//rect 18 42 92 64 // this makes it match the compass base
//rect 18 32 92 64 // this makes it match the compass top
//rect 15.5 14 100 100 // this makes it match the compass top
rect 0 0 128 128
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.00 0.00 0.00 0.00
borderstyle "NONE"
linkcvar "ui_stopwatch"
statbar spinner 0 60000
statbar_endangles 0 360
statbar_shader textures/hud/stopwatchhand
}
So the question is do you want to mod a cetain menu and how do you want to mod it . Do you want to add a button for example and what is it you are trying to end up with . You are just being too vauge for anyone to help you . Maybe look at the stock menus or a menu that you know does someting and maybe we can explain how that something is done .
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

ohhhhhhhkey dokey.. The above was a lil help yes.


The Main Mohaa Menu, when you first start up the game, is what i want to edit. I want to re texture it and move the buttons around too (like where back to game/quit/multi player/single player/options appear) and all their sizes. The best complete moh main menu screen i have seen is on the MW mod.

My trouble with the above is that i'm not completely sure which file does what and i figured after i find that file (i'm guessing now its the one you mentioned above) I'm going to have to learn the coords of the screen for placing my buttons. These are the bits i don't really understand much about.
Image[ Formerly Known As Snakeâ„¢ ]
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well it not that bad the main.urc uses virtualres 1 so it is a virtual 640x481 in size . Yes I said 481 I noticed that in mohaa the coords are 0 to 480 and I guess the width is too 0 to 640 . If you have ever done any thing with huddraw then it is the same as that . rect x,y,width,height .

Code: Select all

resource
Button
{
name "options"
rect 0 172 128 128
fgcolor 1.00 1.00 1.00 1.00
bgcolor 1.00 1.00 1.00 0.00
borderstyle "NONE"
shader "menu_button_trans"
hovershader "textures/mohmenu/options_h"
clicksound "sound/menu/apply.wav"
stuffcommand "pushmenu options_main"
hovercommand "set ui_signshader options_sign"

}
That is the button that takes you to the options menu .

shader "menu_button_trans"

That shader is actually invisible they use it alot for buttons like over the medals or saved game areas . Pretty easy to figure out really you have a hover shader and hover command . The button is invisible because of the shader untill you hover over it then it chages to a different shader in this case "textures/mohmenu/options_h" and back to "menu_button_trans" when you are no longer hovering over it . For the hover command it sets a cvar to the name of a shader when you hover over it "ui_signshader" is set to "options_sign" and resets the cvar when you stop hovering over it . The cvar is linked to a label with linkcvartoshader and that is what it does , what ever shader the cvar is set to that is what shader is seen on the label .

Code: Select all

resource
Label
{
name "sign"
rect 48 36 172 56
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "RAISED"
linkcvar "ui_signshader"
linkcvartoshader

}
The label is linked to a cvar with linkcvar if the cvar was some text then that text would show on the label but with linkcvartoshader it is linked to a shader too so the text is the name of a shader and it shows the shader instead of text , change the value of the cvar you change the shader seen on the label . The stuffcommand is what happens when you click the button "pushmenu options_main" and it will open up the options menu . I guess you can figure out what clicksound does :) So these two things work together hover over the options area and the main sign changes to say options and the area over options changes shader . As you may have guessed most of the main menu works this way . There is one other thing the map list .

Code: Select all

resource
Button
{
name "bigmap"
rect 436 156 24 48
fgcolor 1.00 1.00 1.00 1.00
bgcolor 1.00 1.00 1.00 0.00
borderstyle "NONE"
shader "menu_button_trans"
hovershader "maplist_h"
clicksound "sound/menu/apply.wav"
stuffcommand "maplist"
hovercommand "set ui_signshader maplist_sign"
enabledcvar "developer"

}
It has another option "enabledcvar" the cvar "developer" has to be enabled ( 1 ) for the maplist button to work
Last edited by bdbodger on Sat Jul 07, 2007 9:41 am, edited 1 time in total.
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

Great Stuff!

I was slighty getting the hang of it and this as pushed me over the edge and i fully understand how it works now. It's a touch like how i make flash websites with the buttons and the scripting etc etc... only slightly but its not hard to understand once put in the above context.. within seconds ive made a great menu for my 28 Frags Later mod. Hope you check it out when i'm done, i'll leave credit.

And before people think it, this wont die, for the shear fact its nearly complete. So even if i stop working on it, i'll release it as it stands.
Image[ Formerly Known As Snakeâ„¢ ]
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Ah the fog has lifted :) I knew once you had this basic understanding of how it worked that you would be able to create a new menu . I look forward to your mod .
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

game

Post by tltrude »

Not everyone likes it when you change the look of their game.
Tom Trude,

Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Re: game

Post by Ophisâ„¢ »

tltrude wrote:Not everyone likes it when you change the look of their game.
Then they wont bother to download a mini conversion mod then will they? lol.
Image[ Formerly Known As Snakeâ„¢ ]
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

You can always devide your mod into more than one pk3 with the main menu modding separate and a disclaimer in your mod saying if you don't want the new menu then don't use my user_newmenus.pk3
Image
Ophisâ„¢
Colonel
Posts: 461
Joined: Sun Mar 12, 2006 2:30 pm
Location: England, Manchester
Contact:

Post by Ophisâ„¢ »

Already have got the mod split for development purposes, "scripts", "sound" and "Textures" pk3's so its easyer to send the most updated files between the ones working on the mod. However as much its a good idea to have a separate file for the textures, its already a server sided game type so if they don't like the textures they can join with default Mohaa running. I had my first Beta testing with 20 players last night and i feel the menu is apart of the suspense build up to the game type.
Image[ Formerly Known As Snakeâ„¢ ]
Post Reply