1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Dialogue system - How to return to the beginning of dialogue

Discussion in 'Programming' started by Shizuky, Aug 9, 2019.

  1. Shizuky

    Shizuky Member

    Joined:
    Jul 21, 2019
    Posts:
    21
    Hi, I have been using a dialogue system and I wanted to make a quest where , if you click on bad choice u will be returned to beginning, but I do not know how to return when the choice is bad to the beginning.


    I want the line 3 to return the the line 0 but don't know what code to use to change the var i to 0 again or how to repeat the case 1

    Here are the codes:
    Code:
    //
    reset_dialogue_defaults();
    
    
    switch(choice_variable){
        case -1:
        #region First Dialogue
            //Line 0
            var i = 0;
            myText[I]        = "Tri eurá dvadsat...";
            mySpeaker[I]    = id;
            myScripts[I]    = [create_instance_layer, 170,120,"Instances",obj_emote];
           
            //Line 1
            i++;
            myText[I]        = "Styri eura sedemdesiat...";
            mySpeaker[I]    = id;
           
            //Line 2
            i++;
            myText[I]        = ["Co to robis?", "Uuuu tolko penazí, zoberiem si pár."];
            myTypes[I]        = 1;
            mySpeaker[I]    = oPlayer;
            myScripts[I]    = [[change_variable, id, "choice_variable", "1"], [change_variable, id, "choice_variable", "2"]]; 
            myNextLine[I]    = [3,4];
           
                //LINE 3 
            i++
            myText[I]        = "Zlá moznost. skus znova!";       
            myEmotion[I]    = 1;
            myEmote[I]        = 0;
            mySpeaker[I]    = objSystem;
           
           
        //Line 4
            myText[I]        = "...... ";
            myEmotion[I]    = 1;
            myEmote[I]        = 0;
            mySpeaker[I]    = id;
           
            //Line 5
            i++;
            myText[I]        = "!";
            mySpeaker[I]    = id;
            myNextLine[i]    = -1;
           
            //Line 6
            i++;
            myText[i]        = "Ale ja ich potrebujem!";
            mySpeaker[i]    = id;
    
    
           
            //Line 12
            i++;
            myText[i]        = ["Otazkou je , ci sa mi Ta chce znova zbalit.", "Easy."];
            myTypes[i]        = 1;
            myNextLine[i]    = [0,0];
            myScripts[i]    = [[change_variable, id, "choice_variable", "1"], [change_variable, id, "choice_variable", "2"]]; 
            mySpeaker[i]    = oPlayer;
           
           
           
    
            #endregion
        break;
       
        case "1":
        #region If you chose green   
        var i =  0
            myText[i]        = "Stalc E pre zaciatok.";
            myEmotion[i]    = 1;
            myEmote[i]        = 0;
            mySpeaker[i]    = objSystem;
           
            choice_variable    = -1;
        #endregion
       
        break;
       //
     
    Last edited by a moderator: Aug 10, 2019
  2. YoSniper

    YoSniper Member

    Joined:
    Jun 24, 2016
    Posts:
    418
    Can't you just reset the variable choice_variable? That seems to be the driving variable for where your dialog goes and how it is steered.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice