SRB2 Message Board  

Go Back   SRB2 Message Board > Archived > Outdated Releases (2.1.X) > Lua (2.1.X)

Thread Tools
Simple Dialogue System Details »»
Simple Dialogue System
Version: 1.0.1, by Joat (Gum Phoenix) Joat is offline
Developer Last Online: Sep 2017

Category: Version: SRB2 Rating: (1 votes - 3.20 average)
Released: 06-18-2016 Last Update: 06-21-2016 Installs: 0
Scripts Re-Useable Content Sprites/Graphics

This is a simple dialogue system for SRB2. The top box shows the text being spoken to the player, while the bottom box has up to four options they may choose from for a response. A chosen response may result in further conversation, ending the conversation, or a function being executed.

Included in the LUA script is the dialogueTest function (and a call to it using the MapLoad hook), which describes, in comments, how to properly format the dialogue. I do hope I made things sufficiently clear in the comments, but I shall be the first to admit that I am a rather lousy teacher, so if anything is unclear, please tell me and I shall make adjustments to rectify that.

As a side-note, also included are the dialogue box graphics shown in the image (which, to give credit, are created from the BRDR graphics in srb2.srb), which is why this is in the form of a .wad file, rather than simply a .lua one.

As a final note, though, I shall point out that this script should be used very carefully. As the wiki points out, "Sonic the Hedgehog, SRB2 included, is about flow", and inserting dialogue into a level is a good way to stop that flow dead in its tracks.

Download Now

File Type: zip (6.3 KB, 390 views)


Click image for larger version

Name:	srb20008.png
Views:	1729
Size:	5.6 KB
ID:	8311  

Show Your Support

  • The author of this addon has given explicit permission for its content to be re-used and/or reproduced.

Old 06-22-2016   #2
Wolfy's Avatar

Welcome to releases!
[23:56:36] <SM-MaxX> prisma illya is a gift to this impure earth and a shining beacon for all anime
Wolfy is offline  
Old 06-22-2016   #3
LJ Sonik

The script is actually a good idea, but I would like to point out that calling hud.add in a MapLoad hook is a very bad idea, as it'll create a new HUD function everytime you reload the map. Which means if you load the map ten times, it'll display the exact same thing ten times when only one is needed. It's visually invisible to the player, as the dialogue will just override the one that was just drawn, but it'll result in the framerate dropping more and more each time you reload the map. I recommend calling hud.add only once and changing its behavior depending on the map or something similar.

Last edited by LJ Sonik; 06-22-2016 at 12:20 PM.
LJ Sonik is offline  
Old 06-22-2016   #4
Gum Phoenix
Joat's Avatar

Apparently, the solution was to just have the hud.add outside of any function or hook, simply running as soon as the script is loaded, before the gameplay officially starts. I did not call that. In any case, I have uploaded a corrected file.

On another note, I have also made it so that the "you have selected a different item, good job, give yourself a gold star" beep does not occur if there is only one item to choose from.
"Your friend is that man who knows all about you, and still likes you." - Elbert Hubbard
Joat is offline  
Old 01-05-2017   #5
LunarDestroyer's Avatar

//To handle input and stop the player from moving around when selecting an option.
addHook("ThinkFrame", do
    for p in players.iterate()
        //Handle if dialogue is currently open.
        if p.conversation != nil then
            //Stop the character from moving.
            p.normalspeed = 0
            p.jumpfactor = 0
            p.charability = 0
            p.charability2 = 0
        //Otherwise, set speed, jump height, and abilities back to normal. For this reason, this script does not play nice, by default, with anything that alters any of these.
            p.normalspeed = skins[].normalspeed
            p.jumpfactor = skins[].jumpfactor
            p.charability = skins[].ability
            p.charability2 = skins[].ability2
        p.oldButtons = p.cmd.buttons //Keep the oldbuttons variable up to date.
        p.oldForwardMove = p.cmd.forwardmove //Keep oldForwardMove up to date.
This is a pretty huge bump, but I had just thought of this, and figured it was worth bringing up. Wouldn't a fairly simple fix to this be to save the player's stats to variables (or a table, if you want to be fancy) before overwriting them, then, when the menu is closed, replace the player's stats with the ones saved from before? The only possible problem with that solution that I could think of is if Speed Shoes directly modify the player's stats in order to achieve their effect, and that probably wouldn't be too difficult to find workarounds for (You could check and see if the player has speed shoes when saving the variables and adjust accordingly, that would probably work.).

In any case, if anyone is looking to implement this into something and wants to also provide support for scripts that modify the player's stats, this is something to keep in mind.
LunarDestroyer is offline  
Old 01-05-2017   #6
Or call me Revan
*icefox*avp*'s Avatar

I just like how this lua deeply reminds me of Strife's dialogue, perhaps the idea was from there so that's why I see it in Zandronum and here now.
*icefox*avp* is offline  
Old 07-29-2017   #7
Gum Phoenix
Joat's Avatar

Good heavens, it's been a long time since I showed signs of life here! These changes are long overdue.

I have changed the script in accordance to LunarDestroyer's advice. I have also added in the capacity to have more than four response options.

EDIT: I almost forgot to mention. Speed shoes do not modify p.normalspeed.
"Your friend is that man who knows all about you, and still likes you." - Elbert Hubbard
Joat is offline  
Old 10-21-2017   #8
Locked User
Default Potential

This actually could be used in some sort of custom mission mode or something. Looks promising!
nightrider184 is offline  
Old 09-01-2018   #9
The Imaginator
Dee's Avatar

I like all the outcomes of the inputs! Keep it up!��
I'm working on a pencil mod.
Goes by "Red" in online matches.
Dee is offline  
Old 12-18-2018   #10
Xelork is Happy to see you.
Xelork's Avatar

I said something about an error but just nvm this, nice wad also
Xelork Made this.

Last edited by Xelork; 12-18-2018 at 03:12 PM. Reason: nvm i solved it
Xelork is offline  

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:40 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.