Introduction
Sometimes you just need NPCs to say random stuff. Not completely random, per say, but for example, let's say you have an NPC who shares rumors with the player. As long as said rumor is unlocked, you don't care which rumor the NPC cares to share. Likewise, you may have a series of lines kids can say "you look funny!", "Mister, where do babies come from?" or something else inane. You might even have the kids say smart things. But again, you simply care that one intelligent option is chosen, not which specific line activates. While you can do all of this manually using conditional branches... you can also use this script and not have that nasty conditional mess to check every time something goes wonky. This script takes care of all the issues above for you, so you can spend less time checking random kid 36b says the right thing. In fact, this can even be used to improve world immersion, as your NPCs will now say different, but appropriate things!
Features
Select a dialogue line at random from a series of dialogue lines. This has many uses, but for example, allows you to easily replicate Fi's "rumors" system from Skyward Sword.
Dialogue lines can be limited based on real-time conditions - for example, "I know where the cave is" will only show if a game switch is active, which indicates the player has heard about the cave.
Dialogue lines separated into categories and topics. This means you can have rumors, game tips, and a whole bunch of other stuff in rumors.json, and select "rumors" to only choose from rumor dialogue lines.
Random dialogue lines use the message box without additional modification, so any changes to the message box you make before calling the Plugin Command (position, windowskin, etc.) will carry over to affect the appearance of the dialogue lines.
Dialogue lines can be restricted by a further condition - "available" is intended to track when a line is unlocked (for example, if the player kills a bandit, dialogue about that bandit being dangerous won't show). "restriction" is intended to further restrict dialogue lines to be appropriate to a speaker. For example, you can use a game variable with a manually tracked index (ie. Widow = 1, Guard = 2, Veteran = 3), so that an NPC will not say a random line that would be out of character.
Random will now avoid consecutive repetition of a given dialogue line, provided more than one random dialogue line is available to choose from.
Faceset support!
NPCs will not resume movement while a random dialogue line is displayed.
Plugin now displays user-friendly error messages for an incorrect number of parameters, misspelling of command, etc.
Plugin now supports case insensitive checks (requires rumors.json having all Category and Topic values in lower-case).
Screenshots
None.
How to Use
Copy script into your game js/plugins directory.
Create a Rumors.json file in your game data directory.
Import this script into your project and set all two parameters.
Use the Plugin Command to get a random dialogue line output into message box.
Known Bugs / TODO Make your suggestions or report bugs here!
Requirements
Yanfly's Message Core plugin - YEP_MessageCore.js. Set the "Word Wrap" plugin parameter to true.
History Spoilerv1.03a - Fixed bug with availability and restriction conditions due to shortlist caching. v1.03 - Category and Topic search now has added case insensitivity mode for more user-friendly usage. v1.02a - Fixed typos and bugs courtesy of Steffen (Anthony Xue). Thanks man! User friendly check added for # args. v1.02 - Added in lastconv check to avoid repeating random dialogue when other entries can be played instead. v1.01a - Finally found out and documented how to add \... codes as in native Messagebox. - Common misspelling now detected to be more developer friendly. v1.01 - Faceset and faceNum are now optional parameters. - Squashed some bugs. - Fixed the last few documentation errors. v1.00a - Fixed documentation errors. v1.00 - Plugin released.
Suggestions, bug reports, and feature requests are welcomed!
Compatibility Issues None known. Compatible with Klaus Map Overlays, Terrax Lighting System, and most (if not all) of Yanfly's plugins.
FAQ Q: The demo won't open, how to open it?
A: Download Winrar and try again.