I gave the voices variation by using audio_sound_pitch, specifically "audio_sound_pitch(snd[page], random_range(0.8, 1.2));" I'm using edited animal vocals and it sounds really fun, though potentially weird and creepy.
For the part where you need to select each txtb_spr that is highlighted with Find and Replace, you can click the { } icon to highlight words that are identical to what you put in (essentially, it looks for exact matches to what you put in instead of things containing what you put in), and then you can click the up and down arrow icon next to the Find Box to bring up the Replace Input (what you want to replace it with) and put in txtb_spr[page], then click the multiple tick icon (Replace All) and bam, all of your txtb_spr variables are now arrays (correct me if im wrong lmfao)
For anyone who only prints a single character of text and sees it cut out. It means your brackets are off. The setup bracket starts and SHOULD end at the end of the new stuff (a line above typing text comment) and this made it work for me. Just copy them like in the video.
The textbox really comes alive with the portraits and sound effects! I'm still amazed he went this far without ever addressing the (potential) issue of text spilling out of the box on the Y axis, though.... Other than that, it's an extremely robust system.
Man, I finally screwed it up completely. Tried to take some shortcuts to make my life easier earlier in the series, and now it's all a tangled mess and I need to start again. That's on me though, good series lol
I'm curious if there's a way to set the portrait up to where it can be above the dialogue box, rather than beside the textbox. I thought maybe making a y offset for the y position would work, but I'm not sure if that would even work properly. Additionally, I seem to get an error regarding the draw_text_color line in the object Textbox Draw event. ( Variable Index [2] out of range [2] at gml_Object_obj_textbox_Draw_0 (line 241) - draw_text_color(char_x[c, page] + _shake_x, char_y[c, page] + _float_y + _shake_y, char[c, page], col_1[c, page], col_2[c, page], col_3[c, page], col_4[c, page],1); ) It prevents the dialogue from continuing, thus crashing the game.
Your tutorials have been so much help! I do wonder though-- I'm looking between this video and the next one, and-- is there a way to set a font color, or even, different font, to the specific characters/speakers? I'm fiddling around but not really... sure.
Oh I just saw you were mostly talking about font. Yeah it's the same exact principle as the colors and stuff, just make an array that stores a font for each character, then set that font in the section where you're physically drawing each character in that final loop!
Welp, the 'fun stuff' turned out to be a nightmare worse that what unfolded beforehand... I'm stuck in two places: 1. My character sprite seems to pull a random sprite for some reason,. 2. The sound effect only plays up to one of the (., ?, !, ,) and then the window mysteriously closes... Been stuck with this for two days in a row. :/
im having the same exact problem with the character sprite. if anyone has a solution to this it'd be greatly appreciated. super confused, i have no idea what i could've done wrong to make this happen
For the character pulling a random sprite it had to do with having a [0] or some kind of number value instead of a variable like [page_number] in one of the arrays... maybe it was speaker_sprite[page_number] = noone; But i honestly can remember. Hope that helps debug the issue
Hi!! Your tutorials are awesome! I've already learned so much from them! I am having an issue though, gamemaker won't run my game because 'text_x_offset' isnt 'set'. I'm really confused, because didn't we set it like this?: text_x_offset[p] = 44; Ive been rewatching and rewatching, all of the videos, but I can't find where I messed up...
I hear you, and the solution is so easy you may cry. Your speakblock has no creation code connecting it the gametext. just add "text_id = "npc 1"; and it should work (edit: for reference, I was stuck on this problem for a about 4 days now)
i had the same issue thanks for posting, i added (text_id = "npc 1";) to my obj_speakblock Create event as suggested by @ianblasco5322 but it did not make a difference... any ideas? thanks
pls i do need help with this error, its important:( Push :: Execution Error - Variable Index [2] out of range [2] - -1.speaker_sprite(100009,2) at gml_Object_obj_cajadetexto_Draw_0 (line 152) - if speaker_sprite[page_number] != noone {
Hi, i tried this and got the textbox positioning working fine, but the text would sometimes go outside the textbox even though i did the offset stuff correctly. i solved this by getting rid of "setup = true" (so that it would repeat) but i don't think this was shown in the video... am i missing something?
This helped me greatly. I was stuck on the same bug you were on for hours, making if statements and whatnot but nothing worked. So, I went into the comments to see if anybody was as dumb as me and found this comment. Thank you for unintentionally saving my game.
Hey, not sure if you're still responding to comments but... if I wanted to add a special string/character for pausing, e.g. "{p}" how would I go about getting rid of the "{p}" before it's typed in the actual textbox?
Would be great if you showed this concept in "chat messenger" set up, where the npc, and player messages scroll upward, and all the player messages show at the bottom and have to push send for them to go up into the scroll chat.
there's a bug with this system (unless i followed along wrong), if the player presses the "accept key" again while the textbox is typing, the typing sound will repeat
Hello! For some reason, im getting a text_x_offset error whenever I run the game saying that it is not set even though I followed the tutorial and double/triple checked my code. People in the comments have fixed it by setting their text id creation code to the same code as the scr_game_text script switch but mine was already like that! This error seems to not let me have "noone" as my default for speaker_sprite[page_number] either! It will not show any text that I haven't set "blue kid" as a [character]. Like it will literally skip over any text that hasn't been asigned any [character]. While I can continue the tutorial for now, since I have to manually type in "noone" in as the [character] in scr_game_text, that really defeats the purpose of the defaults script and makes me sad =(.
I am a fool it was a syntax error. I simply did not close the if statement above my switch function with brackets correctly. hopefully this helps someone. I need a nap...
@@plagueparchments it has been a month so I'm not exactly sure what I meant but go through all your code and make sure your brackets {} are properly written or properly closing your functions. I happened to have stray } missing which messed up mine.
Awesome!! It would be interesting to maybe add a third param in the scr_text function to account for changes in speed? So some character's typewriting effect can be slower and others can be faster. Just an idea.
If anyone missed this while trying to add vocal sound effects - for some reason mine weren't loading, I checked and it said "Audio Group 1 is not loaded". To fix this I entered this code right above the var _check_char section: if !audio_group_is_loaded(NAME OF YOUR AUDIO GROUP) { audio_group_load(NAME OF YOUR AUDIO GROUP); }
I’m now making a new game and I would like to use actual voice lines rather than voice blips for my dialogue audio. For text, I modified scr_text to add another optional parameter which determines which audio/voice line would play. However, I only keep the voice blips for any lines that no character is speaking.
for whatever reason, the box that is supposed to surround the character sprite in the textbox just doesn’t appear. though it had to do with the draw speaker section but i checked it and that’s not it. not sure what happened, lol
is there a way to shrink the textbox width when a portrait appears? say if i have an undertale-size textbox and i want it to scoot over to the right, the textbox goes a bit offscreen. can you shrink the width so it can load the whole text not cut-off?
Hey Peyton, or anyone who can help, If I wanted the character busts (that have a high resolution) appear instead of character portraits, I'll need a draw GUI layer right? since the game size is 288x216, I tried setting that by myself but it doesn't work, if anyone have suggestions please tell me :) my draw GUI event: if speaker_sprite[page] != noone { surface_resize(application_surface, 288, 216); display_set_gui_size(1152, 864); sprite_index = speaker_sprite[page]; var _speaker_x = textbox_x; var _speaker_y = textbox_y - sprite_height; if speaker_side = -1 { _speaker_x += sprite_width } ///--------- ///drawing the speaker (real action)-----///
Go check out pixelated pope's video on simple camera, then take everything from your draw event and stick it in the Draw GUI (keep a blank draw event), change textbox_x and textbox_y from camera_get_view_x/y respectively to whatever; wherever you want it to appear on the GUI layer. That should sort ya out. That'll let you zoom the camera in at different scales without affecting the position or scale of the textboxes.
so what if i have a character portrait that has a higher resolution than the scale of the room, so like the room is 288x216 and my portrait is 1628x2100, how can i scale down the portrait without losing the resolution?, some said i should use draw gui but i just cant wrap my head around it
same, sadly i dont know how to help you but am scaling the image down till it can fit i wish there was a way to do it , i think somehow you can make the sprites into objects then scale them from the create event but idk
Hey! I have a simple question. When you write ALL of the dialog in one script, isnt that script gonna have 1000+ lines at least? woudn't that make the game slower with one script instead of maybe using the creation code for every object? Sorry if im wrong xd. Just wondering! love your videos :D
I'm having an issue, when the first line of text is full, it the text goes to the second line like it normally should. But the Second Line of text don't form a sentence, the words just go downward, and the lines are all seperated by a whole lot
Were you able to fix it, I had the same problem and was able to fix it, I could check it out (because I forgot) to share what I did if you didn't solve it yet. Thank you
Anyone know how to stop your character from moving while they're interacting with dialogue? I've been trying multiple ways and followed this tutorial as much as I could, but I can't seem to get it to work--
@@holiday_out3740 I’ll try my best! Not gonna lie, I’m still kinda new to coding so I’m not entirely sure why it worked… lol. In my character’s object step event, this is the code I wrote. If instance_exists(obj_textbox) && distanceTrigger { move_spd = 0; } Else { move_spd = 1; } Keep in mind that in the object areas you have to replace them with whatever you named your stuff… make sure you set the variable distanceTrigger = 2 in the create event… I think this is all? If not, lemme know and it’s probably not the prettiest way to do this- oh yeah, if you had a sprinting ability it does take that away and I’m not entirely sure how to fix that… but I hope this helps!
@@viperizer0 Thank you! I came up with something super simple. In the player object step event, before anything else like movement if ( instance_exists(obj_textbox)) { exit; } and now your player doesn't move while dialogue is active cheers!
OMFG! I was stuck in a error for hours!! Anyone who is getting the " var _txtb_x = textbox_x + text_x_ofset[page]; " error, please remember: If you change the " case "npc 1": " in game script, you need to change the new name into the speakblock at your room (text_id)!!!!!!! I searched about it everywhere and I just realized it abot this now!!!!! if that doesnt work, try it to put " text_x_offset[0]= 0; " on obj_textbox Create page. Hope this help anyone, good lucky :)
Hiya! Maybe quick question, I have imported art for the sprites/character portraits, is there a way to make it fit into the box for the character speaking even tho it is not 64 pixels?
Got a problem - after implementing this cool pauses - dialogues are looping. Last page (line) of dialogue is endlesly repeating, and/or other pages too. Maybe someone struggled with similar issue and knows the answer?
Found a source for that: if keyboard_check_pressed(ord("E")) && distance_to_object(obj_Player) < 10 - object speakblock, in the step event instead of this mouse poisition was put by me... 'cause I want to use only keyboard for operating my game... Now trying to figure it out how to get rid of mouse and this bug when using keyboard!
I don't know what I did wrong, but when I start the dialogue with an npc, the text flows correctly, and the npc's portrait animation works, but when its the player talking, the text automatically goes to the end of the textbox e the animation don't work. Did you understand my problem? Can u help me?
@@hayuralves1207 what was your solution? After setting up my arguments in scr_textbox_functions, cases inside of scr_game_text no longer display unless I provide an id for each specific case. It skips over that line of text and continues on unless a sprite is assigned to that scr_text.
wow i just solved it after i posted this in 5 min, the problem was that i typed in the scr_text at line 7 speaker_sprite = [page_number] = noone; while it was spoused to be speaker_sprite[page_number] = noone 😭
I don't know if I'll get an answer here but it's worth a shot. I'm using 8 Bit Operator font text (Undertale/Deltarune font) and inserted it exactly as the video says. It writes fine! However, my spaces in between the words seem to be a little short for some reason? In other words, each word is too close to another. It's been almost a year since I followed these tutorials and I finally got back to the project. I can't seem to find a way to make my spaces in between words larger. Any suggestions would be helpful! I've tried making the width of the actual font larger but that didn't seem to help.
Would be better if you tried locally storing the font characters as one big spr_fontmain asset as that allows you to mess with seperation using the font_create_sprite(); function
Hey if anyone could please help me, the left and right sides of the texboxes for the character portraits are showing up squished, and on the options all of the sides are squishes. The options were showing up fine before i wrote this section of code
This is sort of a weird issue, but the local variable I declare with a script seems to override any params I set. Maybe it's a setting I accidentally disabled, but it's pretty annoying. Here's an example: /// @param text /// @param [character] function scr_text(_text){ When I call scr_text, the bottom of the window will only show scr_text(_text). Does anyone know what I did wrong?
Hi¡ I’m having this issue where the dialog and sound is significantly faster on the first page of dialog but it works perfectly second page onwards, anyone knows what might be causing it? 😢
my apologies for asking for help on a video over 2 years old, but when a portrait is drawn, the place of the linebreak isn't adjusted accordingly, meaning the text will go over the edge of the textbox. does anyone have an idea as to how i can adjust the linebreak to be in the correct place? as well, this isnt as relevant to this video specifically, but more the series as a whole, is there a way to have the text aligned to the centre of the textbox as opposed to the left? thank you!!!!!!!!
I need help, I'm in the part where we make the code to draw the portraits, but my character portrait isn't drawing, or is drawing below the portrait box, what do I do? Edit: what happened was that the sprite was getting mirrored and blocked by the main text box... maybe I switched up some 1s and negative 1s... Edit 2: I FIGURED IT OUT, turns out the negative and positives had meaning haha, im dumb, the way i solved the issue is by asking myself randomly "okay i need to add the sprite back to put it in place when it flips... Wait why does it even flip? Theres no code that-" and then i realized! Btw my default is having the portraits on the right side so thats why i had issues
IDK if anyone can help me but I have this error and I don't know to fix it The error: Got "}" (eof) expected } or end. But I have } at the end can someone help?
I can't really help since I don't have your code and stuff, what I really recommend is going back to the video and speed it up and check if every line is correct also a tip, everytime you run your project and everything goes good put a comment or mark like "///nothing to check here" under the code you finished so that you don't touch it or mess with it accidentally and to not waste time to go back over the whole video to check all your code, maybe the mistake is something new you added and you just need to go back few steps
not sure if this is it but i had a similar issue and it was because i didn't have the right amount of } around an else statement. It was during the part in the tutorial when we were doing the stopping at "." around 21:00 or so. Not sure if that helps
does anyone have any tips for how to make a character cycle through different lines of dialogue each time you click on them, or how to only trigger certain dialogue options after something else has occurred (ie picking up an item or something)? very new to gamemaker and this tutorial series has been SUPER helpful, I just find myself getting stuck when I need a certain event to occur before triggering a section of dialogue (or if I dont want the char to keep saying the same thing over and over again)
EDIT: figured out a solution! if anyone's wondering how to make certain events/new dialogue trigger based on the player's responses, I just initialized a few global variables in the obj_settings create event and you can change them in the scr_game_text function in each specific case. for ex, I set global.quest = false in obj_settings, and then under the specific case i want to trigger something I changed it to true. example: case "npc 1": if global.quest == false { scr_text("this text will trigger the quest"); global.quest = true; break; } if global.quest == true { scr_text("quest is now triggered!"); break; }
I'm getting an interesting error where depending on my usage of "npc 1" and "red kid" (my version of blue kid) i can either get the unpersonalized dialogue box w text, options and it all works but no speaker and it's in the middle. OR, I can get the personalized layout correct, but before text appears I get: Push :: Execution Error - Variable Index [15] out of range [15] - -1.char(100060,15) at gml_Object_obj_textbox_Draw_0 (line 210) - draw_text( char_x[c, page], char_y[c, page], char[c, page] ######################### gml_Object_obj_textbox_Draw_0 (line 210) Any help on how I can get them to work at the same time would be really helpful!!!
Sorry to say this but I can’t do your text boxes tutorial anymore. It’s really hard for me to make my own text boxes look like one from Undertale, considering that for your tutorial, 2 boxes are used for a speaker Sprite being presence but one box for Undertale, or any other fangame. Thankfully, I still managed to make the ones without the speaker Sprites.
@ I do feel like if maybe you might have to code on your own for this kind of text box or follow a different tutorial. I had to take Computer Science in university to further enhance my coding skills.
I love these videos, they've helped so far with my tiny puzzle/ escape room game. However, does anyone know how I can go about using the spr_greenkid/spr_bluekid, ect. as an array to flip through sprites the way we would with the house decorations?
I just spent an hour and a half pulling my hair out trying to figure out why the game was crashing and telling me variables that I definitely set weren't set. Turns out I just forgot to put the text_id in the creation code. Don't code while sleep-deprived, kids.
Hey, I've been following the tutorial and I have a question, my output keeps telling me my "Push :: Execution Error - Variable Index [1] out of range [1] - -1.textb_spr(100007,1)". I'm fairly new to gamemaker/coding in general so I am so confused on what this means. It referencing this: "textb_spr_w = sprite_get_width(textb_spr[page]);" And I know that the error has something to do with the array I set for my textb_spr variable, but for the life of me I can't figure it out! I have an array there which is exactly the same as what he set! So, I don't know what I'm doing wrong!
omg i have the exact same error as well ;-; EDIT: I found a fix, but its gonna need sacrifice. I don't know why it isn't working normally, but here it is: Replace all the txtb_spr[page] arrays with txtb_spr[0] in the draw event, atleast thats how i fixed it the sacrifice is that you cant get anymore custom backgrounds for different characters... it can still look cool but not in that way
can someone help me? I'm having this error with the speaker_sprite != noone ___________________________________________ ############################################################################################ ERROR in action number 1 of Draw Event for object obj_txtbox: trying to index a variable which is not an array at gml_Object_obj_txtbox_Draw_0 (line 122) - if (speaker_sprite[page_number] != noone){ ############################################################################################ gml_Object_obj_txtbox_Draw_0 (line 122) and, yeah, I tried with speaker_sprite[page] != noone {, but it doesn't work either. I tried changing the [page] with [page_number] just in case
easy fix! instead of using [page_number], use (speaker_sprite[argument[2]]), which is an array!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thx!!@@sillylittleboy6361 could you help me with smth else too? I'm trying to do a cutscene that goes like- "Text", "Image" & "Another text" on top of the image. I have no problem with the first text appearing automatically and disappearing, but I can't make the image appear. I set a variable that, when the script marks it as true, the text disappears. Not only that, but I tried to do the same with the create_image_ext, but it didn't worked.
I'm really hoping someone sees this comment because I can't figure out for the life of me to have it to work so that instead of interacting in this practice room, it will show text when I interact with objects or NPCS in my actual game. Any ideas please I have actually shed tears over this now.
is anyone else getting the error "Variable .text_x_offset(100089, 0) not set before reading it. at gml_Object_obj_textbox_Draw_0 (line 185) - var _txtb_x = textbox_x + text_x_offset[page];"
@@stormstudios1 so basically you need to give the child object the text variables. it been a minute but you need to make sure in the creation code of your CHILD object (the one your pc is interacting with, not the parent) has what it needs because thats what gives "text_x_offset" its value, otherwise it will be null and the program will freak out. thats atleast what my problem was.
Umm I broke somthing ############################################################################################ ERROR in action number 1 of Draw Event for object ObjectTextBox: Variable .text_x_offset(100069, 0) not set before reading it. at gml_Object_ObjectTextBox_Draw_0 (line 167) - var _textbox_x = textbox_x + text_x_offset[page]; ############################################################################################ gml_Object_ObjectTextBox_Draw_0 (line 167)
I have made it to the fun, but at what cost
I gave the voices variation by using audio_sound_pitch, specifically "audio_sound_pitch(snd[page], random_range(0.8, 1.2));"
I'm using edited animal vocals and it sounds really fun, though potentially weird and creepy.
super helpful, thanks for sharing!!
@@cody7689 No problem!
yooooooo animal crossing!
i can already do a lot of crazy things with what i just learnt from this
For the part where you need to select each txtb_spr that is highlighted with Find and Replace, you can click the { } icon to highlight words that are identical to what you put in (essentially, it looks for exact matches to what you put in instead of things containing what you put in), and then you can click the up and down arrow icon next to the Find Box to bring up the Replace Input (what you want to replace it with) and put in txtb_spr[page], then click the multiple tick icon (Replace All) and bam, all of your txtb_spr variables are now arrays (correct me if im wrong lmfao)
Oh I don't know if I've tried that lmao! I'll have to give it a go!!
For anyone who only prints a single character of text and sees it cut out. It means your brackets are off. The setup bracket starts and SHOULD end at the end of the new stuff (a line above typing text comment) and this made it work for me. Just copy them like in the video.
Brackets are off where? Mine text boxes/portraits are showing up for a milisecond with one character of text appearing, then it all disappears.
Another awesome tutorial! Gonna start the last one later today.
Thanks and good luck!
The textbox really comes alive with the portraits and sound effects! I'm still amazed he went this far without ever addressing the (potential) issue of text spilling out of the box on the Y axis, though.... Other than that, it's an extremely robust system.
Are you planning to make a cutscene system?
Not sure yet! But for now you can look into “sequences in gms 2.3” for some good tutorials that will probably show you a lot of what you want to know!
@@peytonburnham4316 Thanks :)
Man, I finally screwed it up completely. Tried to take some shortcuts to make my life easier earlier in the series, and now it's all a tangled mess and I need to start again. That's on me though, good series lol
rest in peace
I'm curious if there's a way to set the portrait up to where it can be above the dialogue box, rather than beside the textbox. I thought maybe making a y offset for the y position would work, but I'm not sure if that would even work properly.
Additionally, I seem to get an error regarding the draw_text_color line in the object Textbox Draw event.
( Variable Index [2] out of range [2]
at gml_Object_obj_textbox_Draw_0 (line 241) - draw_text_color(char_x[c, page] + _shake_x, char_y[c, page] + _float_y + _shake_y, char[c, page], col_1[c, page], col_2[c, page], col_3[c, page], col_4[c, page],1); )
It prevents the dialogue from continuing, thus crashing the game.
I also have that problem, have you already solved it?
22:22 sound setup
Your tutorials have been so much help! I do wonder though-- I'm looking between this video and the next one, and-- is there a way to set a font color, or even, different font, to the specific characters/speakers? I'm fiddling around but not really... sure.
Watch part 5!
Oh I just saw you were mostly talking about font. Yeah it's the same exact principle as the colors and stuff, just make an array that stores a font for each character, then set that font in the section where you're physically drawing each character in that final loop!
@@peytonburnham4316 ---I realize I must of been too tired watching part 5 HA,,, sorry about that, but thank you!
really awesome tutorial! I'm personally not going for a similar style of text box, but all of this is so extremely useful. such a great series.
Welp, the 'fun stuff' turned out to be a nightmare worse that what unfolded beforehand... I'm stuck in two places: 1. My character sprite seems to pull a random sprite for some reason,. 2. The sound effect only plays up to one of the (., ?, !, ,) and then the window mysteriously closes... Been stuck with this for two days in a row. :/
im having the same exact problem with the character sprite. if anyone has a solution to this it'd be greatly appreciated. super confused, i have no idea what i could've done wrong to make this happen
For the character pulling a random sprite it had to do with having a [0] or some kind of number value instead of a variable like [page_number] in one of the arrays... maybe it was speaker_sprite[page_number] = noone; But i honestly can remember. Hope that helps debug the issue
Hi!! Your tutorials are awesome! I've already learned so much from them!
I am having an issue though, gamemaker won't run my game because 'text_x_offset' isnt 'set'. I'm really confused, because didn't we set it like this?:
text_x_offset[p] = 44;
Ive been rewatching and rewatching, all of the videos, but I can't find where I messed up...
I hear you, and the solution is so easy you may cry. Your speakblock has no creation code connecting it the gametext. just add "text_id = "npc 1"; and it should work
(edit: for reference, I was stuck on this problem for a about 4 days now)
@@ianblasco5322THANK YOU
i had the same issue thanks for posting, i added (text_id = "npc 1";) to my obj_speakblock Create event as suggested by @ianblasco5322 but it did not make a difference... any ideas? thanks
i had the same issue and it didnt get fixed from @ianblascos solution, like @faanross . does anyone know any other way to fix it?
@@faanross create event and creation code are different!
pls i do need help with this error, its important:(
Push :: Execution Error - Variable Index [2] out of range [2] - -1.speaker_sprite(100009,2)
at gml_Object_obj_cajadetexto_Draw_0 (line 152) - if speaker_sprite[page_number] != noone {
did you fix? it I have the same problem
I FIXED IT! instead of page_number in the brackets on speaker_sprite, put page, if that does not work, put a "0"
I've been trying to figure this out for a while, but whenever I call a textbox even without a face it says "trying to draw non-existent sprite"
Hi, i tried this and got the textbox positioning working fine, but the text would sometimes go outside the textbox even though i did the offset stuff correctly. i solved this by getting rid of "setup = true" (so that it would repeat) but i don't think this was shown in the video... am i missing something?
This helped me greatly. I was stuck on the same bug you were on for hours, making if statements and whatnot but nothing worked. So, I went into the comments to see if anybody was as dumb as me and found this comment. Thank you for unintentionally saving my game.
I encountered the same problem. Thanks for the help, it fixed it. Let's hope it doesnt mess anything up down the road, lol.
Thank you so much. I've been trying to fix this for days 😭
Hey, not sure if you're still responding to comments but...
if I wanted to add a special string/character for pausing, e.g. "{p}"
how would I go about getting rid of the "{p}" before it's typed in the actual textbox?
14:47
bro i was why did i lough so hard
Would be great if you showed this concept in "chat messenger" set up, where the npc, and player messages scroll upward, and all the player messages show at the bottom and have to push send for them to go up into the scroll chat.
I've done everything so far and it works like a charm :D
there's a bug with this system (unless i followed along wrong), if the player presses the "accept key" again while the textbox is typing, the typing sound will repeat
hey, i'm still struggling with this problem, did you solve it? it's possible to use 2 buttons for the dialog box, but it's still stressful for me....
I want my text box to be narrower when there’s a speaker Sprite present than when there’s no speaker Sprite. How do I do it?
Hello! For some reason, im getting a text_x_offset error whenever I run the game saying that it is not set even though I followed the tutorial and double/triple checked my code. People in the comments have fixed it by setting their text id creation code to the same code as the scr_game_text script switch but mine was already like that!
This error seems to not let me have "noone" as my default for speaker_sprite[page_number] either! It will not show any text that I haven't set "blue kid" as a [character]. Like it will literally skip over any text that hasn't been asigned any [character]. While I can continue the tutorial for now, since I have to manually type in "noone" in as the [character] in scr_game_text, that really defeats the purpose of the defaults script and makes me sad =(.
I am a fool it was a syntax error. I simply did not close the if statement above my switch function with brackets correctly.
hopefully this helps someone.
I need a nap...
which switch function are you talking about? i think i might be having the same issue
@@plagueparchments it has been a month so I'm not exactly sure what I meant but go through all your code and make sure your brackets {} are properly written or properly closing your functions. I happened to have stray } missing which messed up mine.
@@memeslandofawesome thanks dude!
@@plagueparchments did you solved it?
Awesome!! It would be interesting to maybe add a third param in the scr_text function to account for changes in speed? So some character's typewriting effect can be slower and others can be faster. Just an idea.
If anyone missed this while trying to add vocal sound effects - for some reason mine weren't loading, I checked and it said "Audio Group 1 is not loaded". To fix this I entered this code right above the var _check_char section:
if !audio_group_is_loaded(NAME OF YOUR AUDIO GROUP)
{
audio_group_load(NAME OF YOUR AUDIO GROUP);
}
THANK YOU SO SO MUCH!!!!
14:33
just a timestamp for myself
I’m now making a new game and I would like to use actual voice lines rather than voice blips for my dialogue audio. For text, I modified scr_text to add another optional parameter which determines which audio/voice line would play. However, I only keep the voice blips for any lines that no character is speaking.
for whatever reason, the box that is supposed to surround the character sprite in the textbox just doesn’t appear. though it had to do with the draw speaker section but i checked it and that’s not it.
not sure what happened, lol
hey, were you able to solve it? i have the same problem :(
@@sebasgac sort of, i just had to mess around with the math on the draw function, and get the box to actually draw around the sprite correctly
is there a way to shrink the textbox width when a portrait appears?
say if i have an undertale-size textbox and i want it to scoot over to the right, the textbox goes a bit offscreen. can you shrink the width so it can load the whole text not cut-off?
thank you so much for uploading this. this is really helpful
Hey Peyton, or anyone who can help, If I wanted the character busts (that have a high resolution) appear instead of character portraits, I'll need a draw GUI layer right? since the game size is 288x216, I tried setting that by myself but it doesn't work, if anyone have suggestions please tell me :)
my draw GUI event:
if speaker_sprite[page] != noone
{
surface_resize(application_surface, 288, 216);
display_set_gui_size(1152, 864);
sprite_index = speaker_sprite[page];
var _speaker_x = textbox_x;
var _speaker_y = textbox_y - sprite_height;
if speaker_side = -1
{
_speaker_x += sprite_width
}
///--------- ///drawing the speaker (real action)-----///
draw_sprite_ext(sprite_index, image_index, _speaker_x, _speaker_y, speaker_side[page], 1, 0, c_white, 1)
}
Go check out pixelated pope's video on simple camera, then take everything from your draw event and stick it in the Draw GUI (keep a blank draw event), change textbox_x and textbox_y from camera_get_view_x/y respectively to whatever; wherever you want it to appear on the GUI layer. That should sort ya out. That'll let you zoom the camera in at different scales without affecting the position or scale of the textboxes.
so what if i have a character portrait that has a higher resolution than the scale of the room, so like the room is 288x216 and my portrait is 1628x2100, how can i scale down the portrait without losing the resolution?, some said i should use draw gui but i just cant wrap my head around it
you can't scale down an image without losing resolution, i would recommend drawing a simpler sprite
same, sadly i dont know how to help you but am scaling the image down till it can fit
i wish there was a way to do it , i think somehow you can make the sprites into objects then scale them from the create event but idk
Oh my god thank you so much
Hey! I have a simple question. When you write ALL of the dialog in one script, isnt that script gonna have 1000+ lines at least? woudn't that make the game slower with one script instead of maybe using the creation code for every object? Sorry if im wrong xd. Just wondering! love your videos :D
I think it's the same either way, and you don't need to go looking for the object that has the text
I'm having an issue, when the first line of text is full, it the text goes to the second line like it normally should. But the Second Line of text don't form a sentence, the words just go downward, and the lines are all seperated by a whole lot
Were you able to fix it, I had the same problem and was able to fix it, I could check it out (because I forgot) to share what I did if you didn't solve it yet. Thank you
10:33 (note for later)
It is mentioned that you could use an array to set a different delay value for each sound, does anyone know how exactly I would go about doing this?
Anyone know how to stop your character from moving while they're interacting with dialogue? I've been trying multiple ways and followed this tutorial as much as I could, but I can't seem to get it to work--
make your obj_textbox or any of the things you want to get your character to stop as a children to your obj_pauser
@@deontan602 oh! Thank you for the help, but I actually figured it out myself! Thank you for your help though!
@@viperizer0 could you explain what you did? I'm trying to do this as well
@@holiday_out3740 I’ll try my best! Not gonna lie, I’m still kinda new to coding so I’m not entirely sure why it worked… lol.
In my character’s object step event, this is the code I wrote.
If instance_exists(obj_textbox) && distanceTrigger { move_spd = 0; }
Else { move_spd = 1; }
Keep in mind that in the object areas you have to replace them with whatever you named your stuff… make sure you set the variable distanceTrigger = 2 in the create event…
I think this is all? If not, lemme know and it’s probably not the prettiest way to do this- oh yeah, if you had a sprinting ability it does take that away and I’m not entirely sure how to fix that… but I hope this helps!
@@viperizer0 Thank you! I came up with something super simple.
In the player object step event, before anything else like movement
if ( instance_exists(obj_textbox))
{
exit;
}
and now your player doesn't move while dialogue is active
cheers!
OMFG! I was stuck in a error for hours!!
Anyone who is getting the " var _txtb_x = textbox_x + text_x_ofset[page]; " error, please remember: If you change the " case "npc 1": " in game script, you need to change the new name into the speakblock at your room (text_id)!!!!!!!
I searched about it everywhere and I just realized it abot this now!!!!!
if that doesnt work, try it to put " text_x_offset[0]= 0; " on obj_textbox Create page.
Hope this help anyone, good lucky :)
im trying to figure out how to have it so the right side portraits dont flip, my characters face the camera so its not needed
nvm, i was changing the wrong thing, just change speaker_side[page] to 1 at 9:57, you'll have to mess around with positions a bit
Hiya! Maybe quick question, I have imported art for the sprites/character portraits, is there a way to make it fit into the box for the character speaking even tho it is not 64 pixels?
Hey so my audio stops playing when any one of the . ? ! , appears in the text box, any one know how to fix that?
Got a problem - after implementing this cool pauses - dialogues are looping. Last page (line) of dialogue is endlesly repeating, and/or other pages too.
Maybe someone struggled with similar issue and knows the answer?
Found a source for that:
if keyboard_check_pressed(ord("E")) && distance_to_object(obj_Player) < 10 - object speakblock, in the step event instead of this mouse poisition was put by me... 'cause I want to use only keyboard for operating my game... Now trying to figure it out how to get rid of mouse and this bug when using keyboard!
Hi, anyone knows how i can search for that type of sound effect? i mean, if have a specific name, because i cant find anything like that
I don't know what I did wrong, but when I start the dialogue with an npc, the text flows correctly, and the npc's portrait animation works, but when its the player talking, the text automatically goes to the end of the textbox e the animation don't work. Did you understand my problem? Can u help me?
it's solved 😎👍
@@hayuralves1207 what was your solution? After setting up my arguments in scr_textbox_functions, cases inside of scr_game_text no longer display unless I provide an id for each specific case. It skips over that line of text and continues on unless a sprite is assigned to that scr_text.
Nevermind, after combing through the video several times I found an extra set of { } which I somehow placed inside the scr_game_text...
i am having a problem where the speaker charactor doesn't appear and it takes a random sprite form the files for some reason, anyone can help?
wow i just solved it after i posted this in 5 min, the problem was that i typed in the scr_text at line 7 speaker_sprite = [page_number] = noone;
while it was spoused to be speaker_sprite[page_number] = noone 😭
I don't know if I'll get an answer here but it's worth a shot. I'm using 8 Bit Operator font text (Undertale/Deltarune font) and inserted it exactly as the video says. It writes fine! However, my spaces in between the words seem to be a little short for some reason? In other words, each word is too close to another. It's been almost a year since I followed these tutorials and I finally got back to the project. I can't seem to find a way to make my spaces in between words larger. Any suggestions would be helpful! I've tried making the width of the actual font larger but that didn't seem to help.
Would be better if you tried locally storing the font characters as one big spr_fontmain asset as that allows you to mess with seperation using the font_create_sprite(); function
Hey if anyone could please help me, the left and right sides of the texboxes for the character portraits are showing up squished, and on the options all of the sides are squishes. The options were showing up fine before i wrote this section of code
Many thanks to you!
This is sort of a weird issue, but the local variable I declare with a script seems to override any params I set. Maybe it's a setting I accidentally disabled, but it's pretty annoying.
Here's an example:
/// @param text
/// @param [character]
function scr_text(_text){
When I call scr_text, the bottom of the window will only show scr_text(_text). Does anyone know what I did wrong?
same, have you sloved that prob?
not familiar with gms2, but maybe it should be "function scr_text(_text, [character])"?
Hi¡ I’m having this issue where the dialog and sound is significantly faster on the first page of dialog but it works perfectly second page onwards, anyone knows what might be causing it? 😢
my apologies for asking for help on a video over 2 years old, but when a portrait is drawn, the place of the linebreak isn't adjusted accordingly, meaning the text will go over the edge of the textbox. does anyone have an idea as to how i can adjust the linebreak to be in the correct place? as well, this isnt as relevant to this video specifically, but more the series as a whole, is there a way to have the text aligned to the centre of the textbox as opposed to the left? thank you!!!!!!!!
Did you figure it out? I have the same problem
I figured it out now. After setup is done it needs to switch back to "setup = false" again.
How do I make it so that it plays a random sound from a group on each letter?
you can use choose(...).
I need help, I'm in the part where we make the code to draw the portraits, but my character portrait isn't drawing, or is drawing below the portrait box, what do I do?
Edit: what happened was that the sprite was getting mirrored and blocked by the main text box... maybe I switched up some 1s and negative 1s...
Edit 2: I FIGURED IT OUT, turns out the negative and positives had meaning haha, im dumb, the way i solved the issue is by asking myself randomly "okay i need to add the sprite back to put it in place when it flips... Wait why does it even flip? Theres no code that-" and then i realized! Btw my default is having the portraits on the right side so thats why i had issues
thank you so much! this is fabulous!
IDK if anyone can help me but I have this error and I don't know to fix it
The error: Got "}" (eof) expected } or end. But I have } at the end
can someone help?
I can't really help since I don't have your code and stuff, what I really recommend is going back to the video and speed it up and check if every line is correct
also a tip, everytime you run your project and everything goes good put a comment or mark like "///nothing to check here" under the code you finished so that you don't touch it or mess with it accidentally and to not waste time to go back over the whole video to check all your code, maybe the mistake is something new you added and you just need to go back few steps
not sure if this is it but i had a similar issue and it was because i didn't have the right amount of } around an else statement. It was during the part in the tutorial when we were doing the stopping at "." around 21:00 or so. Not sure if that helps
does anyone have any tips for how to make a character cycle through different lines of dialogue each time you click on them, or how to only trigger certain dialogue options after something else has occurred (ie picking up an item or something)?
very new to gamemaker and this tutorial series has been SUPER helpful, I just find myself getting stuck when I need a certain event to occur before triggering a section of dialogue (or if I dont want the char to keep saying the same thing over and over again)
EDIT: figured out a solution!
if anyone's wondering how to make certain events/new dialogue trigger based on the player's responses, I just initialized a few global variables in the obj_settings create event and you can change them in the scr_game_text function in each specific case.
for ex, I set global.quest = false in obj_settings, and then under the specific case i want to trigger something I changed it to true. example:
case "npc 1":
if global.quest == false
{
scr_text("this text will trigger the quest");
global.quest = true;
break;
}
if global.quest == true
{
scr_text("quest is now triggered!");
break;
}
I'm getting an interesting error where depending on my usage of "npc 1" and "red kid" (my version of blue kid) i can either get the unpersonalized dialogue box w text, options and it all works but no speaker and it's in the middle. OR, I can get the personalized layout correct, but before text appears I get:
Push :: Execution Error - Variable Index [15] out of range [15] - -1.char(100060,15)
at gml_Object_obj_textbox_Draw_0 (line 210) - draw_text( char_x[c, page], char_y[c, page], char[c, page] ######################### gml_Object_obj_textbox_Draw_0 (line 210)
Any help on how I can get them to work at the same time would be really helpful!!!
you forgot a bracket at the end i thiknk
can someone help me there's an echo in the sound when it is typing a text
👏👏👏
Sorry to say this but I can’t do your text boxes tutorial anymore. It’s really hard for me to make my own text boxes look like one from Undertale, considering that for your tutorial, 2 boxes are used for a speaker Sprite being presence but one box for Undertale, or any other fangame. Thankfully, I still managed to make the ones without the speaker Sprites.
im kinda late but how did you manage to do that? (hopefully someone will see this comment)
@ I do feel like if maybe you might have to code on your own for this kind of text box or follow a different tutorial. I had to take Computer Science in university to further enhance my coding skills.
@@jason256-8 ohhh i see... dang 😭
but I'm glad you're properly studying this kinds of stuff! that's awesome!
I love these videos, they've helped so far with my tiny puzzle/ escape room game. However, does anyone know how I can go about using the spr_greenkid/spr_bluekid, ect. as an array to flip through sprites the way we would with the house decorations?
I just spent an hour and a half pulling my hair out trying to figure out why the game was crashing and telling me variables that I definitely set weren't set. Turns out I just forgot to put the text_id in the creation code. Don't code while sleep-deprived, kids.
Was it the text_x_offset that wasn't working for you either?
Hey, I've been following the tutorial and I have a question, my output keeps telling me my "Push :: Execution Error - Variable Index [1] out of range [1] - -1.textb_spr(100007,1)". I'm fairly new to gamemaker/coding in general so I am so confused on what this means. It referencing this:
"textb_spr_w = sprite_get_width(textb_spr[page]);"
And I know that the error has something to do with the array I set for my textb_spr variable, but for the life of me I can't figure it out! I have an array there which is exactly the same as what he set!
So, I don't know what I'm doing wrong!
I also have this error too :( Did you manage to find a solution for this?
same error, I will get to you if I found it lol
@@loutrechan8332 did u find it
omg i have the exact same error as well ;-;
EDIT:
I found a fix, but its gonna need sacrifice. I don't know why it isn't working normally, but here it is:
Replace all the txtb_spr[page] arrays with txtb_spr[0] in the draw event, atleast thats how i fixed it
the sacrifice is that you cant get anymore custom backgrounds for different characters... it can still look cool but not in that way
Cool!
can someone help me? I'm having this error with the speaker_sprite != noone
___________________________________________
############################################################################################
ERROR in
action number 1
of Draw Event
for object obj_txtbox:
trying to index a variable which is not an array
at gml_Object_obj_txtbox_Draw_0 (line 122) - if (speaker_sprite[page_number] != noone){
############################################################################################
gml_Object_obj_txtbox_Draw_0 (line 122)
and, yeah, I tried with speaker_sprite[page] != noone {, but it doesn't work either. I tried changing the [page] with [page_number] just in case
easy fix! instead of using [page_number], use (speaker_sprite[argument[2]]), which is an array!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thx!!@@sillylittleboy6361 could you help me with smth else too? I'm trying to do a cutscene that goes like- "Text", "Image" & "Another text" on top of the image. I have no problem with the first text appearing automatically and disappearing, but I can't make the image appear.
I set a variable that, when the script marks it as true, the text disappears. Not only that, but I tried to do the same with the create_image_ext, but it didn't worked.
Idk why but my audio loops infinitely, someone is having this same problem? I know i'm a bit late for ask this lol
you can do smth like
If !audio_is_playing(your audio Index)
{
//Sound system or smth
(Your sound system right here)
}
19:00
25:44
I'm really hoping someone sees this comment because I can't figure out for the life of me to have it to work so that instead of interacting in this practice room, it will show text when I interact with objects or NPCS in my actual game. Any ideas please I have actually shed tears over this now.
is anyone else getting the error "Variable .text_x_offset(100089, 0) not set before reading it.
at gml_Object_obj_textbox_Draw_0 (line 185) - var _txtb_x = textbox_x + text_x_offset[page];"
nvm im an idiot found a comment that explained it
@@nesciovir7750 where
@@nesciovir7750 what was the answer??
@@stormstudios1 so basically you need to give the child object the text variables. it been a minute but you need to make sure in the creation code of your CHILD object (the one your pc is interacting with, not the parent) has what it needs because thats what gives "text_x_offset" its value, otherwise it will be null and the program will freak out.
thats atleast what my problem was.
@@nesciovir7750 ?
Umm I broke somthing
############################################################################################
ERROR in
action number 1
of Draw Event
for object ObjectTextBox:
Variable .text_x_offset(100069, 0) not set before reading it.
at gml_Object_ObjectTextBox_Draw_0 (line 167) - var _textbox_x = textbox_x + text_x_offset[page];
############################################################################################
gml_Object_ObjectTextBox_Draw_0 (line 167)
18:59