You are viewing our Forum Archives. To view or take place in current topics click here.
{Release}My Menu [GSC]
Posted:
{Release}My Menu [GSC]Posted:
Status: Offline
Joined: Sep 06, 201014Year Member
Posts: 1,069
Reputation Power: 47
Status: Offline
Joined: Sep 06, 201014Year Member
Posts: 1,069
Reputation Power: 47
Well, this is sort of my rendition of SPEED's menu. His preview has been out there for long enough. The picture is from mw2 as I test on alter iw since its faster and simpler. This is clean, all you have to do is add all your menus and your good to go. The only thing you need to thread is tgl_menu() to onPlayerSpawned() You will also need button handling which I didn't include as most people already have it in their patch. If you don't I will include it below.
Pic:
Adding Menus:
To add a menu simply locate the "menus()". Adding a menu takes 7 lines of code. You dont have to declare each function if you don't want to. You just have to declare it as an array.
Line 1: Declare some random variable as spawnStruct.
Line 2: Name the menu.
Line 3: Declare the parent menu. (the menu that opens when you press b) If you want it to exit upon B then set the parent to "none".
Line 4: Add your items in an strTok. Pretty self explanatory.
Line 5: Add your menu arguments, the first argument is for the first option etc...You dont have to declare these either if you don't want to.
Line 6: Declare your func array, and add functions the same way you do in dconors menu.
Line 7: Add the menu to the list of menus.
Code:
Button Handling
Credits
-M0D1F13D
Pic:
Adding Menus:
To add a menu simply locate the "menus()". Adding a menu takes 7 lines of code. You dont have to declare each function if you don't want to. You just have to declare it as an array.
Line 1: Declare some random variable as spawnStruct.
<variable> = spawnStruct();
Line 2: Name the menu.
<variable>.name = "name";
Line 3: Declare the parent menu. (the menu that opens when you press b) If you want it to exit upon B then set the parent to "none".
<variable>.parent = "parent";
Line 4: Add your items in an strTok. Pretty self explanatory.
<variable>.items = strTok( "item;item;item", ";" );
Line 5: Add your menu arguments, the first argument is for the first option etc...You dont have to declare these either if you don't want to.
<variable>.args = strTok( "arg;arg;arg;", ";" );
Line 6: Declare your func array, and add functions the same way you do in dconors menu.
<variable>.funcs = [];
Line 7: Add the menu to the list of menus.
level.mlist[<variable>] = <variable>;
Code:
tgl_menu()
{
self endon( "death" );
for(;;)
{
if(self.inMenu==false)
{
self waittill( "Right" );
self thread disp_menu( "main" );
}
wait 0.3;
}
}
menus()
{
a = spawnStruct();
a.name = "main";
a.parent = "none";
a.items = strTok( "Sub Menu 1;Option;Option;Option;Option;Option;Option;Option", ";" );
a.args = strTok( "sub1", ";" );
a.funcs = [];
a.funcs[0] = ::open_sub;
level.mlist["main"] = a;
b = spawnStruct();
b.name = "sub1";
b.parent = "main";
b.items = strTok( "Option;Option;Option", ";" );
b.args = strTok( "", ";" );
b.funcs = [];
level.mlist["sub1"] = b;
}
open_menu()
{
self.oldWep = getCurrentWeapon();
self GiveWeapon("briefcase_bomb_mp");
self switchToWeapon("briefcase_bomb_mp");
wait 1.5;
self setClientUIVisibilityFlag("hud_visible", 0);
self freeze_player_controls( true );
self.menuBack = createRectangle("RIGHT","RIGHT",0,0,265,1000,(0,0,0),0.9);
self.mInstructBack = createRectangle("TOPRIGHT","TOPRIGHT",-265,-18,200,130,(0,0,0),0.9);
self thread disp_menu( "main" );
}
open_sub( name )
{
self notify( "exit_menu" );
self thread disp_menu( name );
}
disp_menu( name )
{
self endon( "death" );
self endon( "exit_menu" );
m = level.mlist[name];
self.inMenu = true;
max = m.items.size-1;
cursor = 0;
itemHud = [];
self.mInstruct = self createFontString( "default", 1.7 );
self.mInstruct setPoint( "CENTER", "TOP", -45, 24 );
self.mInstruct setText( "[{+actionslot 1}]/[{+actionslot 2}] - Scroll \n[{+gostand}] - Select \n[{+stance}] - Exit" );
self thread doa( self.mInstruct, "exit_menu" );
menuCreds = self createFontString( "default", 1.5 );
menuCreds setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", 0, 0 );
menuCreds setText( "By: M0D1F13D" );
self thread doa( menuCreds, "exit_menu" );
while(1)
{
for(i=0;i<m.items.size;i++)
{
itemHud[i] = self createFontString( "default", 1.7 );
itemHud[i] setPoint( "TOPRIGHT", "TOPRIGHT", -50, 38+(i*25) );
itemHud[i] setText( m.items[i] );
itemHud[i].color = (1,1,1);
self thread doa( itemHud[i], "Up", "Down", "A", "Right", "exit_menu" );
}
itemHud[cursor].color = ((2/255),(140/255),(156/255));
button = self waittill_any_return( "Up", "Down", "A", "Right", "B" );
switch(button)
{
case "Up":
if(cursor==0)cursor = max;
else if(cursor != 0) cursor--;
break;
case "Down":
if(cursor==max) cursor = 0;
else if(cursor!=max) cursor++;
break;
case "A":
self thread [[m.funcs[cursor]]]( cursor );
break;
case "Right":
self.inMenu = false;
self freeze_player_controls( false );
self switchToWeapon( self.oldWep );
self setClientUIVisibilityFlag("hud_visible", 1);
self notify( "exit_menu" );
break;
case "B":
if(m.parent=="none"){self notify( "exit_menu" );self freeze_player_controls( false );self.inMenu = false;self setClientUIVisibilityFlag("hud_visible", 1);}
else if(m.parent!="none") self thread open_sub( m.parent );
}
}
}
createRectangle(align,relative,x,y,width,height,color,alpha) {
barElemBG = newClientHudElem( self );
barElemBG.elemType = "bar";
if ( !level.splitScreen )
{
barElemBG.x = -2;
barElemBG.y = -2;
}
barElemBG.width = width;
barElemBG.height = height;
barElemBG.align = align;
barElemBG.relative = relative;
barElemBG.xOffset = 0;
barElemBG.yOffset = 0;
barElemBG.children = [];
barElemBG.sort = 3;
barElemBG.color = color;
barElemBG.alpha = alpha;
barElemBG setParent( level.uiParent );
barElemBG setShader( "progress_bar_bg", width , height );
barElemBG.hidden = false;
barElemBG setPoint(align,relative,x,y);
return barElemBG;
}
doa( elem, e1, e2, e3, e4, e5 )
{
self waittill_any( e1, e2, e3, e4, e5 );
elem destroy();
}
Button Handling
monitorButtons()
{
self endon("death");
self endon("disconnect");
for(;;)
{
if(self ActionSlotOneButtonPressed()) self notify("Up");
if(self ActionSlotTwoButtonPressed()) self notify("Down");
if(self ActionSlotThreeButtonPressed()) self notify ("Left");
if(self ActionSlotFourButtonPressed()) self notify ("Right");
if(self FragButtonPressed()) self notify("Rb");
if(self MeleeButtonPressed()) self notify("Rs");
if(self ADSButtonPressed()) self notify ("Lt");
if(self AttackButtonPressed()) self notify ("Rt");
if(self SecondaryOffHandButtonPressed()) self notify("Lb");
if(self JumpButtonPressed()) self notify("A");
if(self UseButtonPressed()) self notify ("X");
if(self ChangeSeatButtonPressed()) self notify ("Y");
if(self ThrowButtonPressed()) self notify ("B");
wait 0.05;
}
}
Credits
zy0n for the menu base.
thats it...
-M0D1F13D
Last edited by M0D1F13D ; edited 2 times in total
The following 1 user thanked M0D1F13D for this useful post:
cow (03-02-2011)
#2. Posted:
Status: Offline
Joined: Jul 21, 201014Year Member
Posts: 2,973
Reputation Power: 166
Status: Offline
Joined: Jul 21, 201014Year Member
Posts: 2,973
Reputation Power: 166
Only if this was actually yours i'd thank the topic.
- 0useful
- 6not useful
#3. Posted:
Status: Offline
Joined: Sep 06, 201014Year Member
Posts: 1,069
Reputation Power: 47
Status: Offline
Joined: Sep 06, 201014Year Member
Posts: 1,069
Reputation Power: 47
KooNModZ_TechSupport wrote Only if this was actually yours i'd thank the topic.
If your referring to the fact that the base is zy0ns, it is, i forgot to add credits, however I will.
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Apr 16, 200915Year Member
Posts: 1,631
Reputation Power: 144
Pfft...
You didn't even add in anything, its just the menu's coding..
Nice otherwises,
You didn't even add in anything, its just the menu's coding..
Nice otherwises,
- 0useful
- 0not useful
#5. Posted:
Status: Offline
Joined: Aug 07, 201014Year Member
Posts: 4,034
Reputation Power: 457
Status: Offline
Joined: Aug 07, 201014Year Member
Posts: 4,034
Reputation Power: 457
Nice menu Dalton keep it up bud
- 2useful
- 0not useful
#6. Posted:
Status: Offline
Joined: Jan 03, 201113Year Member
Posts: 230
Reputation Power: 6
Status: Offline
Joined: Jan 03, 201113Year Member
Posts: 230
Reputation Power: 6
Wheres unbound on your keyBoard when ever I do PC lobbies i can never exit!
- 0useful
- 0not useful
#7. Posted:
Status: Offline
Joined: Sep 06, 201014Year Member
Posts: 1,069
Reputation Power: 47
Status: Offline
Joined: Sep 06, 201014Year Member
Posts: 1,069
Reputation Power: 47
TTG_BDOG wrote Wheres unbound on your keyBoard when ever I do PC lobbies i can never exit!
Haha, it doesn't exist on your keyboard. You can change it and it will work , but since this is for Xbox I did'nt.
-M0D1F13D
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.