Forum rules - please read before posting.

Cancel walk to point

edited December 2017 in Technical Q&A
Hi guys i'm trying to have the character walk to point on look at and then say something, if i use move to point without wait until finish he talks duting walk, if i check it the game goes in block and i have to wait until the action it's finished without have the possibility to click somewhere  to cancel it. Is there a way to do that?

p.s. i noticed that it works fine adding the marker in the inspector but i'm wondering how to do the same things in the actionlisteditor

Comments

  • There shouldn't be an issue with assigning fields in the Inspector vs the ActionList Editor - are you dragging them in from the Hierarchy window?  You should keep the Editor window docked when open.

    When is this all supposed to occur, when clicking a Hotspot?  The Hotspot Inspector's "Cutscene while moving?" options are there to allow you to cancel the interaction by clicking elsewhere before the player reaches the provided Walk-to Marker.

    One thing you could try is separate the Actions, so that you have the walking behaviour in a background ActionList, and the talking in a separate blocking one.  (An ActionList's "When running" field lets you choose between those options).

    The "talking" ActionList (basically everything that occurs once he's reached the destination) could be placed in a Trigger that checks if the "walking" ActionList is currently running.  Place the Trigger at the destination, so that if the player enters it - and the walking ActionList is running - then stop the player from moving and have him say his line.
  • i make you an example, in 2d tutorial whe we defined general unhandled or specific items unhandled for  worm i can't have player reach the marker and then say the phrase. I have to add character move to point in inventory action list with wait until finish checked so i can't cancel it.
  • You didn't mention this was for unhandled inventory interactions.  Yes, for that you can't assign a "Player Action" field.

    However, you can separate the response into two ActionList assets.  The first causes the player to move to the given point, and its When running field is set to Run In Background.  Check Wait until finish? in the Character: Move to point Action, and then have it run the second ActionList asset that gives the response.  (This second one should block gameplay).

    You can then make use of a simple script to stop the first ActionList if you click while the player is moving during gameplay:

    using UnityEngine;
    using System.Collections;
    using AC;

    public class StopMovingTest : MonoBehaviour
    {

        public ActionListAsset[] assetsToEnd;

        void Update ()
        {
            if (Input.GetMouseButtonDown (0) && KickStarter.player.IsPathfinding () && KickStarter.stateHandler.IsInGameplay ())
            {
                foreach (ActionListAsset assetToEnd in assetsToEnd)
                {
                    KickStarter.actionListAssetManager.EndAssetList (assetToEnd);
                }
            }
        }

    }



    Paste that into a new C# script named StopMovingTest and add it to your scene.  Then assign the background ActionList assets (the first one of each pair) to the Inspector, and they'll be forced off when the mouse clicks while the player walks to his destination.
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.