Project1

标题: 【插件】仿空轨地图人物气球 [打印本页]

作者: 过眼云烟    时间: 2015-11-20 18:02
标题: 【插件】仿空轨地图人物气球
本帖最后由 过眼云烟 于 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, 下载次数: 1267


作者: YamazakiRyusa    时间: 2015-11-20 19:23
VA 版的 Balloon

Balloon_1.png (9.98 KB, 下载次数: 114)

Balloon_1.png

作者: 寂静的夜里    时间: 2015-11-20 19:41
真是不错的插件
作者: 余烬之中    时间: 2015-11-20 20:32
我看楼主很有前途
(其实并不需要我说= =
作者: larbi    时间: 2015-11-21 10:12
支持云烟君!!
作者: 越前リョーマ    时间: 2015-11-21 10:37
很棒的插件,有些时候NPC很多,可以使其中重要的NPC凸现出来
作者: 高须小龙    时间: 2015-11-21 12:49
好溜
作者: 无脑大帝    时间: 2015-11-23 06:18
这个效果做的很不错!32个赞
作者: snail_026379    时间: 2015-11-24 22:07
请收下我的膝盖
作者: wolf初心者    时间: 2015-11-26 13:24
感谢分享。感觉很棒。
作者: ytqlovehjl    时间: 2015-11-30 17:06
大哥你太厉害了!收程序员小弟吗。。
作者: 索里    时间: 2015-12-1 20:57
支持你,谢谢你的分享
作者: mengjing    时间: 2015-12-9 22:35
本帖最后由 mengjing 于 2015-12-9 22:38 编辑

然而我在事件指令里面...完全没找到 说明  这个玩意....
是现在这个1.01的汉化版本有出入?



最后我在流程控制的最下面那个注译才完成
作者: huzhouczy    时间: 2015-12-22 13:33
很不错的东东,已收藏!~~
作者: king    时间: 2016-2-26 13:45
本帖最后由 king 于 2016-5-1 10:40 编辑

脚本效果超好,美观又实际

作者: chenmissjin    时间: 2017-4-24 04:10
请问大大,你能不能提取一下泽诺尼亚5的人物气泡表情?看来看去还是这个好一些
作者: zsa2025141    时间: 2017-7-17 18:46
说明在哪里呀 我只要注释。。。。
作者: lvkeai    时间: 2018-1-9 13:30
挺好的
作者: qq1065526265    时间: 2018-1-10 13:27
感谢大佬分享
作者: 胖小次    时间: 2018-2-10 22:11
事件页的说明在哪里
作者: 西方华莱士    时间: 2018-2-11 10:36
很赞
作者: abr80210    时间: 2018-2-12 14:28
謝謝大大分享,畫面變得更豐富;有這個就不會跟委託人NPC搞混了。

作者: 2256538860    时间: 2018-2-13 02:40
如果说我的回帖可以给楼主动力
如果说楼主的发布可以给游戏制作者们帮助
那么我想我会经常来回帖~
作者: 北极鹅    时间: 2018-2-25 12:47
加油加油,插件很实用!
作者: 开关关    时间: 2018-7-19 14:07
太实用了,感谢楼主的付出!
作者: 新手0123    时间: 2019-5-29 15:53
这个插件很棒啊
作者: plain666    时间: 2019-5-29 23:55
做的不错,有RPG Maker VX Ace版的吗,我这运行不了RPG Maker MV
作者: NichiSn    时间: 2019-10-15 15:45
支持云烟君!!
作者: wy129308    时间: 2021-3-19 19:04
你好,请问怎么设置距离?

作者: xiamumomo    时间: 2021-3-19 22:38
wy129308 发表于 2021-3-19 19:04
你好,请问怎么设置距离?

什么距离
作者: xiamumomo    时间: 2021-3-19 23:16
这个插件是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. }

作者: meow13    时间: 2024-3-27 22:11
楼主大大想请问下,这个气泡可以在玩家头上显示吗?
作者: 夜宇星繁    时间: 2024-4-2 04:17
感谢大佬分享




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1