Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

How to obtain this type of menu

Hi everyone,
AC 1.69.0 + Unity 2018.4.8f1.

I'm adjusting the menus, so I made them simply in Unity UI and then linked to AC menus.
Actually I have this menu: https://drive.google.com/open?id=1jk9-lUZZnsynk35P1WUOT-DS21_R6PUM where, to change language, it's necessary to click on the name of the language (text "Language" + cycle "Language").

I'd like to change the menu as this one: https://drive.google.com/open?id=1AVy93yEyZYohbrgR_dTYpiMCH9gYDFsl where I have 2 shift buttons (right and left). Teorically I have to put a text ("Language:") + a button (Right shift) + "something" (cycle language) + a button (Left shift).
How can I make it? My problem is what have I to put on "something" and how can I link to the right and left shift buttons (so clicking I can go back and forth between languages). On the inventory tutorial it uses the slots, but, in this case where I have pratically a single slot that has to change?

Thank you very much.

Comments

  • The "shift" Buttons in e.g. the Inventory menu allow you to scroll through elements that have multiple slots. This isn't the case for Buttons and Labels, which are single-slot elements.

    What you could do, though, is map your game's active language to a Global PopUp variable, and use Button elements to change that variable's value, and then the language.

    Create a new Global PopUp variable, name it "Language", and give it the same values as your defined languages (including the game's original language). So that it's value is independent of save game files, set it's Link to field to Options Data.

    You'll then need to use an ActionList to map this to the actual language used by your game. The Save: Set option Action can be used to change language, but only by either entering it in directly, or via an Integer parameter. We can, however, convert the PopUp variable into a parameter first.

    Create a new ActionList asset and define an Integer parameter (again, name it "Language"). Set the first Action to ActionList: Set parameter. Check Change own?, set New value is to Global Variable, and select the Lanauge PopUp.

    Next create a Save: Set option Action, and use this parameter to set the game's current language.

    Set this ActionList's When running field to Run In Background, and assign it as your game's ActionList on start game in the Settings Manager - this will make sure the language is correctly set each time the game begins.

    Back to the Menu, create a new Label element to display the current language. Set it's Label type to Global Variable and select the Language variable.

    Then create your Buttons, and have them run ActionLists when clicked. Have these change the value of your PopUp variable (increase / decrease the value by 1 using Variable: Set), and then have them each run the first ActionList you made to re-link the game's active language to match the Variable's value.

  • Thank you very much. I'll try.

  • Hello Chris and sorry for the delay.
    I tried and I almost succeeded: almost because I have two little issues.

    1. (Probably it's a noob question): on the right and left shift buttons I create the ActionLists but on the right shift button it works (I have set Variable:Set and increase by 1), but on left shift button it doesn't work. I link another action list where I put Variable:Set increase by Value -1, but it seems that "-1" doesn't work (with the right button I can change the language but with left button it can't go back). Is it correct to put Increase By Value -1 or is there some other trick?
    2. Now, on my label I can see also Original as language, but I don't want it can be visible and selectable. In the options I checked "Don't use at runtime" but it is always visible.

    Thank you very much.

    1. In what way does it not work? What value does your Variable become upon clicking the left shift button? What if you instead run its ActionList manually by clicking "Run now" in its Inspector at runtime?
    2. This method will override the "Don't use at runtime" option, but the original language is mapped to the language index "0". Make sure the variable's default value is set to the language index you want to be the new default (presumably "1"), and then make sure that it's never set to 0 when using the Variable: Set Action.
    1. These are the settings of the shift buttons (right and left): https://drive.google.com/open?id=1giqo0trSwBnt1eLFNAExCNin7GN6o4I5. The right one works well and the languages run correctly. But with the left one nothing happens, as it can't come back and the language remain the same, also in runtime eith the options Run Now. I tried to set Formula -1 and, in this case, it return to the original (variable index 0).

    2. Ok for the default language to 1 but how can I do to make sure it's never set to 0? I have to check (Variable check) if the condition it's equal to 0 and so change the value to 1?

    1. Increasing the variable's value by a negative value (as you've done) should reduce it. What happens if you disconnect it from the ActionList: Run Action that is called after? If it then works, it'll be down to the logic within your "LanguageTitile" ActionList instead.
    2. Yes, you'd use Variable: Check Actions to determine what value it is and amend accordingly.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!