Random Dialogue v1.03a
Author: Michael Morris
@Blue Booth Studios
Demo thanks to Anthony Xue:
http://ancient-architects.com/files/Conversation Demo.zip
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.
Demo
Thanks to Anthony Xue, a demo is available here:
http://ancient-architects.com/files/Conversation Demo.zip
Create a new project, and then extract this archive into that new project.
Script
Spoiler Code:
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.
Credit and Thanks
- Micheal Morris @Blue Booth Studios
- Credit to Tsukihime for continuing to be so helpful!
- Special Thanks to Anthony Xue for bug fixes and documentation help.
- Iavra for the JSON handling code, based on that from achievements.js.
Author's Notes
Free for non-commercial usage as long as credit is given, contact me for commercial use.
本贴来自国际rpgmaker官方论坛作者:bluebooth处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/random-dialogue-v1-03a.57313/