找回密码
 注册用户
查看: 297|回复: 0

[RMMZ] 【汉化】【含MV】靠近事件时出现提示气泡

[复制链接]

88

主题

7

回帖

1277

积分

资深会员

积分
1277
发表于 2024-6-19 13:43:54 | 显示全部楼层 |阅读模式
原地址:[MZ] Event Interaction Hint | RPG Maker Forums (rpgmakerweb.com)

作者:Dustb0



预览:
ezgif-3-c8472108f2.gif


汉化脚本:
  1. /*:
  2. * @plugindesc 靠近事件时展示气泡动画
  3. * 汉化 by 烁灵 更多插件请访问 www.hknmtt.com
  4. * @author Dustb0
  5. * @version 1.2
  6. *
  7. * @param balloonID
  8. * @text 气泡 ID
  9. * @type number
  10. * @default 11
  11. *
  12. * @help
  13. * 使用方法:
  14. * 在事件备注区填写
  15. * <interact>
  16. * 即可
  17. *
  18. * 如果只想在指定事件页产生气泡,则在事件指令的第一行使用“注释”:
  19. * \interact
  20. * 在注释中可以指定气泡ID:
  21. * \interact[balloon=12]
  22. * 也可以仅在指定方向上应用气泡效果:
  23. * \interact[dir=8, balloon=12]
  24. * (8 = 上, 6 = 右, 2 = 下, 4 = 左)
  25. *
  26. */
  27. (() => {
  28.   const parameters = PluginManager.parameters("SDE_InteractPop");
  29.   const paramBalloonID = Number(parameters["balloonID"])

  30.   Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
  31.     if (!$gameMap.isEventRunning()) {
  32.         for (const event of $gameMap.eventsXy(x, y)) {
  33.             if (
  34.                 event.isTriggerIn(triggers) &&
  35.                 event.isNormalPriority() === normal
  36.             ) {
  37.                 event.start();

  38.             } else if (event.page() &&
  39.                        event.list().length > 0 &&
  40.                        event.list()[0].code === 108 &&
  41.                        event.list()[0].parameters[0].match(/\\interact\s*/i)) {
  42.               // Event Page Comment

  43.               // Check direction condition
  44.               const direction = event.list()[0].parameters[0].match(/dir\=(\d)\D*\s*/i);
  45.               if (direction && Number(direction[1]) !== $gamePlayer.direction()) {
  46.                 return;
  47.               }
  48.               let balloon = event.list()[0].parameters[0].match(/balloon\=(\d+)\D*\s*/i);
  49.               requestBalloon(balloon ? Number(balloon[1]) : paramBalloonID);

  50.             } else if (event.event().meta["interact"] && event.findProperPageIndex() >= 0) {
  51.               // Event
  52.               let balloonID = paramBalloonID

  53.               // Check if default param gets overriden by event
  54.               if (typeof event.event().meta["interact"] === 'string') {
  55.                 balloonID = Number(event.event().meta["interact"]);
  56.               }
  57.               requestBalloon(balloonID);
  58.             }
  59.         }
  60.     }
  61.   }

  62.   requestBalloon = function(balloonID) {
  63.     if ($gamePlayer.requestBalloon) {
  64.       $gamePlayer.requestBalloon(balloonID); // MV
  65.     } else {
  66.       $gameTemp.requestBalloon($gamePlayer, balloonID); // MZ
  67.     }   
  68.   }

  69. })();
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册用户

本版积分规则

Archiver|QQ群: 48625831|爱上RPG|哈库纳玛塔塔 |网站地图 Clicky

GMT+8, 2024-10-23 15:26 , Processed in 0.060546 second(s), 22 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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