Forum rules - please read before posting.

How to use ActionConversation in code?

I want to call various actions in my code to complete the dynamic actionlist.

        ActionListAsset actionList = new ActionListAsset();
        actionList.name = "tempActionListAsset";
        actionList.isSkippable = false;
        actionList.canSurviveSceneChanges = true;
        // Declare the Actions within it
        actionList.actions = new List<Action>();
        ActionConversation actionConversation = ActionConversation.CreateNew(ConversationDoor);
        actionConversation.overrideOptions = true;

It looks like this, but I don't know what to code next. I want to implement the effect that each Conversation option will then lead to a different actionlist.

Comments

  • You can use the SetOutputs function to set the output sockets of an Action to either run another Action in the chain, or another Cutscene.

    You'd first just need to set the numSockets variable to match the Conversation, i.e.:

        actionConversation.numSockets = ConversationDoor.options.Count;
    actionConversation.SetOutputs (new ActionEnd (cutscene1), new ActionEnd (cutscene2));
    

    Alternatively, you could generate ActionRunActionList instances (i.e. the ActionList: Run Action) for more options on what ActionList to run (including run asset files), and then have the options run those:

        actionConversation.numSockets = ConversationDoor.options.Count;
        ActionRunActionList output1 = ActionRunActionList.CreateNew (myActionList1);
    ActionRunActionList output2 = ActionRunActionList.CreateNew (myActionList2);
    actionConversation.SetOutputs (new ActionEnd (output1), new ActionEnd (output2));
    

    These should be set after the Actions have been added to the list. See the included ScriptedActionlistExample script's second example for how this is done with the ActionVarCheck.

  • Thanks a lot!

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.