扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 174|回复: 0

[转载发布] 事件名称--NPC名字显示(搬运修改)插件

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10475
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13225

    灌水之王

    发表于 2024-3-2 07:12:09 | 显示全部楼层 |阅读模式
    事件名称--NPC名字显示插件
    前几天在论坛搜索的一个这样的插件 原本是打算用yep的,但是最终显示出来的文字效果有点不理想
    后面找到了这个简短的插件 感觉很不错 就决定使用这个了 为了实现一些自己想要的效果 稍微地修改了些 搬运上来

    1、新增了字体颜色的自定义设置
    2、优化了文字与事件同步显示

    脚本初学菜鸟 若有哪里不对的 还请各位大佬们指正

    JAVASCRIPT 代码下载
    1. /*:
    2. * @plugindesc Namepop Ver 1.03 NPC名称显示
    3. * @author Morpho(dongdongDJH)
    4. *
    5. * @help
    6. * 在地图事件注释栏内填入 NAMEPOP|高度修正值|字体Size|字体颜色;
    7. * 高度修正值单位为1格,不填默认为1,字体大小不填默认为18;
    8. * 例:NAMEPOP|1|18|#00FF00 ; NAMEPOP||20 ;
    9. * 注:一定要用‘|’分隔高度修正值和字体Size;
    10. * 若要调整描边 请直接在下方代码中调整 (ps:0.8是颜色的透明度,0-1)
    11. */
    12. (function(){
    13.         _Sprite_Character_prototype_initialize = Sprite_Character.prototype.initialize;
    14.         Sprite_Character.prototype.initialize = function(character){
    15.                 _Sprite_Character_prototype_initialize.call(this, character);
    16.                 this._tempCharacter = character;
    17.                 if(character instanceof Game_Event){
    18.                         if(character.event().note.match("NAMEPOP") != null){
    19.                                 var notetext = character.event().note.split("|");
    20.                                 this._namepopY = Number(notetext[1]) || 1;
    21.                                 this._fontSize = Number(notetext[2]) || 18;
    22.                                 this._BYcolor  =  notetext[3] || "#FFFFFF";
    23.                                 this.createNamepopSet();
    24.                         }
    25.                 }
    26.         };
    27.         Sprite_Character.prototype.createNamepopSet = function(){
    28.                 var h = this._fontSize;
    29.                 this._namepopSprite = new Sprite();
    30.                 this._namepopSprite.bitmap = new Bitmap(h * 10, h);
    31.                 this._namepopSprite.bitmap.fontSize = h;
    32.                 this._namepopSprite.bitmap.outlineColor = "rgba(0, 0, 0, 0.8)"//描边颜色
    33.                 this._namepopSprite.bitmap.outlineWidth = 4;//字体描边
    34.                 this._namepopSprite.bitmap.textColor = this._BYcolor;//字体颜色
    35.                 this._namepopSprite.bitmap.drawText(this._tempCharacter.event().name, 0, 0, h * 10, h, 'center');
    36.                 this._namepopSprite.anchor.x = 0.5;
    37.                 this._namepopSprite.anchor.y = 1;
    38.                 this._namepopSprite.y = this.y - this._namepopY * 48;
    39.                 this.addChild(this._namepopSprite);
    40.         };
    41. // ---- 新增跟随事件显示 ----
    42.         _Sprite_Character_prototype_setCharacterBitmap = Sprite_Character.prototype.setCharacterBitmap;
    43.         Sprite_Character.prototype.setCharacterBitmap = function(){
    44.                 _Sprite_Character_prototype_setCharacterBitmap.call(this);
    45.         if(this._tempCharacter instanceof Game_Event){
    46.                         this._BYconditions = this._tempCharacter.findProperPageIndex();
    47.                         if(this._BYconditions >= 0 &&  this._namepopSprite){
    48.                                 this._namepopSprite.visible = true;
    49.                         }elseif(this._namepopSprite){
    50.                                 this._namepopSprite.visible = false;
    51.                         }
    52.                 }
    53.         };
    54. }());
    复制代码



                 本帖来自P1论坛作者wr282828,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=411060  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-10 23:11 , Processed in 0.135247 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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