设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 69|回复: 0

[转载发布] DeadlyEssence01 Immersive Dialogue - v1.01

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    8006

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    30019
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38919

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    DE Immersive Dialogue | v1.01
    DeadlyEssence


    Introduction
    This plugin allows for implementation of random or sequential dialogue pulled from a txt file so you can easily create a batch text / random text. You can specify subfolders and file names, so each command can have a different text file it reads from.You can use yanfly's text codes and macros with this plugin, I have a long plugin list and have not found an incompatibility or issue yet.


    Updates:
    v1.01 - Random Dialogue doesn't repeat.
    - Added an optional parameter to know which random message the plugin displayed.

    Features
    - Read a txt file of dialogue.
    - Plugin command allows you to specify different files for each command / and pull text files from subfolders.
    - Pull random dialogue from a list of options.
    - Does support using face images.
    - Is compatible with most? of Yanfly's plugins.
    - Random dialogue doesn't repeat last used dialogue message.
    - Show message number of displayed random dialogue

    How to Use
    Download the .js and put it in your plugins folder for your project.

    You do not have to set the parameters if you don't want to...
    If you want to know which message was displayed when using random dialogue, set a gamevariable in the parameters for "dialogue variable" the plugin will push the message number it displayed to your variable to allow for eventing checks.


    1. Create a new folder in your project's data folder, name it dialogue.
    2. Create a new text file, do not use spaces. The file name will be needed for the plugin command.
    3. Insert your dialogue, being sure to use "//" to separate messages.

    EX:  (you can copy and paste below if you need...)

    Howdy
    //Heyo!
    //Long time no see!
    //Fancy seeing you here.

    Or batched text: (without word wrap that should fit in the box)

    This is the very first message, that appears in the
    message box. And here is some filler continuation
    words. You can go beyond the four lines of text
    for this, it will automatically batch the text for
    you so that it shows.
    //And this is message two.


    Note: Pressing enter will make a new line break, or you can use Yanfly's <WordWrap>. With word wrap, you can just put the whole message on a single line.


    Using Subfolders:
    If you'd like to use subfolders, your filename should preface with the subfolder name and a / before the actual filename.
    Ex: subfolder/EnoAmsir.txt
    Ex: newfolder/HaroldDialogue.txt

    Plugin Commands:

    Sequential Dialogue Command

    Dialogue will read the dialogue in order, for the number of lines specified.

    dialogue [FILENAME.txt][lineNumber] [lineCount] [faceImage filename] [faceIndex number]

    EX: dialogue NiraAmosirNeutral.txt 0 3 NiraAmosirFace 0
    EX: dialogue Gossip.txt 0 3

    - Filename should be the name of the .txt file you are trying to pull from the dialogue folder. Be sure to include .txt or it will not work.
    - LineNumber is the line of text you want to start on. 0 is the first line!
    - LineCount is the number of lines to read. 0 will only show the line specified in lineNumber. 1 will read the next line in the file too.
    - Faces: If you want a face image to appear put the name of the file, without the .png. The face index is the number slot the face appears in on the png file. Remember, the left top is 0, not 1.

    - If you don't want to count lines, I suggest using Notepad++ it will automatically number the lines for you. However, subtract one from the number on the left.

    Random Dialogue Command:
    Random dialogue will give you a random response from your text file.

    randomdialogue [FILENAME.txt] [faceImage FILENAME] [faceIndex number]

    EX: randomdialogue Introductions.txt
    EX: randomdialogue Introductions.txt NiraAmosirFace 0
    EX: randomdialogue HaroldDialogue.txt Actor1 0


    - Filename should be the name of the .txt file you are trying to pull from the dialogue folder.
    - Faces: If you want a face image to appear put the name of the file, without the .png. The face index is the number slot the face appears in on the png file. Remember, the left top is 0, not 1.

    Script

    Spoiler                Code:       
    1. //===================
    2. // DeadlyEssence01 Immersive Dialogue v1.01
    3. //===================
    4. var Imported = Imported || {} ;
    5. Imported.DE_ImmersiveDialogue = true;
    6. var DE_ImmersiveDialogue = DE_ImmersiveDialogue || {} ;
    7. DE_ImmersiveDialogue.version = 1.01;
    8. /*:
    9. *
    10. *@plugindesc Allows for random or sequential dialogue through a txt file. Easily batch or randomize text.
    11. * @author DeadlyEssence01
    12. *
    13. * @param Dialogue Variable
    14. * @type variable
    15. * @desc If using random dialogue, the plugin will print the random message number chosen to your determined variable. 0 = not in use.
    16. * @default 0
    17. *
    18. * @help
    19. *===================
    20. * Info:
    21. *===================
    22. *
    23. * This plugin is compatible with (I believe) all of Yanfly's plugins.
    24. * All text codes are supported. You also have the ability to use <WordWrap> from Yanfly's messagecore. This plugin should be put after Yanfly's to use Yanfly's textcodes.
    25. *
    26. *===================
    27. *Instructions:
    28. *===================
    29. *
    30. * 1. Create a new folder in your project's data folder, name it dialogue.
    31. * 2. Create a new text file, do not use spaces. the file name (including .txt) will be needed for the plugin command.
    32. * 3. Create your dialogue.
    33. *
    34. *Input your text in the new text file:
    35. * Howdy
    36. * //Heyo!
    37. * //How are you doing???
    38. *
    39. * Note: Pressing enter will make a new line break, or you can use Yanfly's <WordWrap>. With word wrap, you can just put the whole message on a single line.
    40. * Make sure to start each new message with //
    41. *
    42. * SUBFOLDERS:
    43. * If you'd like to use subfolders, your filename should preface with the subfolder name and a / before the actual filename.
    44. * Ex: subfolder/EnoAmsir.txt
    45. * Ex: newfolder/HaroldDialogue.txt
    46. *
    47. *Some uses for this plugin...
    48. *
    49. *Create generic text for citizens, put all generic intros in an intro file, and let the plugin pull a random one. Just specify the actor image in the event's plugin commmand. Event all  * your conditional statements.
    50. *
    51. *Give characters more depth by giving them their own random dialogue file. For extra depth, set conditional branches on various game variables to pull different dialogue files.
    52. *
    53. *
    54. *===================
    55. *Plugin Commands:
    56. *===================
    57. * --------------
    58. * dialogue [FILENAME.txt][lineNumber] [lineCount] [faceImage filename] [faceIndex number]
    59. * --------------
    60. *
    61. * EX: dialogue NiraAmosirNeutral.txt 0 3 NiraAmosirFace 0
    62. * EX: dialogue Gossip.txt 0 3
    63. *
    64. * dialogue will read the dialogue in order, for the number of lines specified.
    65. *
    66. * Filename should be the name of the .txt file you are trying to pull from the dialogue folder. Be sure to include .txt or it will not work.
    67. * lineNumber is the line of text you want to start on. 0 is the first line! line count is the number of lines to read. 0 will only show the line specified in lineNumber. 1 will read the * next line in the file * too.
    68. * If you want a face image to appear put the name of the file, without the .png. The face index is the number slot the face appears in on the png file. Remember, the left top is 0, not 1.
    69. *
    70. * If you don't want to count lines, I suggest using Notepad++ it will automatically number the lines for you. However, subtract one from the number on the left.
    71. *
    72. * OR
    73. * --------------
    74. * randomdialogue [FILENAME.txt] [faceImage FILENAME] [faceIndex number]
    75. * ---------------
    76. *
    77. * EX: randomdialogue Introductions.txt
    78. * EX: randomdialogue Introductions.txt NiraAmosirFace 0
    79. * EX: randomdialogue HaroldDialogue.txt Actor1 0
    80. *
    81. * Random dialogue will give you a random response from your text file.
    82. *
    83. * Filename should be the name of the .txt file you are trying to pull from the dialogue folder.
    84. * If you want a face image to appear put the name of the file, without the .png. The face index is the number slot the face appears in on the png file. Remember, the left top is 0, not 1.
    85. *
    86. *
    87. *===================
    88. *Terms of Use:
    89. *===================
    90. *
    91. * Free for commercial or non-commercial projects.
    92. * You may edit this plugin to fit your needs, but please do not redistribute it. You may make an extension plugin and link it in the forums if you'd like to share changes/alterations.
    93. *
    94. *===================
    95. *Changelog
    96. *===================
    97. *
    98. *
    99. * v1.01 No more repeated randoms. Added variable to display number of random message shown.
    100. * v1.00 Released plugin!
    101. *
    102. */
    103. (function() {
    104.     "use strict"
    105.     var _params = PluginManager.parameters('DE_ImmersiveDialogue');
    106.     var _dialoguevariable = Number(_params['Dialogue Variable']) || 0;
    107.     var _lastUsedRandom;
    108.    
    109.     var DE_ImmersiveD_PluginCommand = Game_Interpreter.prototype.pluginCommand;
    110.     Game_Interpreter.prototype.pluginCommand = function(command, args)
    111.     {
    112.         DE_ImmersiveD_PluginCommand.call(this,command,args);
    113.    
    114.         if (command === 'randomdialogue') {
    115.             var filename = String(args[0]);
    116.             var faceImage = String(args[1]);
    117.             var faceIndex = parseInt(args[2]);
    118.       
    119.         var xhr = new XMLHttpRequest();
    120.         xhr.open("GET","data/dialogue/" + filename, false);
    121.         xhr.send(null);
    122.         var fileContent = xhr.responseText;
    123.       
    124.         //divide up the txt file into an array based on //
    125.         var dia = fileContent.split("//")
    126.       
    127.         //set face image if there
    128.             if (args.length > 1) {
    129.             $gameMessage.setFaceImage(faceImage, faceIndex);
    130.             }
    131.       
    132.         //Choose and display random dialogue message.
    133.         var line = Math.randomInt(dia.length); if (_lastUsedRandom === line) { if (line + 1 > dia.length) {--line;} else if (line - 1 < 0)  {++line; } else { line + 1; } }
    134.         var msg = dia[line];
    135.         this.setWaitMode('message');
    136.         $gameMessage.add(msg);
    137.         setDialogueVariable(line);
    138.         _lastUsedRandom = line;
    139.     } //end if random dialogue command   
    140.         if (command === 'dialogue') {
    141.             var filename = String(args[0]);
    142.             var line = parseInt(args[1]);
    143.             var lineCount = parseInt(args[2]);
    144.             var faceImage = String(args[3]);
    145.             var faceIndex = parseInt(args[4]);
    146.            
    147.         var xhr = new XMLHttpRequest();
    148.         xhr.open("GET","data/dialogue/" + filename, false);
    149.         xhr.send(null);
    150.         var fileContent = xhr.responseText;
    151.       
    152.         //divide up the txt file into an array based on //
    153.         var dia = fileContent.split("//")
    154.       
    155.         //check for line exists
    156.         if (line > dia.length) {
    157.             console.log("Immersive Dialogue Plugin: Your line does not exist. Please specify a correct line number.");
    158.             }
    159.       
    160.       
    161.             if (args.length > 3) {
    162.             $gameMessage.setFaceImage(faceImage, faceIndex);
    163.             }
    164.       
    165.         if (lineCount !== 0) {
    166.             if (line + lineCount > dia.length) {console.log("Your lineCount exceeds your dialogue entries. Please change your lineCount.") }
    167.         for (var i = 0; i <= lineCount; i++) {
    168.             var msg = dia[line];
    169.             this.setWaitMode('message');
    170.             $gameMessage.newPage();
    171.             $gameMessage.add(msg);
    172.             line++;
    173.             }
    174.         }
    175.         else {
    176.             var msg = dia[line];
    177.             this.setWaitMode('message');
    178.             $gameMessage.add(msg);   
    179.             }   
    180.         }// end if command = dialogue
    181.    
    182.    
    183. } //end game_interpreter
    184.     function setDialogueVariable(line) {
    185.         if (_dialoguevariable !== 0) {
    186.             $gameVariables.setValue(_dialoguevariable, line);
    187.         }
    188.     }
    189.    
    190. })();
    复制代码







    FAQ
    None yet...

    Q:
    A:

    Credit and Thanks
    - DeadlyEssence01

    Terms of Use
    This plugin is free for both non-commercial and commercial use.
    You can give me credit as DeadlyEssence01 if you'd like.
    You may edit this plugin to fit your needs, but please do not redistribute it. You may make an extension plugin and link it in the forums if you'd like to share changes/alterations.

    Author's Notes
    This plugin comes how it is. I may not update it at all, or provide support for it I am just deciding to share a resource I made for my project. However, as for right now I am open to feedback. You can try asking questions / reporting problems in this thread first, and if I do not respond, I suggest taking it to the plugin support thread and posting there.


    本贴来自国际rpgmaker官方论坛作者:DeadlyEssence01处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/deadlyessence01-immersive-dialogue-v1-01.116578/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 09:37 , Processed in 0.096915 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表