Pop up classmenu after team choose

Pop up classmenu after team choose

Postby baseballfreek144 » Thu Sep 13, 2007 6:33 pm

I read this topic on getting classmenu to pop up after team choose.

The only difference is I have two different classmenus, and chooseclass checks team and pops up the correct one depending on what team you are on.

In the code OnTeamButton is commented out and when I uncomment it (and MakeTeamButtons) and uncomment declarations in the header file, it won't compile because of a missing array. (m_pTeamButtons) I searched the entire project for "m_pTeamButtons" but the only thing it found was where it is being used, in MakeTeamButtons. (It was never defined)

So I am using CTeamMenu::OnCommand, the only problem is it seems to be called before their team is switched, so it is popping up the classmenu for the team they are switching from Is there any way to get around this?

Thanks
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm

Re: Pop up classmenu after team choose

Postby Bob » Thu Sep 13, 2007 9:23 pm

=)

This is going to sound a bit smart assed, but yes. Move your call around. The OnCommand function executes some code, thats how the teams are swapped, and then you would call your function to load your class menu.
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: Pop up classmenu after team choose

Postby baseballfreek144 » Fri Sep 14, 2007 4:00 pm

I can see that the OnCommand function forces the client to execute "vguicancel" to close the menu. Then ShowBackGround is called to make the background disappear, then I see

Code: Select all
BaseClass::OnCommand(command);


I am somewhat of a C++ noob, but I have been reading a lot of tuts on classes and such. But I have never seen 'BaseClass'. Where is the function that is being called in the line above?

I might be missing the point, but the way I interpret your suggestion is to find what code OnCommand is executing then put my call after their team is swapped.
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm

Re: Pop up classmenu after team choose

Postby Bob » Fri Sep 14, 2007 4:04 pm

put your code immediately after that. BaseClass is a construct that is used to call the parent of this class. So all oncommand functions are executed.
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: Pop up classmenu after team choose

Postby baseballfreek144 » Fri Sep 14, 2007 4:10 pm

Thanks for the quick response 8)

I already do have my call after this though :shock:

Code: Select all
void CTeamMenu::OnCommand( const char *command )
{
   if ( Q_stricmp( command, "vguicancel" ) )
   {
      engine->ClientCmd( const_cast<char *>( command ) );
   }

   Close();
   gViewPortInterface->ShowBackGround( false );
   BaseClass::OnCommand(command);

   engine->ClientCmd( "chooseclass" ); // pop classmenu up after selecting team
}
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm

Re: Pop up classmenu after team choose

Postby Bob » Fri Sep 14, 2007 4:12 pm

than you are kosher?
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: Pop up classmenu after team choose

Postby baseballfreek144 » Fri Sep 14, 2007 4:15 pm

:?:
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm

Re: Pop up classmenu after team choose

Postby Bob » Fri Sep 14, 2007 4:20 pm

=\ i really dont know what to say. If you arent getting this working i would highly suggest getting your feet wet on another part of your game.
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: Pop up classmenu after team choose

Postby baseballfreek144 » Fri Sep 14, 2007 4:30 pm

Good idea, I'll come back to this later,hopefully I'll learn something to help this problem by then
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm

Re: Pop up classmenu after team choose

Postby Bob » Fri Sep 14, 2007 9:42 pm

If you havent already started on them, i have always suggested that everyone start off modding hl2 with a focus on the weapons. It is a quick way to get into the nitty gritty without having to bother with some of the more entangled portions of it. I would offer more help but as i've posted before i am moving away from hl2 at a staggering pace, and hope never to return to it.

My first Ogre tutorial should be out in a couple days!
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: Pop up classmenu after team choose

Postby baseballfreek144 » Sat Sep 15, 2007 1:51 pm

Yeah, we have already added 3-4 weapons to the game, and removed some, and still plan on doing more adjustments with those.

Oh, that's a shame, I am just gettin into HL2 programming (if you don't count EventScripts/SourceMod)

What is Ogre?
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm

Re: Pop up classmenu after team choose

Postby baseballfreek144 » Sat Sep 15, 2007 6:35 pm

I found a solution to my original problem :-P


Code: Select all
void CTeamMenu::OnCommand( const char *command )
{
   if ( Q_stricmp( command, "vguicancel" ) )
   {
      engine->ClientCmd( const_cast<char *>( command ) );
   }

   Close();
   gViewPortInterface->ShowBackGround( false );
   BaseClass::OnCommand(command);

   // popup classmenu when joining a team
   if ( strcmp( command, "jointeam 2" ) == 0 )
   {
      engine->ClientCmd( "showpanel v_class" );
   }
   else if ( strcmp( command, "jointeam 3" ) == 0 )
   {
      engine->ClientCmd( "showpanel h_class" );
   }
}
baseballfreek144
New Blood
 
Posts: 7
Joined: Wed Sep 12, 2007 4:28 pm


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron