RPG Dialogue Help


#1

Sorry, I’m a complete noob at creating games in general but I hope to get better in the future.

I’m making an RPG in GDevelop 5 but I’m not sure how to advance conversations. To move to the next dialogue, I set it so you have to press A, but I found that this skips all the way to the last dialogue box. I tried setting variables (Do + 1 to variable Conversation of Text) but it also has the same problem. I could use a timer but I’m not sure how to use that effectively.

I found a question similar to this (Help with Dialogue) but the answer has a link which leads me to a 404.

Could anyone help me with this? Sorry if the answer might seem obvious :sweat_smile:


#2

Try to add Trigger Once to the condition, so the event going to be triggered only once when the A key is pressed.

trigger-once


#3

So I added Trigger Once to condition and it worked for conversations with only 2 text boxes, but for conversations with 3 text boxes it skips the text box in the middle.

Instead of
“This is dialogue #1” >> “This is dialogue #2” >> “This is dialogue #3
It gives
“This is dialogue #1” >> “This is dialogue #3

I am using a variable (Conversation) that adds + 1 to every consecutive text box so it goes in order


#4

Could you show a screenshot of the events you use?


#5


Sorry if it’s messy, I am not super familiar with the coding of GDevelop yet (Context: the text object DialogueText is already set to “This is dialogue #1” by default)


#6

The problem is that, when you press the A key, the first event execute, increase the variable by 1 and then immediately after, the second event also execute because all condition is true for the first time and increase the variable by 1 again and immediately after execute the third event because the condition is true again, this is why it skip it.

What you need to do, instead of using the Trigger Once, in this case would be better to create a switch to avoid multiple events execute the same time and make sure only 1 execute at the time.

Event1
If ‘a’ key is RELEASED : Do = 0 to scene variable Switch

Event2
If ‘a’ key is pressed
If scene variable Switch = 0 : Do all that and Do = 1 to scene variable Switch.

Event3
same

Event4
same

This way only 1 event can execute any time the A key is pressed and only once.


#7

I think I did something wrong but I’m not sure what I did. When this code runs only the first text box (this is dialogue text #1) appears, and when I press the keyboard again it does not continue the next text box (I replaced all Trigger Once conditions with Scene Variable conditions)


#8

Is the player colliding with the computer? You move the player away. Try to check distance instead of collision.

If Player distance to Computer is below 100 pixels
—if ‘a’ key is pressed…etc

Also, move the event with the key release condition outside to make sure you reset the switch variable also if the player is not near a computer.

Event1
If ‘a’ key is released : DO = 0 the scene variable Switch

Event2
If Player distance to Computer is below 100 pixels
—if ‘a’ key is pressed…etc

EDIT:// I realize checking the distance is going to cause a bug since you disable the default controls on pressing ‘a’. So you probably want to consider to use a different key either for dialog or player control instead of disabling controls on interaction with computer. It would be the most simple solution.

If you don’t want the player to be able to move while interacting, disable player controls while the dialog is shown and enable it once the player close the dialog. Put the dialog on a separated layer than you can simply check if dialog layer visible or not. If visible, disable controls, if not visible, enable it but use different controls for the two. Using either ‘E’ or ‘ENTER’ or ‘SPACE’ key for interaction is often used in games.


#9

Alright so I think I misunderstood your instructions or something else is wrong, but either way it still is only displaying the first text box ("This is dialogue text #1)


#10

Let’s remove all the useless stuff, ok? :sweat_smile:


#11

Ah ok I think I solved the problem now :slight_smile: Sorry for overcomplicating things :stuck_out_tongue:


#12

Sorry for bumping up this thread again. This question is related to RPG Dialogue as well, so I guess I’ll post it here.

So I got the basics of creating an RPG Dialogue box down, but I’m having a minor issue regarding the text. When interacting with NPC1, there are 4 text boxes: (‘This is dialogue box #1’, ‘This is dialogue box #2’, etc) These are triggered in consecutive order using a scene variable (see Gruk’s post) and at the end, once scene variable = 5 it resets back to 0 to restart the text boxes


Thing is when talking to NPC1 again, the 4th text box quickly previews before going back to the 1st text box. Is there a way to remove this?


#13

try with the code for npctext= 5 as the first
the 1,2,3 and 4


#14

Unfortunately it didn’t seem to solve the problem when I put the NPC1Text = 5 first


#15

ok try adding runonce on keypress release


#16

The old text shows because you have separate actions for Return pressed and Return released.
I suppose you can move the “Show layer” to the “Return released”, or you can delete the text after hiding the layer…