How do i do rpg dialogue


#1

I’m having trouble with simple dialogue. I simply want dialogue to start happening when my player collides with an object. every time I tap the dialogue I wanted to continue to the next part or next sentence.

I don’t see any straightforward way to do it which I do believe should be implemented (directly) because I understand a lot of things about the engine but yet I cannot figure out something so simple.


#2

Unfortunately, there’s nothing built in to handle dialogue at this point. You’d have to come up with a way to workaround it using the available objects and events for now. I can’t guarantee that my suggestions will be simple to do, but maybe they can give you some ideas anyway.

I would probably try to use one text object named “dialogue” (otherwise you might end up with a long, overwhelming list of text objects), assign IDs with object variables, and use “modify text” events to make it say what you want when the conditions are met. You can then control whether the objects are shown, hidden, or changed based on collisions and mouse/cursor conditions.

I’ve been working on something similar to control NPC speech in my game, except it’s mostly done with timers and ID’s that are randomized within a range - this works fine for what I’m trying to do, but your idea will have to be handled differently.


#3

How do I do timed dialogue can you post a screenshot or link?


#4

In my case, I have the text object appearing above the head of my NPC character, so the events look like:

No conditions
Actions:

Put text object around character with an angle of 270 degrees and 80 pixels distance
Align text object “center”
I also use a shadow style on the text, but this is optional

On a new line
Condition

Variable id of character object is = 0

Action

Do “Text string, a default greeting or intro” to the text of text object

New line
Condition

The timer “character_speech” is greater than 10 seconds

Actions

Do (RandomInRange(1,6) to variable id of text object
Reset timer “character_speech”

New line
Conditions

& If all of these conditions are true:
Variable id of text object is = 1
The timer “npc_speech_one” is greater than 6 seconds

Actions

Do “text string” to text object
Reset the timer “npc_speech_one”

Repeat that last block for every ID number and adjust as desired.

Notes:

  • In my case, I currently have it cycling through 6 different phrases. If you have more, you’ll want to edit the RandomInRange expression to reflect how many you have (i.e., for 10, it should look like (RandomInRange(1, 10)).
  • I have the first timer set to be longer than the others because it takes the player a while to reach this character’s position and there’s no collision; you can probably still add collision events to trigger speech though.
  • Make sure each phrase has it’s own variable ID and timer name. So the next should be id = 2 and timer name “npc_speech_two”, and so on. I use the actual name of my character object though, to avoid a conflict in case I have another character to do speech for.

I hope that helps! :slight_smile:


#5

Found a way simpler but thanks


#6

Can you share the simpler way for others who would like to add some dialogue to their games?


#7

New beta 80 introduces a dialog system. I haven’t tried it yet, but take a look :slight_smile:


#8

Ooo! Awesome, thank you for the heads up :slight_smile: