Forum rules - please read before posting.

Show pending interaction whilst action/interaction is running during cutscene?

1235»

Comments

  • gamestate, not gameState.

  • edited April 2020

    https://gfycat.com/unhappymedicalcanary

    If Run in background and Play in background, clear immediately.
    If Pause Gameplay and Play in background, text sticks.
    If Run in background and uncheck Play in background, clear after dialogue has spoken.

    So, it should be clearing if we have an unchecked unchecked Play in background and the action is set to Run in background, the dialogue should supersede the actionlist run state? But that still doesn't explain why text sticks if Pause Gameplay and Play in background, the text should unstick once Pause Gameplay is returned to normal.

  • Leave Play in background unchecked for the moment. It's only complicating matters.

    Only focus on setting it to Pause Gameplay.

    Right at the start of your gif, it's pausing gameplay, and the GameState is set to Normal when the interaction finishes. This is correct - though it should be reporting the GameState being set to Cutscene at the beginning of it. Did you place the debug statement outside of the "if" statement?

    If it's being set to Normal, then the override is set to clear - you can see this going on in the OnEnterGameState event. You're going to have to place another debug statement inside the SetOverrideText function to check that it's being called - or perhaps being called a second time with a new override afterwards.

  • edited April 2020

    I placed it like this:
    private void OnEnterGameState(GameState gamestate) { if (gamestate == GameState.Normal) { SetOverrideText(string.Empty); } Debug.Log("Enter GameState: " + gamestate); }

    By Normal, you mean Run In Background instead of Pause Gameplay?

    Where is the SetOverrideText function? I can see plenty of invokes, but not the actual function: https://paste.ofcode.org/6miGB47P26c47rMgWxHhGf

    I tried this: https://paste.ofcode.org/tQbc9LUV6efCRDL9XWXCwk

    Here you can see, it doesn't show the 'inventory interact' when it's set to Pause Gameplay. It shows 'inventory interact' immediately when it's set to Run In Background and again at the end, but the text holds (it shouldn't) but it shows 'inventory cancel action' as it stops holding. https://gfycat.com/cluelessportlyarrowana

  • By Normal, you mean Run In Background instead of Pause Gameplay?

    Neither. I'm referring to the "Enter GameState" debug line in OnEnterGameState.

    Here you can see, it doesn't show the 'inventory interact' when it's set to Pause Gameplay.

    That's correct.

    Where is the SetOverrideText function?

    Line 143.

    Duplicate your project, remove all scene/character graphics and all scenes except one for me to test with. Set up a single inventory item, with the interaction set up to demonstrate the problem. Then PM it to me.

  • Pm’ed
  • You still have your Verb1txtVerb2 component enabled. This is interfering with the new script, which is a replacement.

    In your Verbs prefab, delete the 2nd verb line as well, as the black gameobject that covers the 1st. The problem was that the 2nd (incorrect) verb line was showing.

    I have updated the script to respond correctly to unhandled inventory interactions as well:

    using UnityEngine;
    using UnityEngine.UI;
    
    namespace AC
    {
    
        public class ScummVerbLine : MonoBehaviour
        {
    
            #region Variables
    
            public Text verbLine;
            private Animator _animator;
            private string overrideText;
    
            #endregion
    
    
            #region UnityStandards
    
            private void OnEnable()
            {
                EventManager.OnHotspotInteract += OnHotspotInteract;
                EventManager.OnHotspotReach += OnHotspotReach;
                EventManager.OnHotspotStopMovingTo += OnHotspotStopMovingTo;
                EventManager.OnEnterGameState += OnEnterGameState;
                EventManager.OnInventoryInteract += OnInventoryInteract;
                EventManager.OnCharacterSetPath += OnCharacterSetPath;
            }
    
    
            private void OnDisable()
            {
                EventManager.OnHotspotInteract -= OnHotspotInteract;
                EventManager.OnHotspotReach -= OnHotspotReach;
                EventManager.OnHotspotStopMovingTo -= OnHotspotStopMovingTo;
                EventManager.OnEnterGameState -= OnEnterGameState;
                EventManager.OnInventoryInteract -= OnInventoryInteract;
                EventManager.OnCharacterSetPath -= OnCharacterSetPath;
            }
    
    
            private void Update()
            {
                if (string.IsNullOrEmpty(overrideText))
                {
                    verbLine.text = KickStarter.playerMenus.GetHotspotLabel();
                }
                else
                {
                    verbLine.text = overrideText;
    
                }
            }
    
            #endregion
    
    
            #region EventHooks
    
            private void OnCharacterSetPath(Char character, Paths path)
            {
                if (KickStarter.stateHandler.IsInGameplay() &&
                    character == KickStarter.player &&
                    KickStarter.playerInteraction.GetHotspotMovingTo() == null)
                {
                    Animator.SetTrigger("Flash");
                }
            }
    
    
            private void OnEnterGameState(GameState gamestate)
            {
                if (gamestate == GameState.Normal)
                {
                    SetOverrideText(string.Empty);
                }
            }
    
    
            private void OnHotspotInteract(Hotspot hotspot, AC.Button button)
            {
                SetOverrideText(button.GetFullLabel(hotspot, Options.GetLanguage()));
            }
    
    
            private void OnHotspotStopMovingTo(Hotspot hotspot)
            {
                SetOverrideText(string.Empty);
            }
    
    
            private void OnHotspotReach(Hotspot hotspot, AC.Button button)
            {
                switch (hotspot.interactionSource)
                {
                    case InteractionSource.AssetFile:
                        if (button.assetFile != null && button.assetFile.actionListType == ActionListType.PauseGameplay)
                        {
                            return;
                        }
                        break;
    
                    case InteractionSource.InScene:
                        if (button.interaction != null && button.interaction.actionListType == ActionListType.PauseGameplay)
                        {
                            return;
                        }
                        break;
    
                    default:
                        break;
                }
    
                SetOverrideText(string.Empty);
            }
    
    
            private void OnInventoryInteract (InvItem invItem, int iconID)
            {
                bool foundInteraction = false;
                foreach (InvInteraction interaction in invItem.interactions)
                {
                    if (interaction.icon.id == iconID)
                    {
                        foundInteraction = true;
    
                        if (interaction.actionList == null || interaction.actionList.actionListType == ActionListType.RunInBackground)
                        {
                            SetOverrideText (string.Empty);
                            return;
                        }
                    }
                }
    
                if (!foundInteraction)
                {
                    // Run unhandled
                    ActionListAsset unhandledAsset = KickStarter.cursorManager.GetUnhandledInteraction (iconID);
                    if (unhandledAsset == null || unhandledAsset.actionListType == ActionListType.RunInBackground)
                    {
                        SetOverrideText (string.Empty);
                        return;
                    }
                }
    
                SetOverrideText (invItem.GetFullLabel (Options.GetLanguage ()));
            }
    
            #endregion
    
    
            #region PrivateFunctions
    
            private void SetOverrideText(string text)
            {
                overrideText = text;
                Animator.SetBool ("Hold", !string.IsNullOrEmpty(overrideText));
            }
    
            #endregion
    
    
            #region GetSet
    
            private Animator Animator
            {
                get
                {
                    if (_animator == null)
                    {
                        _animator = GetComponent<Animator>();
                    }
                    return _animator;
                }
            }
    
            #endregion
    
        }
    
    }
    
  • edited April 2020

    Can you explain it once more, I've tried removing the old script and the text stops showing entirely, is txtVerbLineCopy taking over as the main line now?

    EDIT: Oh, okay, so remove the txtVerbLineCopy entirely, can I also remove the blackbg object? It doesn't seem to be needed anymore?

  • Somewhere along the line we've lost holding the text in place until a Pause Gameplay action is unpaused or finished:

    You can see the door opening and closing actions pause the gameplay for a second, then control is resumed and he speaks, but the text returns to "Walk to" as soon as he hits the marker and the interactions starts: https://gfycat.com/weightyrectangulargalapagosmockingbird

    Whereas the "open door/close door" text is held until control is resumed: https://gfycat.com/dependablefrigideasternglasslizard

  • Not on my end, I'm afraid.

    As the last issue was because of the way you'd set things up, best to start over with a basic Text canvas. Try the following:

    1. Create a new Canvas in your scene (not a prefab, nor linked to the Menu Manager), and attach a Text component as a child. Configure its display so that its readable at all times
    2. Attach an Animator to the Canvas but don't assign an Animator Controller
    3. Attach the ScummVerbLine component to the Canvas root, and assign the Text child in its Inspector

    With that, we can now see how it behaves without influence elsewhere. What is its behaviour then?

  • edited April 2020

    Okay, this is set up exactly as you described and they do the same thing: https://gfycat.com/babyishfittinggrackle

    I haven't changed anything in this project since I sent you the project .zip other than the changes you specified with VerbsUI, otherwise it's an identical project folder. I don;t understand how this could work for you if we're running the same project?

    Regarding the inventory selection issue, are you having the same issue on the project I sent you with the VerbsUI changes? I can't imagine how the ScummLine script could change how an object is selected.

  • edited April 2020

    Having made the changes to your Verbs UI, remove the new test Canvas, and send me the updated project - together with a complete list of the behaviour you want - with specific examples in a test scene, "If you select Use, then click the door, then X should happen"

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.