Forum rules - please read before posting.

Objectives: "Select After" option

Hi, I couldn't figure out what this option is for. I activated it but I haven't seen any difference.

Thanks!

«1

Comments

  • It causes an Objective to be considered "selected" when the user clicks it. The selected Objective is then automatically shown in Label elements set to display "Selected Objective", avoiding the need to manually extract this data via script.

  • Got it. Thanks!

  • edited August 28

    I want to add that in 1.81.4 I don't see the objective being automatically selected in my list, even with that opcion enabled. I have to manually go through the list of objectives and scroll to the bottom to find the latest objective updated.

  • I'm not clear on your meaning. The option doesn't control the order of Objectives in the list, but the display of the clicked Objective in other elements.

    Are you looking to re-order the listed Objectives?

  • Maybe I'm confusing in the way I understood it.

    I thought you meant that using the Select After option selects the objetive in the list, showing the player the description of the objective. But I think you are describing something else.

  • No, that's what I'm referring to. The description of the clicked Objective - as shown in a separate Label element.

  • edited August 30

    Ok, then in my current implementation is not working. Should I took into some specific settings?
    Also, for future updates, it would be really helpful to have an option to hide or remove specific objectives. My list is getting pretty cluttered at this point.

  • What is your current implementation, and in what way is it not working?

    If you can share screenshots of everything involved, along with details of what's going on vs what should be happening, I'll see if I can spot the issue.

  • This is debug implementation but it shows the issue.
    I declared two objectives. I toggle the "Select After" option in the "Test Objective 2" so the expected behaviour would be that the description is displayed once I open the objectives menu. But that doesn't happen. What is happening is just that both objectives are displayed as Started but the player has to manually click on one of them to open the description.

    https://imgur.com/a/G4XTlGj

  • Thanks for the details.

    Is the Menu open at the time these Actions are run?

  • No, it's close. This test in particular it's in a debug action that runs when the game starts. But the same behaviour applies to any other objective.

  • The default Objectives menu includes ActionLists named HideSelectedObjective (when turned on) and ShowSelectedObjective (when clicking the list) that affect the display of the selected Objective labels. You'll need to amend or remove these if you want these elements to be visible when the Menu is turned on.

  • Hey! Sorry for the late reply - been swamped with other stuff.

    So I tried what you suggested and swapped out "HideSelectedObjective" for "ShowSelectedObjective" in the "ActionList when turn on" field.
    It's working... sort of! I can see the description of the latest objective now, which is cool. But the title isn't actually selected, so I still have to hunt around and scroll down to find the new objective.

    Any idea how to get the "Select After" objective title to actually be selected/highlighted too? That would make this perfect.

    Thanks!

  • Are you using Unity UI for your Menu? It may be necessary to use a custom script to force its selection.

  • Yes, I'm using Unity UI. That's probably the issue.
    Any guidance of how I could do it?

    Thanks!

  • Firstly, you'll need to fix a minor issue within AC itself.

    Open up AC's MenuInventoryBox script and look for the following around line 676:

    if (uiSlots[i].uiButton && uiSlots[i].uiButton == gameObject)
    

    Replace with:

    if (uiSlots[i].uiButton && uiSlots[i].uiButton.gameObject == gameObject)
    

    Then, you should be able to use something like this, attached to each UI Button linked to your Objective slots:

    using UnityEngine;
    using AC;
    
    public class ForceSelectObjective : MonoBehaviour
    {
    
        void OnEnable()
        {
            if (KickStarter.runtimeObjectives == null || KickStarter.runtimeObjectives.SelectedObjective == null) return;
    
            var canvas = GetComponentInParent<Canvas>();
            var menu = KickStarter.playerMenus.GetMenuWithCanvas(canvas);
            var inventoryBox = menu.GetElementWithGameObject(gameObject) as MenuInventoryBox;
    
            var slot = inventoryBox.GetSlotIndex(gameObject);
            if (inventoryBox.GetObjective(slot) == KickStarter.runtimeObjectives.SelectedObjective)
            {
                KickStarter.playerMenus.SelectUIElement(gameObject);
            }
        }
    
    }
    
  • edited September 12

    I got a bunch of errors. Probably something related with the naming? I'm not quite sure.

    https://imgur.com/a/Ustl61O

  • edited September 13

    Which element are the Buttons you're attaching the script linked to? The default Objectives menu has an InventoryBox element named Objectives which shows a list of available Objectives. That's where the script is intended to be used.

  • edited September 14

    I'm attaching your script to each button slot defined in the Objectives Menu.
    The errors get triggered when I open the Objectives menu.

    https://imgur.com/a/LbrI8Lf

  • Let's try this one, to give some Debug output to the Console:

    using UnityEngine;
    using AC;
    
    public class ForceSelectObjective : MonoBehaviour
    {
    
        void OnEnable()
        {
            if (KickStarter.runtimeObjectives == null || KickStarter.runtimeObjectives.SelectedObjective == null) return;
    
            var canvas = GetComponentInParent<Canvas>();
            var menu = KickStarter.playerMenus.GetMenuWithCanvas(canvas);
            if (menu == null) { Debug.LogWarning ("Could not find Menu for Canvas " + canvas, canvas); return; }
            var element = menu.GetElementWithGameObject(gameObject);
            if (element == null) { Debug.LogWarning ("Could not find element for GameObject " + gameObject, gameObject); return; }
            var inventoryBox = element as MenuInventoryBox;
    
            var slot = inventoryBox.GetSlotIndex(gameObject);
            if (inventoryBox.GetObjective(slot) == KickStarter.runtimeObjectives.SelectedObjective)
            {
                KickStarter.playerMenus.SelectUIElement(gameObject);
            }
        }
    
    }
    
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.