HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Displaying a gui in one specific area? Character Creation  (Read 3150 times)

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile

Hi, Im working on character creation.  I've created a facegen gui that I would like to load only during this area where they create their character.

The only way I know to add guis is with the code below but that displays it all the time..
Code: [Select]
  // facegen
        facegen as NodeRef of Class TMP_Facegen = FindGUIControlByName(None, "TMP_Facegen ")
        if facegen!= None
          destroynode(facegen)
        .
        facegen = CreateNodeFromPrototype("TMP_Facegen ")
        facegen.build = true
        facegen.owner = 0

What is the proper code to restrict a gui to load in one specific area?

Thanks!
« Last Edit: Apr 21, 13, 07:31:38 PM by HE-Cooper »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Displaying a gui in one specific area? Character Creation
« Reply #1 on: Apr 16, 13, 12:40:05 AM »

To get a GUI in a specific area, it needs to be called from the location that sets up that area. In the HaV_CharacterCreationWindow, I call functions that are needed in that area. HaV_CharacterCreationWindow contains HaV_MenuSystem GUIs inside it, that get called and display other GUIs depending on which button is chosen.


  ccs as NodeRef of Class GUIPanel = CreateNodeFromPrototype("HaV_CharacterCreationWindow")
  ccs.build = true



While getting GUIs to show up in game, I call them in E_playerAccountClassMethods

        button as NodeRef of Class HaV_ButtonPanel = FindGUIControlByName(None, "HaV_ButtonPanel")
        if button != None
          destroynode(button)
        .
        button = CreateNodeFromPrototype("HaV_ButtonPanel")
        button.build = true
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #2 on: Apr 18, 13, 05:12:05 PM »

The GUI shows up correctly once the character creation screen is loaded but when they click finish it carries over into the game world.

If I shut down the client and re log in, it doesn't show anymore.

How do I make it so the facegen GUI gets destroyed before they enter the game world?

Thanks.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Displaying a gui in one specific area? Character Creation
« Reply #3 on: Apr 18, 13, 05:25:48 PM »

In the characterCreation area, I connected everything to the main GUI. They are created with the main, and are shown when the user clicks a button to enter that section. When the user moves to a differnt area by clicking Play, the main GUI and all others are destroyed. Search for the word "finish". This is the name of the Play button, where the player enters the game area. Follow it along until you see where the function calls destroy(me). That is the main GUI beinig destroyed, before moving to new area.
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #4 on: Apr 18, 13, 08:32:06 PM »

Ohhh, now i understand what you were saying. 

Thanks!
« Last Edit: Apr 18, 13, 10:32:52 PM by Viper155 »
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #5 on: Apr 19, 13, 12:50:01 AM »

Can't you just surround it with an if?

       if $BASECLIENT._AreaID == <your area id>

       invoke facegen

       .
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #6 on: Apr 20, 13, 07:14:23 PM »

Boss,
 how would I use the code you posted above to remove the gui and not carry over into the game world?

I Still can't figure out how to add a gui code into the E_charactercreationwindow script and remove it once they leave that area.

Thanks..

Thazager,
Adding the facegen gui into the charactercreationwindow gui worked great but that same strategy wont work for your "clothes changer and color" tutorial.

Thanks guys!
« Last Edit: Apr 20, 13, 07:25:29 PM by Viper155 »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Displaying a gui in one specific area? Character Creation
« Reply #7 on: Apr 20, 13, 07:42:10 PM »

We have it done that way. Though I did not use the tutorials for adding them in.

Basic concept: characterCreation gui contains buttons, the class method scripts interpret those buttons.
Each idea is used in character creation and has a base window. The windows are win.visible = false. The main buttons in CC are used to make the panel visible, and make sure the rest are turned off.

When that facegen panel shows it calls its class methods script to interpret what the user in doing. When the main buttons turn to the next area, it turns off the window (win.visible = false) and turns on the next window (win.visible = true).

The window that is visible is acknowledging the mouse and key inputs from the user, while those that are not visible are not checked. The user stays in the CC area until they type in a name, and then click Play to jump to the play area.

characterCreation
  . facegen (panel)
  . cloths (panel)
  . colors (panel)
  . getName (panel)

each panel has the character creation as a parent. On the main panel the logic is set up so that the windows are checked to make sure the player has done the required features in order to play the game. Such panels can also have race , class, age, profession, specials. Anything you want to add to the character you are making.
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #8 on: Apr 21, 13, 09:57:04 AM »

Quote
Boss,
 how would I use the code you posted above to remove the gui and not carry over into the game world?

I Still can't figure out how to add a gui code into the E_charactercreationwindow script and remove it once they leave that area.

Thanks..

Try this:


Code: [Select]
 

// facegen

if $BASECLIENT._AreaID == <your ccs area id>

        facegen as NodeRef of Class TMP_Facegen = FindGUIControlByName(None, "TMP_Facegen ")
        if facegen!= None
          destroynode(facegen)
        .
        facegen = CreateNodeFromPrototype("TMP_Facegen ")
        facegen.build = true
        facegen.owner = 0

else

        facegen as NodeRef of Class TMP_Facegen = FindGUIControlByName(None, "TMP_Facegen ")
        if facegen!= None
          destroynode(facegen)
        .

.
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #9 on: Apr 21, 13, 01:11:44 PM »

Still not working.  I tried putting it in many different places and scripts.

Maybe i'm not putting it in the right script?

I think charactercreationwindow gets called once to build the guis but it doesn't get checked again once the game play world is loaded.


I tried:

Code: [Select]
     if $BASECLIENT._AreaID == 93383990054

        clothes as NodeRef of Class TMP_Clothes = FindGUIControlByName(None, "TMP_Clothes")
        if clothes!= None
          destroynode(clothes)
        .
        clothes = CreateNodeFromPrototype("TMP_Clothes")
        clothes.build = true
        clothes.owner = 0

else

        clothes as NodeRef of Class TMP_Clothes = FindGUIControlByName(None, "TMP_Clothes")
        if clothes!= None
          destroynode(clothes)
        .

.
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #10 on: Apr 21, 13, 02:16:11 PM »

replace this part in E_playerAccountClassMethods with your code:

       if $BASECLIENT._AreaID = 93383990054
          return false
       .
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #11 on: Apr 21, 13, 02:20:34 PM »

And you might want to modify your code a bit and add "return false", i think it should work:



     if $BASECLIENT._AreaID == 93383990054

        clothes as NodeRef of Class TMP_Clothes = FindGUIControlByName(None, "TMP_Clothes")
        if clothes!= None
          destroynode(clothes)
        .
        clothes = CreateNodeFromPrototype("TMP_Clothes")
        clothes.build = true
        clothes.owner = 0

          return false

else

        clothes as NodeRef of Class TMP_Clothes = FindGUIControlByName(None, "TMP_Clothes")
        if clothes!= None
          destroynode(clothes)
        .

.
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Displaying a gui in one specific area? Character Creation
« Reply #12 on: Apr 21, 13, 02:37:32 PM »

That works!

I was actually messing around in E_playeraccount earlier like you just suggested. 

I initially thought it wasn't working but then I realized that the GUI was hiding behind my other GUIs.

I wonder if I had it working for a while and just couldn't see it!

Thank you very much, I can move on now!
« Last Edit: Apr 21, 13, 03:37:51 PM by Viper155 »
Logged