Page 2 of 2

Re: Questions about splitscreen logic

Posted: Fri Sep 01, 2023 12:43 pm
by splinedrew
Thanks so much for the help! I like using the message system for this too. I decided to use it on the RefreshUI function, but I am running into one more snag. Here is my code:

Code: Select all

    
    void RefreshPOIs()
    {
        Debug.Log("Refresh is called!");
        for (int i = 0; i < PlayerJournals.Length; i++)
        {
            foreach (var quest in PlayerJournals[i].questList)
            {
                foreach (var node in quest.nodeList)
                {
                    POIItem poi = POI_Manager.AllPOIs.GetPOIItem(StringField.GetStringValue(node.id));
                    if (poi)
                    {
                        Debug.Log("P" + (i + 1) + " show in hud = " + quest.showInTrackHUD);
                        Debug.Log("Found a poi!" + StringField.GetStringValue(node.id));
                        if (!quest.showInTrackHUD)
                        {
                            poi.SetIsVisibleToPlayer(i, false);
                        }
                        else
                        {
                            if (node.GetState() == QuestNodeState.Active)
                            {
                                poi.SetIsVisibleToPlayer(i, true);
                            }
                            else
                            {
                                poi.SetIsVisibleToPlayer(i, false);
                            }
                        }
                    }
                }
            }
        }

    }
    
Now the issue is if I toggle the quest off in the Quest Journal UI it is turning off the POI for both players. Any ideas on how to get the showInTrackHUD value that's specific to the second player?

Re: Questions about splitscreen logic

Posted: Fri Sep 01, 2023 3:04 pm
by Tony Li
Is it possible that when you toggle tracking off it actually toggles off both players' instances of the quest?

Re: Questions about splitscreen logic

Posted: Fri Sep 01, 2023 4:36 pm
by splinedrew
Found the culprit in my code! I was caching my journals in an Awake method. It grabbed P1 journals only but when I cached them in a start method all was well. Thank you so much for all the help!

Re: Questions about splitscreen logic

Posted: Fri Sep 01, 2023 8:12 pm
by Tony Li
Glad you found the issue!