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

[转载发布] Free Plugin (Event Name)

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

    连续签到: 2 天

    [LV.7]常住居民III

    6120

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 7 天前 | 显示全部楼层 |阅读模式
    Serge Event Name Plugin (FREE)



    Hello guys, I'm here to bring you this plugin that shows the name of the event.

    *You can configure the text size, position, and color.

    More Plugins Here:
    Serge Plugins



    Serge Event Name (FREE)

                    Code:       
    1. //=============================================================================
    2. // SergeEventName.js
    3. //=============================================================================
    4. /*:
    5. * @target MZ
    6. * @plugindesc Displays names above events using note tags in RPG Maker MZ.
    7. * @author Serge
    8. * @url https://gamel001.itch.io/
    9. *
    10. * @param fontSize
    11. * @text Font Size
    12. * @desc Font size for the event names.
    13. * @type number
    14. * @default 20
    15. *
    16. * @param fontColor
    17. * @text Font Color
    18. * @desc Color for the event names. Use CSS color values.
    19. * @type string
    20. * @default #FFFFFF
    21. *
    22. * @param outlineColor
    23. * @text Outline Color
    24. * @desc Outline color for the event names. Use CSS color values.
    25. * @type string
    26. * @default #000000
    27. *
    28. * @param outlineWidth
    29. * @text Outline Width
    30. * @desc Width of the outline for the event names.
    31. * @type number
    32. * @default 4
    33. *
    34. * @param offsetX
    35. * @text Offset X
    36. * @desc Horizontal offset for the event name display from the center of the event.
    37. * @type number
    38. * @default 0
    39. *
    40. * @param offsetY
    41. * @text Offset Y
    42. * @desc Vertical offset for the event name display from the bottom of the event. Positive values move text up.
    43. * @type number
    44. * @default -40
    45. */
    46. (() => {
    47.     const parameters = PluginManager.parameters('SergeEventName');
    48.     const fontSize = parseInt(parameters['fontSize'], 10);
    49.     const fontColor = String(parameters['fontColor']);
    50.     const outlineColor = String(parameters['outlineColor']);
    51.     const outlineWidth = parseInt(parameters['outlineWidth'], 10);
    52.     const offsetX = parseInt(parameters['offsetX'], 10);
    53.     const offsetY = parseInt(parameters['offsetY'], 10);
    54.     class Sprite_EventName extends Sprite {
    55.         constructor(event) {
    56.             super();
    57.             this._event = event;
    58.             this.bitmap = new Bitmap(200, 48);
    59.             this.bitmap.fontSize = fontSize;
    60.             this.bitmap.textColor = fontColor;
    61.             this.bitmap.outlineColor = outlineColor;
    62.             this.bitmap.outlineWidth = outlineWidth;
    63.             this.visible = false; // Initially hidden, will be shown after positioning
    64.         }
    65.         update() {
    66.             super.update();
    67.             if (this._event && this._event._erased) {
    68.                 this.parent && this.parent.removeChild(this);
    69.                 return;
    70.             }
    71.             this.updatePosition();
    72.             this.refresh();
    73.         }
    74.         updatePosition() {
    75.             if (SceneManager._scene instanceof Scene_Map && this._event) {
    76.                 const screenX = this._event.screenX();
    77.                 const screenY = this._event.screenY();
    78.                 this.x = screenX + offsetX - this.width / 2;
    79.                 // Applying offsetY so positive values move the name up
    80.                 this.y = screenY - offsetY - this.height - $gameMap.tileHeight();
    81.                 this.z = 9;
    82.                 this.visible = true;
    83.             }
    84.         }
    85.         refresh() {
    86.             const nameMatch = /<EventName:(.+?)>/.exec(this._event.event().note);
    87.             if (nameMatch) {
    88.                 this.bitmap.clear();
    89.                 const eventName = nameMatch[1];
    90.                 this.bitmap.drawText(eventName, 0, 0, 200, 48, "center");
    91.             }
    92.         }
    93.     }
    94.     const _Scene_Map_start = Scene_Map.prototype.start;
    95.     Scene_Map.prototype.start = function() {
    96.         _Scene_Map_start.call(this);
    97.         this.createEventNameSprites();
    98.     };
    99.     Scene_Map.prototype.createEventNameSprites = function() {
    100.         const events = $gameMap.events();
    101.         events.forEach(event => {
    102.             const nameMatch = /<EventName:(.+?)>/.exec(event.event().note);
    103.             if (nameMatch && !event._eventNameSprite) {
    104.                 const eventNameSprite = new Sprite_EventName(event);
    105.                 this._spriteset._tilemap.addChild(eventNameSprite);
    106.                 event._eventNameSprite = eventNameSprite;
    107.                 eventNameSprite.refresh();
    108.             }
    109.         });
    110.     };
    111. })();
    复制代码




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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-26 23:03 , Processed in 0.133739 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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