Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[// YOU CAN COPY THIS INTO YOUR SCRIPT FOR EASIER REFERENCE:
- This Dialogue module is inspired by the way the Ren'Py visual novel engine formats its scripts.
- You may want to read up on that, as well as have some scripting knowledge up your sleeve to properly use this module.
- - for reference, stuff is named: serial? = { dialogue = {scene = {{line}; {line};}} }
- - to add random dialogue choices, do [1] = {(dialogue here)}, [2] = {(dialogue here)}, etc. If not you should remove the indices entirely.
- - each dialogue must have a scene named "START"; it will be the first one iterated.
- - Settings -> optional settings table, values inside are also optional:
- - UseProximityPrompt [false] -> self-explanatory. *DEFAULTS TO CLICKDETECTOR IF FALSE*.
- - CancelDistance [0] (NEEDS OBJECT) -> studs from the physical dialogue source, when exceeded will auto-cancel the dialogue. Set to 0 to disable.
- - NoCancelling [false] -> self-explanatory
- - NoSkippingText [false] -> disable clicking the text to skip typewriting. for lazy people.
- - Autopilot [0] -> disable advancing lines, instead waits the defined time before automatically advancing. overridden by _timer.
- - FreezePlayer [false] -> players can't move when dialogue is active.
- - DisableCoreGUI [false] -> disables *all* coreGUIs e.g. leaderboard (preferably for more cinematic scenes).
- - Elements in a scene are either:
- - a line, e.g. -> {str = "hello!"}
- - an anonymous function which can do anything really
- - including yielding, e.g. -> function() task.wait(3) print("function just yielded!") end
- - there will be a loading sequence for text ('' > '.' > '..' > '...') if the function does yield; you can also use that to add conversational pauses
- - to run the function parallel to the next line, do coroutine.create(function() .. end); DialogueScript will resume them.
- - or conditions RETURNING LINES, e.g. -> function() return if b then {str = "b true!"} else {str = "b false!"} end;
- - you can execute whatever before returning the line, it doesn't matter
- - Each line can optionally have:
- - str -> Text said by the speaker, does not necessarily need to be defined. Should be defined first in the line for readability.
- - speaker -> The person speaking: Not necessary if the previous line's speaker is the same.
- - just set it to "" for narration/soliloquies.
- - choices -> spawns choices on click jumps to specified sceneToJumpTo.
- - in format {["choice1"] = "sceneToJumpTo", ...}
- - if sceneToJumpTo = "CONTINUE", then it continues to the next line without changing scenes.
- - (from a developer standpoint "CONTINUE" could just be nil, but that's messier)
- - pretty niche but choices also supports functions, e.g. -> {["func_choice"] = function() ... return "scene2" end), ...} (use this as you will)
- - jump -> simply jump to specified scene
- - (lines which don't lead to anything else will end the dialogue!)
- - line settings (put it as extra arguments)
- - _basespeed [0.02] -> delay of the next *character* appearing during typewriting.
- - changing this number also proportionally changes punctuations' delay of 0.18, (calc'ed as base * 9)
- - _timer [0] -> force-skip to the next line after waiting the specified time, instead of waiting for a player click.
- - has priority over choices: they must be made before the timer runs out, otherwise it'll just continue to the next line.
- - _delay [0] -> yields the specified time before typewriting, playing the "..." loading sequence.
- * rich text is supported for ALL seen text, including the speaker's TextLabel.
- ** you can use _G.DialogueRepository for globally shared variables — you figure that out.
- >>> This module allows for a lot of creativity. You do you, have fun!
- //]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement