- Title: Example-Dialog
- Description: A dialog system that supports multiple choice questions, text input and more
- GM Version: GM:Studio / GM8(.1)
- Registered: Yes
- File Type: .gmz / .gmk
- File Size: 3 MB
- File Link: (Mediafire): GMZ | GMK
- Required Extensions: None
- Required DLLs: None
- Tags: dialog, message, question, input, textbox, pause
A while ago I made a [url=http://gmc.yoyogames.com/index.php?showtopic=519406]simple dialog system, which seemed to be quite useful for many. I decided to improve upon it and created this.
Unfortunately it is not compatible with the old one so if you are switching over you'll have to rewrite a whole bunch of code... But it has a lot more features! These features include:
- Basic messages, that just have text
- Different coloured text within one message
- Different sized text within one message
- The speaker's name separated from the rest of the message
- 2 spots for images of the character to appear behind the message. See image below
- These images can slide in, and be animated
- Automatic line wrapping, even splitting extremely long messages into multiple boxes
- Text appearing letter by letter, with variable speed and skip to end
- Beeping noise while text is appearing, and when messages close
- Questions with multiple options (up to 15)
- Text input for things like names
- Confirmation for both forms of input
- Stuff triggered by messages
- Variables in messages
- Support for importing dialog from an external .ini file. Good for multilingual games
- Pause the rest of the game while dialog is visible, and darken the surroundings
It works by storing messages in a ds_queue. The sprites, speaker, and coloured/resized text are encoded into the same string, so it only requires one value for each message. Questions and text input are all handled in the same place, and can trigger more dialog messages seemingly seamlessly.
It pauses the game by creating a sprite from the screen using sprite_create_from_screen(), then deactivating all instances except any controllers you might have. It then draws this sprite and the dialog in the Draw GUI event so that it never gets covered by anything else.
A note to users:
Implementing the system directly into your game is not particularly difficult, as it only relies on the fact that you have a Controller object. If you do not have a Controller object, you should, and can either make one or move the code from the example's Controller object to the DialogController.
A few things that you might easily miss
- There are constants. Don't forget to import them to your game.
- The Controller must be behind the DialogController, in terms of depth, to ensure drawing success
- The Controller and DialogController objects are persistent and should be created in the first room
- If you are wondering why you never see rSetup in the game, check the room's Creation Code on the Settings tab of the room editor
Here is an image of the engine in action:
Other things you could possibly learn from this engine are grid based movement, and how to pause the game.
Edited by thegame, 30 June 2015 - 12:08 AM.