Forum rules - please read before posting.

Conversation action returning before completed

edited January 2017 in Technical Q&A
Hi,

I have a question regarding the Action of Type "Dialogue;Start conversation".
This is "multiple choice" dialogue, where your character chooses between lets say 4 lines, 4 questions/answers.

For example, you click on NPC hotspot, your player walks to NPC and subtitles UI appears
with 4 clickable options:
1. Hello there stranger !
2. Do you know anything about Marry?
3. Do you know where can I buy a car?
4. Nice coat you have.

Now, for this I use conversation component where I define all 4 options.
We can also slot interactions which are triggered when each of theese 4 options is chosen by player. But also we can leave those unsloted and use "override options" checkbox to define option consequences manualy through action list.

I am using override options method.

The problem is, this Dialogue:Start Conversation action returns from her action list immediately after conversation choice has been made. As if this choice is the last action in action list, but it is not.

For example, we have ActionList1

Play DialogA

Conversation
   - option 1
   - option 2 

both options lead to DialogB

Set variable Y = true

(here action list should return as complete, only after DialogB has played and Y is set to true)

And we have ActionList2 which just plays one dialogue

Play DialogC

And we have MasterActionList

ActionList1 (wait for finish is set to true)
ActionList2

So what happens when MasterActionList is run is next:
DialogA
Option1 and Option2 are presented
Player chooses Option1 or 2
DialogC

DialogB   is never played because Conversation returned from ActionList1  and ActionList1 thought she is finished and gave control to ActionList2 and ActionList2 played DialogC.

Conversation returns from ActionList immediately after dialog option has been chosen, before this dialog option has even been displayed, and before anything that goes after that is executed.

This can be problematic, is there a way I can override this, get around this problem ?

Thanks!

Joakim

Comments

  • Thanks for posting.  I will try to recreate this issue from your description, but I expect this is due to your waiting for ActionList1 in MasterActionList.  Try instead to run ActionList2 off the end of your Conversation in ActionList1.
  • edited January 2017
    Hi Chris, thanks for the answer.

    If I run ActionList2 off the end of Conversation in ActionList1 that means that now there is only ActionList2 and no more ActionList1, ActionList1 is now contained in ActionList2, am I right?

    If that is what you proposed, then this will work, I have tryed this, but I need to be able to encapsulate my multiple choices (multiple choice = action of type Dialogue:Start Conversation) in separate action lists because in some cases i have up to 10 multiple choices + various other logic parts, this big action lists become unmanageable through visual editor.

    I came up with custom soluton, or you could call it a "hack", for my particular case.
    I made something like wrapper action which stops action of type Dialogue:Start Conversation from returning control to next action list in the chain.

    I just Copyed the whole ActionRunActionList action, renamed this class to "ActionMCWrapper" and added few lines of code which prevents action from returning as finished until certain global variable is set to true.
  • edited January 2017
    My solution went like this (comment character limitations does not let me to put everything in one comment).

    1. Add global variable "testVar1" and add action "set testVar1 to true" at the end of the action list which uses action of type Dialogue:Start Conversation (this is action list with all multiple choice options).
    And for example, each option leads  to this action "set testVar1 to true"

    2. Copy AcionListRunActionList script and rename it as you wish (i.e. ActionMCWrapper)
        Modify this script like described in next comments
  • First Modify Run() function

    else
              {
                  if (listSource == ListSource.InScene && actionList != null)
                  {
                      if (KickStarter.actionListManager.IsListRunning(actionList))
                      {
                          return defaultPauseTime;
                      }
                      else
                      {
                          bool globalVarBool = AC.GlobalVariables.GetBooleanValue(VariableID); //VariableID
                          if (globalVarBool == false)
                          {
                              return defaultPauseTime;
                          }

                          isRunning = false;
                      }
                  }
                  else if (listSource == ListSource.AssetFile && invActionList != null)
                  {
                      if (KickStarter.actionListAssetManager.IsListRunning(invActionList))
                      {
                          return defaultPauseTime;
                      }
                      else
                      {
                          bool globalVarBool = AC.GlobalVariables.GetBooleanValue(VariableID); // VariableID
                          if (globalVarBool == false)
                          {
                              return defaultPauseTime;
                          }

                          isRunning = false;
                      }
                  }
              }
  • then modify ShowGUI() function

    override public void ShowGUI(List<ActionParameter> parameters)
            {

                temp = EditorGUILayout.TextField("Security var id:", temp);
                bool result = int.TryParse(temp, out VariableID);
                if (result == false)
                    VariableID = -1;

                listSource = (ListSource)EditorGUILayout.EnumPopup("Source:", listSource);
                if (listSource == ListSource.InScene)
                {
  • edited January 2017
    And dont forget to declare int VariableID, and that's it.

    Now you create separate aciton list containing your multiple choice with all the options and logic,
    add and set testVarX = true as last action of this action list.
    Next you create "master action list" and here you can chain many ActionMCWrapper actions.
    For each ActionMCWrapper action you need to provide VariableID (this has to be done manually).
    Now each ActionWCWrapper action will wait until variable with VariableID is true and only then proceede to next Action in masterActionList. 

    Not the best solution but it served me, it would be better to use local variables but I had some trouble with that, although I think that should also work.

    Hope somebody finds this useful :).

    Joakim
  • Very nice!  I wouldn't call that a hack, though I wonder if you could do that with a Variable: Check Action that loops in on itself as well.

    I'm not sure if ActionList2 is now contained within ActionList1 - I was thinking it would be the other way around.  In future, please consider posting screenshots - as it's quite difficult to convey the way ActionLists work together without them.
  • quote:
    "I'm not sure if ActionList2 is now contained within ActionList1 - I was thinking it would be the other way around."

    Yes I said it wrong, ActionList2 is now contained within ActionList1, not the other way around.
    I will consider screenhots next time.
    I did not know that we have Variable: Check Action that loops in on itself, or you are wondering if we could modify Variable:Check Action to loop on itself and get better solution this way.

    Joakim
  • No modification needed - I just meant that you can wire up the "condition is not met" output socket back onto the Action in the Editor.
  • Ah cool, did not think of that : ), thanks !

    Joakim
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.