Game Development Community

multiple playgui

by Donald Teal · in Torque 3D Professional · 07/14/2010 (1:17 am) · 6 replies

ok this should be simple and easy to do but I am just not able to think of how to do this.

in T3D1.0.1 with UAiSK1.4 w/teams implemented I am trying to have a different playGui for each team.
each team is a different race and would like the in game Gui to reflect that.
when the mission loads there is a team select menu that come up and the player must select a team before
continuing into the game. when team is selected it find the team spawn point and spawns the player accordingly.

So I am asking is how can I tag each team with its own playGui?

Maybe I am just not understanding how the playGui works so any information to nudge me in the correct direction would be appreciated also.

#1
07/14/2010 (2:00 am)
Only just started delving around in gui's myself ... so off the top of my head ...

How about checking the player-team-datablock once the team has been selected and then setting the gui? Have 4 subsections on the Playgui which are containers for the 4 team gui's, and select the appropriate one to show on the client?

//pseudo-kinda code
if(%client.getDataBlock().getName() $="team1data")
   team1gui.visible =1;

if(%client.getDataBlock().getName() $="team2data")
   team2gui.visible =1;
#2
07/14/2010 (5:06 am)
What Steve suggests would be great for changing sections of the playGui. You can also do something sort of like the following if you want to enable totally different playGuis:
// team is selected, find out team name and display appropriate playGui
if(%client.getTeamName() $= "TeamX") // getTeamName() = your function to find out team name
    canvas.setContent(TeamXPlayGui);
TeamXPlayGui would be a duplicate playGui with variations. Either way would work, implementation depends on how different you intend your GUIs to be.
#3
07/14/2010 (5:08 am)
here is what we ended up doing for now

in default.bind.cs

function jointeam(%team)
{
    //Send a command to the server to join a new team
    commandtoserver('JoinTeam', %team);
    //Close the dialog once selection is made
     commandToServer('suicide');
   
    Canvas.popDialog(TeamSelectDlg);
    switch(%team)
     {
        case 1:
          TeamIconHud.setBitmap("art/gui/Hud_Bastlur_Main.png");
        case 2:
          TeamIconHud.setBitmap("art/gui/Hud_Nilbog_Main.png");
     }
    
}

and in playgui.gui

new GuiBitmapCtrl(TeamIconHud) {  // <------set to TeamIconHud
      bitmap = "art/gui/Hud_Bastlur_Main.png";
      wrap = "0";
      isContainer = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "relative";
      VertSizing = "relative";
      position = "2 639";
      Extent = "282 129";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      tooltipprofile = "GuiToolTipProfile";
      hovertime = "1000";
      canSaveDynamicFields = "0";
   };


EDIT: @ M. Hall: will look more into that once we get the full PlayGui mods finished. We will definitely need completely different gui's once the rest of our changes for each race/team are complete.

Thanks for all the help
#4
07/14/2010 (12:13 pm)
What I do is create a global variable for visibility for GUI objects in a PlayGui and then set those variables. So, if $teamOne is zero, none of those GUI objects are visible, but if $teamTwo is one, those objects are.
#5
07/14/2010 (9:46 pm)
@ Ted: thanks for that little bit of info. working on a trigger based team capture point system and that will allow me to have the tick timer progress bar only visible while within the trigger. Or at least that is what I am gonna try and do with it
#6
07/19/2010 (4:58 pm)
Globals are your friend ;) I use them a lot in my PlayGui (which is about 4500 lines of script just for the GUI, as well as about another 1500-2000 for the GUI functions backing it up). Everything from paths to visibility to commonly used profiles I make global, so that changes get done to one line, and it reduces the size of the functions that do things with visibility and such.

Hope that helps.