SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Releases > Lua

Reply
 
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 dialogue.zip (6.3 KB, 92 views)

Screenshots

Click image for larger version

Name:	srb20008.png
Views:	996
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.

Comments
Old 06-22-2016   #2
Wolfy
wolfs
Developer
 
Wolfy's Avatar
Default

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

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   Reply With Quote
Old 06-22-2016   #4
Joat
Gum Phoenix
 
Joat's Avatar
Default

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   Reply With Quote
Old 01-05-2017   #5
LunarDestroyer
 
LunarDestroyer's Avatar
Default

Code:
//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
            dialogueHandler(p)
        //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.
        else
            p.normalspeed = skins[p.mo.skin].normalspeed
            p.jumpfactor = skins[p.mo.skin].jumpfactor
            p.charability = skins[p.mo.skin].ability
            p.charability2 = skins[p.mo.skin].ability2
        end
        p.oldButtons = p.cmd.buttons //Keep the oldbuttons variable up to date.
        p.oldForwardMove = p.cmd.forwardmove //Keep oldForwardMove up to date.
    end
end)
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   Reply With Quote
Old 01-05-2017   #6
*icefox*avp*
Or call me Revan
 
*icefox*avp*'s Avatar
Default

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.
__________________
Want dedicated Graphics for a low price?

Click this link!

THE RICE FIELDS!
*icefox*avp* is offline   Reply With Quote
Old 07-29-2017   #7
Joat
Gum Phoenix
 
Joat's Avatar
Default

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   Reply With Quote
Old 4 Weeks Ago   #8
nightrider184
DAYTONAAAAAAAAAAAAA
 
nightrider184's Avatar
Default Potential

This actually could be used in some sort of custom mission mode or something. Looks promising!
nightrider184 is offline   Reply With Quote
Reply

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 05:32 PM.


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