设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 25573|回复: 33
打印 上一主题 下一主题

[原创发布] 【插件】仿空轨地图人物气球

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3657
在线时间
4466 小时
注册时间
2008-6-12
帖子
802
跳转到指定楼层
1
发表于 2015-11-20 18:02:02 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 过眼云烟 于 2015-11-20 18:01 编辑

这是我尝试开发的第三个MV插件,希望大家多多回帖支持,你们的回帖会给我更大的动力!
效果的话类似于空之轨迹游戏中人物走近NPC会显示气泡表情,使用方法是在事件的说明中添加autoballoon_11,即显示11号表情。
截图中的素材为我按照空之轨迹修改后的实现的效果,附件中的图片取自MV RTP默认素材的表情文件,请参照此图格式制作您自己的表情合集。

后续版本将提供修改格式,显示速度等功能,敬请期待,当然如果大家留言不积极我就懒得继续开发了


Enjoy it~~~
如果有问题,欢迎留言。
效果如下:


使用方法:


自动气球包素材格式,请放到System目录下:(参照)



JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // MrLiu_AutoBalloon.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc 在RMMV游戏中地图界面的人物头顶自动显示气球
  7.  * @author MrLiu-过眼云烟
  8.  *
  9.  * @help 事件页的说明下加入“autoballoon_11”,即显示第11行的表情,需将Balloon_1.png
  10.  * 文件放在\img\system目录下,该文件默认大小为96*352,默认每格表情大小为32,每行3格
  11.  * 后续版本将提供修改格式,显示速度等功能,敬请期待,如有问题欢迎给我留言。
  12.  */
  13. //-----------------------------------------------------------------------------
  14. var Imported = Imported || {};
  15. Imported.MrLiu_AutoBalloon = true;
  16.  
  17. var Lmd = Lmd || {};
  18. Lmd.MrLiu_AutoBalloon = Lmd.MrLiu_AutoBalloon || {};
  19.  
  20.  
  21.  
  22.   var parameters = PluginManager.parameters('MrLiu_Shadow');
  23.   var displayAutoBalloon = String(parameters['displayAutoBalloon']);
  24.   var shadowOpacity = Number(parameters['shadowOpacity']);
  25.   displayAutoBalloon = false;
  26.  
  27. Lmd.MrLiu_AutoBalloon.Game_Character_initialize = Game_Character.prototype.initialize;
  28.   Game_Character.prototype.initialize = function() {
  29.     Lmd.MrLiu_AutoBalloon.Game_Character_initialize.call(this);
  30.     this._auto_balloon = 0;
  31. };
  32.  
  33. Game_Character.prototype._auto_balloon = function() {
  34.         return this._auto_balloon;
  35. };
  36.  
  37.  
  38. Lmd.MrLiu_AutoBalloon.Game_Event_refresh = Game_Event.prototype.refresh;
  39. Game_Event.prototype.refresh = function() {
  40.         Lmd.MrLiu_AutoBalloon.Game_Event_refresh.call(this);
  41.         if((this._erased == false)&&(this._trigger == 0)){
  42.         var list = this.list();
  43.         for(var i=0 ;i<list.length;i++){
  44.                 if (list[i].code == 108){
  45.                         var num =list[i].parameters[0].match(/autoballoon_(\d+)/g);
  46.                         if (num){
  47.                                 var num1 = Number((String(num)).match(/\d+(\.\d+)?/g));
  48.                                 this._auto_balloon = num1;
  49.                         }
  50.                 }
  51.         }
  52.         }
  53. };
  54.  
  55. Game_Event.prototype.setupPage = function() {
  56.     if (this._pageIndex >= 0) {
  57.                 this._auto_balloon = 0;
  58.         this.setupPageSettings();
  59.     } else {
  60.                 this._auto_balloon = 0;
  61.         this.clearPageSettings();
  62.     }
  63.     this.refreshBushDepth();
  64.     this.clearStartingFlag();
  65.     this.checkEventTriggerAuto();
  66. };
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. Lmd.MrLiu_AutoBalloon.Sprite_Character_initialize = Sprite_Character.prototype.initialize;
  74. Sprite_Character.prototype.initialize = function(character) {
  75.     Lmd.MrLiu_AutoBalloon.Sprite_Character_initialize.call(this,character);
  76.         this.createAutoBalloon();
  77.         this._dis_flag = 0;
  78.         this._flag = 0;
  79.         this._bx = 0
  80.         this.character = character;
  81. };
  82. Sprite_Character.prototype.createAutoBalloon = function() {
  83.     this._auto_balloon_sprite = new Sprite();
  84.     this._auto_balloon_sprite.bitmap = ImageManager.loadSystem('Balloon_1');
  85.         this._auto_balloon_sprite.opacity = 0;
  86.         this._auto_balloon_sprite.z = 7;
  87.         this._auto_balloon_sprite.x = this.x;
  88.     this._auto_balloon_sprite.y = this.y-40;//-this.patternHeight();// ;//- this.height*2;
  89.         this._auto_balloon_sprite.anchor.x = 0.5;
  90.     this._auto_balloon_sprite.anchor.y = 1;
  91.         //this.addChild(this._auto_balloon_sprite);
  92.     this.addChild(this._auto_balloon_sprite);
  93.         if (displayAutoBalloon){
  94.                 this._p_balloon_sprite = new Sprite();
  95.                 this._p_balloon_sprite.bitmap = ImageManager.loadSystem('Balloon_1');
  96.                 this._p_balloon_sprite.opacity = 0;
  97.                 this._p_balloon_sprite.z = 7;
  98.                 this.parent.addChild(this._p_balloon_sprite);//this.addChild(this._p_balloon_sprite);
  99.         }
  100. }       
  101.  
  102. Lmd.MrLiu_AutoBalloon.Sprite_Character_update = Sprite_Character.prototype.update;
  103. Sprite_Character.prototype.update = function() {
  104.         Lmd.MrLiu_AutoBalloon.Sprite_Character_update.call(this);
  105.         if ((this.character._auto_balloon == 0)  || ! (this._balloonDuration == 0 ) || ($gameMap._interpreter.isRunning()) || ($gameSwitches[212] == true)){
  106.       this.clear_auto_balloon();
  107.         }
  108.     else{
  109.       this.update_auto_balloon();
  110.         }
  111. }
  112.  
  113.  
  114. Sprite_Character.prototype.face_to_event = function() {
  115.     var data = new Array();
  116.     var w = 1;
  117.     var h = 1 * 2;
  118.         for (var i=0;i<(h+1);i++)
  119.         {
  120.                 for (var j=0;j<(h+1);j++)
  121.                         {
  122.                             data.push([(this.character.x-w)+i,(this.character.y-w)+j]);
  123.                         }
  124.         }
  125.          for(var i =0;i<data.length;i++) {
  126.      if((String(data[i])) == (String([$gamePlayer.x , $gamePlayer.y]))) {
  127.       return true;
  128.      }
  129.     }
  130.         return false;
  131. }
  132.  
  133.  
  134. Sprite_Character.prototype.distance_balloom_opacity = function() {
  135.    this._auto_balloon_sprite.opacity += 70;
  136.     if (displayAutoBalloon){
  137.       this._p_balloon_sprite.opacity += 70;
  138.         }
  139. }
  140.  
  141.  
  142. Sprite_Character.prototype.clear_auto_balloon = function() {
  143.         if (this._auto_balloon_sprite.opacity == 0){
  144.       this._dis_flag = 255;
  145.       return;
  146.         }
  147.     this._auto_balloon_sprite.opacity = this._dis_flag;
  148.     if (displayAutoBalloon){
  149.       this._p_balloon_sprite.opacity = this._dis_flag;
  150.         }
  151.     this._dis_flag -= 35;
  152. }
  153.  
  154.  
  155.  
  156. Sprite_Character.prototype.start_auto_balloon = function() {
  157.     this._flag = 1;
  158.     this._balloon_id = this.character._auto_balloon;
  159.     this._ry = (this.character._auto_balloon - 1) * 32;
  160. }
  161.  
  162. Sprite_Character.prototype.set_rect = function(index) {
  163.     this._auto_balloon_sprite.setFrame(32 * index, this._ry, 32, 32);
  164.     if (displayAutoBalloon){
  165.       this._p_balloon_sprite.setFrame(32 * index, this._ry, 32, 32);
  166.         }
  167. }
  168.  
  169.  
  170.  
  171. Sprite_Character.prototype.update_auto_balloon = function() {
  172.     if ((!this._auto_balloon_sprite) ||  (this._balloon_id != this._character._auto_balloon) || (this._flag == 0)){
  173.           this.start_auto_balloon();
  174.     }
  175.         //console.log(this.height);
  176.         //console.log(this.character.y);
  177.         //this._auto_balloon_sprite.y = this.character.y - this.height;
  178.         //console.log(this._auto_balloon_sprite.y);
  179.     if (displayAutoBalloon){
  180.                 this._p_balloon_sprite.x = $gamePlayer.x;
  181.         this._p_balloon_sprite.y = $gamePlayer.y;
  182.         }
  183.     if (this.face_to_event()){
  184.       this.distance_balloom_opacity();
  185.         }else{
  186.       this.clear_auto_balloon();
  187.         }
  188.     if (this._flag == 10){
  189.       this._flag = 0;
  190.           if(this._bx == 2){
  191.                   this._bx = 0;
  192.           }
  193.           else{
  194.                   this._bx++;
  195.           }
  196.         }
  197.     else{
  198.       this._flag++;
  199.         }
  200.         this.set_rect(this._bx);
  201. }

MrLiu_AutoBalloon.rar

1.93 KB, 下载次数: 1261

评分

参与人数 11星屑 +425 梦石 +2 +5 收起 理由
FriendsMind + 1 我好喜歡你做的插件!
plain666 + 1 塞糖
Kim_Shyuen + 1 精品文章
abr80210 + 1 我很赞同
simyaoyao + 1 塞糖
c248611 + 45 塞糖
夜$神 + 42 Mark,好插件
king + 96 塞糖
余烬之中 + 166 + 2 图书馆收录
rpg-sheep + 10 666

查看全部评分

本人三无老人,请大神轻拍

Lv2.观梦者

梦石
0
星屑
643
在线时间
51 小时
注册时间
2022-11-3
帖子
126
33
发表于 2024-4-2 04:17:59 | 只看该作者
感谢大佬分享
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
333
在线时间
70 小时
注册时间
2023-12-24
帖子
2
32
发表于 2024-3-27 22:11:11 | 只看该作者
楼主大大想请问下,这个气泡可以在玩家头上显示吗?
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9288
在线时间
1839 小时
注册时间
2020-1-2
帖子
1082
31
发表于 2021-3-19 23:16:43 | 只看该作者
这个插件是32X32的 MV自带冒泡图标事48X48   如果要修改用记事本打开插件Ctrl + F 搜下面代码将所哦与32改成48(我自己测试了一下没什么问题)反正我不懂代码这些
JAVASCRIPT 代码复制
  1. Sprite_Character.prototype.start_auto_balloon = function() {
  2.     this._flag = 1;
  3.     this._balloon_id = this.character._auto_balloon;
  4.     this._ry = (this.character._auto_balloon - 1) * 32;
  5. }
  6.  
  7. Sprite_Character.prototype.set_rect = function(index) {
  8.     this._auto_balloon_sprite.setFrame(32 * index, this._ry, 32, 32);
  9.     if (displayAutoBalloon){
  10.       this._p_balloon_sprite.setFrame(32 * index, this._ry, 32, 32);
  11.         }
  12. }


修改显示速度和刷新速度  已经用记事本打开插件的话拉到最底下   修改这里的10(显示速度)数值越小速度越快 理想8左右
下面2就是刷新速度  越小速度越快  我自己测试一下5到8左右  你们自己也测试一下调出自己想要的效果
JAVASCRIPT 代码复制
  1. if (this._flag == 10){
  2.       this._flag = 0;
  3.           if(this._bx == 2){
  4.                   this._bx = 0;
  5.           }
  6.           else{
  7.                   this._bx++;
  8.           }
  9.         }
  10.     else{
  11.       this._flag++;
  12.         }
  13.         this.set_rect(this._bx);
  14. }
B站没人气的夏目漠漠,直播间:5378938实用插件教程点击红字传送
回复 支持 1 反对 0

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9288
在线时间
1839 小时
注册时间
2020-1-2
帖子
1082
30
发表于 2021-3-19 22:38:38 | 只看该作者
wy129308 发表于 2021-3-19 19:04
你好,请问怎么设置距离?

什么距离
B站没人气的夏目漠漠,直播间:5378938实用插件教程点击红字传送
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
76
在线时间
17 小时
注册时间
2020-8-11
帖子
7
29
发表于 2021-3-19 19:04:09 | 只看该作者
你好,请问怎么设置距离?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
14
在线时间
3 小时
注册时间
2019-10-9
帖子
5
28
发表于 2019-10-15 15:45:04 | 只看该作者
支持云烟君!!
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
21172
在线时间
1049 小时
注册时间
2016-1-6
帖子
3371
27
发表于 2019-5-29 23:55:27 | 只看该作者
做的不错,有RPG Maker VX Ace版的吗,我这运行不了RPG Maker MV
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
222
在线时间
30 小时
注册时间
2018-12-23
帖子
20
26
发表于 2019-5-29 15:53:04 | 只看该作者
这个插件很棒啊
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6964
在线时间
640 小时
注册时间
2012-7-29
帖子
173
25
发表于 2018-7-19 14:07:30 | 只看该作者
太实用了,感谢楼主的付出!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-6 17:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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