C
Chrisctr
Guest
In Gamemaker Studios 2 (Version 2.1.3.189), I've been trying for the past few days to create a backlog of all the dialogue lines spoken during each individual dialogue sequence.
By 'backlog', I mean a display which shows all of the previous lines of dialogue spoken during the dialogue sequence in question, allowing the player to go back through something they may have accidentally skipped or simply want to read again.
I've managed to get all of the dialogue to appear using the code below the 'In draw event' heading, but I can't get it to show dialogue lines belonging only to the main conversation branch and the chosen conversation branch.
How the choice system works is that the player clicks one of six choices, and the code skips all code not belonging to that choice. For example:
Line[1] branch 0 (main branch) - displayed
Choice Prompt appears showing three choices, player chooses choice two
Line[2] branch 1 – skipped
Line[3] branch 1 – skipped
Line[4] branch 2 – displayed
Line[5] branch 3 – skipped
Line [6] branch 0 – displayed
The issue is that the backlog displays all of the skipped dialogue, while the actual text box shows only what is meant to be showed. At the moment, the dialogue system is a draft borrowed heavily from Drenathor's video 'Create a dialogue system in Game Maker 2'.
In create event (in obj_player)
In draw event (in obj_log_camera_trigger)
(Note, dialogue_line refers to scr_add_dialogue() from the create code, while Line[] are variables I created to store all of the dialogue strings as variables to make creating the backlog easier)
I've also tried having it as a 2d array which separates the lines from the branches (so it's [db1, db2]), but it changes all of the former text to '0' upon changing db2 (branch) (it just occurred to me that I never checked what it did with the skipped branches, though given that I couldn't fix the '0' problem, I'm ignoring that for now). I've tried a 'break' statement, but it deleted the entire backlog once the trigger for the break was reached. I've tried finding a statement of some sort which skips arrays, but I couldn't find anything through Google or the manual. I've tried using 'if' statements to only draw text belonging to the selected dialogue_branch, but the 'for' loop ignored them and wrote a duplicate of the string. And I've tried using 'if' statements to manually change db1 to whatever the dialogue line of the chosen branch was (what would have been the long way around), but again it seemed to be ignored regardless of what order the code was in.
Any help would be very much appreciated, as I'm at a complete loss at this point.
By 'backlog', I mean a display which shows all of the previous lines of dialogue spoken during the dialogue sequence in question, allowing the player to go back through something they may have accidentally skipped or simply want to read again.
I've managed to get all of the dialogue to appear using the code below the 'In draw event' heading, but I can't get it to show dialogue lines belonging only to the main conversation branch and the chosen conversation branch.
How the choice system works is that the player clicks one of six choices, and the code skips all code not belonging to that choice. For example:
Line[1] branch 0 (main branch) - displayed
Choice Prompt appears showing three choices, player chooses choice two
Line[2] branch 1 – skipped
Line[3] branch 1 – skipped
Line[4] branch 2 – displayed
Line[5] branch 3 – skipped
Line [6] branch 0 – displayed
The issue is that the backlog displays all of the skipped dialogue, while the actual text box shows only what is meant to be showed. At the moment, the dialogue system is a draft borrowed heavily from Drenathor's video 'Create a dialogue system in Game Maker 2'.
In create event (in obj_player)
Code:
///Argument 1 = text, 2 = speaker, 3 = continue, 4 = sprite, 5 = branch, 6 = branch end,
//7-9 = Affinity points gained from choices ("null" = nothing gained)
/// Parts of a line of dialogue 1a
d_second =
scr_add_dialogue(Line[0], Speaker[0], true, spr_placeholder, 0, false);
scr_add_dialogue(Line[1], Speaker[1], true, spr_placeholder, 0, false);
scr_add_dialogue(Line[2], Speaker[2], true, spr_placeholder, 1, false, "4a2", "5b2", "6c2");
///Option 1
// Op1: Responses
op1_br1 = choice 1
op1_br2 = choice 2
op1_br3 = choice 3
op1_br4 = choice 4
op1_br5 = choice 5
op1_br6 = choice 6
// Op1, Br1: Result
scr_add_dialogue(Line[3] , Speaker[3], true, spr_placeholder, 11, false);
scr_add_dialogue(Line[4], Speaker[4], true, spr_placeholder, 11, false);
scr_add_dialogue(Line[5] , Speaker[5], true, spr_placeholder, 11, true)
// Op1, Br2: Result
scr_add_dialogue(Line[6] , Speaker[6], true, spr_placeholder, 12)
scr_add_dialogue(Line[7] , Speaker[7], true, spr_placeholder, 12)
scr_add_dialogue(Line[8] , Speaker[8], true, spr_placeholder, 12, true)
// Op1, Br3: Result
scr_add_dialogue(Line[9] , Speaker[9], true, spr_placeholder, 13);
scr_add_dialogue(Line[10] , Speaker[10], true, spr_placeholder, 13, true);
///Skipped Br 4-6 as it's identical
///Option 1 End
scr_add_dialogue(Line[19], Speaker[19], true, spr_placeholder, 0, true);
scr_add_dialogue(Line[20], Speaker[20], true, spr_placeholder, 0, true);
scr_add_dialogue(Line[21], Speaker[21], true, spr_placeholder, 1, false, "null", "null", "null");
In draw event (in obj_log_camera_trigger)
Code:
var db1 = 0
for (db1 = 0; db1 < obj_dialogue_controller.dialogue_line; db1++) {
xposition = x_pos - 260
yposition = (y_pos - 345) + (db1*70)
draw_text_ext(xposition, yposition - 16, obj_player.Speaker[db1] , 15, 405);
draw_text_ext(xposition, yposition, obj_player.Line[db1] , 15, 405);
}}
I've also tried having it as a 2d array which separates the lines from the branches (so it's [db1, db2]), but it changes all of the former text to '0' upon changing db2 (branch) (it just occurred to me that I never checked what it did with the skipped branches, though given that I couldn't fix the '0' problem, I'm ignoring that for now). I've tried a 'break' statement, but it deleted the entire backlog once the trigger for the break was reached. I've tried finding a statement of some sort which skips arrays, but I couldn't find anything through Google or the manual. I've tried using 'if' statements to only draw text belonging to the selected dialogue_branch, but the 'for' loop ignored them and wrote a duplicate of the string. And I've tried using 'if' statements to manually change db1 to whatever the dialogue line of the chosen branch was (what would have been the long way around), but again it seemed to be ignored regardless of what order the code was in.
Any help would be very much appreciated, as I'm at a complete loss at this point.