Replay a DTNode

NodeCanvas Forums Custom Nodes & Tasks Replay a DTNode

This topic contains 1 reply, has 1 voice, and was last updated by  driiade 6 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12043

    driiade
    Participant

    Hello, How can i “replay” a DTNode x time ?
    I try this because i have so long dialogue all cut in x parts…

    This code :

        [Name("SmartSay")]
        [Description("You can use a variable inline with the text by using brackets likeso: [myVarName] or [Global/myVarName].\nThe bracket will be replaced with the variable value ToString")]
        public class SmartSay : DTNode {
    
            public Statement statement = new Statement("Smart ID...");
            public int textsCount = 1;
    
            Statement tempStatement = new Statement("");
            int count = 0;
    
            protected override Status OnExecute(Component agent, IBlackboard bb)
            {
                tempStatement = new Statement(SmartLocalization.LanguageManager.Instance.GetTextValue(statement.text+ "."+ count));
                tempStatement = tempStatement.BlackboardReplace(bb);
                DialogueTree.RequestSubtitles(new SubtitlesRequestInfo((IDialogueActor)agent, tempStatement, OnStatementFinish));
                return Status.Running;
            }
    
            void OnStatementFinish()
            {
                count++;
                if (count < textsCount)
                {
                    DLGTree.EnterNode(this);
                }
                else
                {
                    count = 0;
                    status = Status.Success;
                    DLGTree.Continue();
                }
            }

    doesn’t work because the OnExecute DTNode function is called twice…

    #12044

    driiade
    Participant

    Ok Solved, It was because i had 2 DialogUI.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.