Project1

标题: 【插件】仿碧轨地图血条 [打印本页]

作者: 过眼云烟    时间: 2015-11-21 20:15
标题: 【插件】仿碧轨地图血条
本帖最后由 过眼云烟 于 2015-11-21 20:11 编辑

没错,我又回来了,发布新的插件。基本算是日更了,哈哈哈。

这次是模仿碧轨,或者说模仿Va中大家喜闻乐见经常用的仿碧轨血条,不过我并没有像VA大神那样直接用默认图片生成。
用法的话需要各位自己处理,然后放到Faces目录下,不过也很简单,附件中有一个PSD文件,只需要把图片进行简单处理即可。
图片大小为72*72。在地图有对话发生和打开你的默认开关的时候,血条会消失。后续版本我会完善更多功能的,enjoy it~~
(附件包括四个猪角头像文件,插件,和PSD图层)

效果如下:


图片样式:(参考)



注意:我的插件你可以随意用在非商业游戏中,如果需要用在商业游戏,需要联系我。
如果我的插件用在您的游戏中,请在致谢名单中提及,谢谢!



JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // MrLiu_MapStatus.js
  3. //=============================================================================
  4. /*:
  5. * @plugindesc 在RMMV游戏的题图界面中显示仿空轨人物血条.
  6. * @author MrLiu-过眼云烟
  7.  * @param NotShowSwitch
  8.  * @desc 开启此开关则不显示地图血条,多用于剧情等特殊场景。
  9.  * @default 50
  10.  *
  11. * @help 这是我开发的第四个或者说第五个MV插件,本来程序可以实现自动切图功能
  12. * 但是切图之后,在菜单界面下的人物图片也会被切割,所以只能麻烦您自行提供素材了。
  13. * 请讲您的游戏中想显示在地图上的人物图片放到Faces目录下,请以Actor1_face.png
  14. * 格式命名,其中1代表1号角色,其他的您不需要改变。在插件中您可以自动设置的开关,
  15. * 可以在一些特殊剧情的时候打开这个开关,地图血条将自动关闭。后续版本我会考虑陆续
  16. * 增添功能的。Enjoy it~~支持我就多回帖多送糖吧。
  17. */
  18.  
  19. Window_Base.prototype.drawGauge = function(x, y, width, rate, color1, color2) {
  20.     var fillW = Math.floor(width * rate);
  21.     var gaugeY = y + this.lineHeight() - 8;
  22.     this.contents.fillRect(x, gaugeY, width, 6, this.gaugeBackColor());
  23.     this.contents.gradientFillRect(x, gaugeY, fillW, 6, color1, color2);
  24. };
  25. Bitmap.prototype.outlineTrap1 = function(x, y, width, height, color1, color2) {
  26.                 var context = this._context;
  27.                 var grad = context.createLinearGradient(x, y, x + width, y);
  28.                 var startCoords = [];
  29.                 grad.addColorStop(0, color1);
  30.                 grad.addColorStop(1, color2);
  31.                 context.save();
  32.                 context.beginPath();
  33.                 startCoords = [x, y + height]
  34.                 context.moveTo(x, y + height)
  35.                 context.lineTo(x + height, y)
  36.                 context.lineTo(x + width, y)
  37.                 context.lineTo(x + width - height, y + height)
  38.                 context.lineTo(startCoords[0], startCoords[1])
  39.                 context.strokeStyle = grad;
  40.                 context.stroke();
  41.                 context.restore();
  42.                 this._setDirty();
  43.         };
  44.  
  45.         Bitmap.prototype.fillTrap = function(x, y, width, widthpart, height, color1, color2) {
  46.                 var context = this._context;
  47.                 var grad = context.createLinearGradient(x, y, x + width, y);
  48.                 grad.addColorStop(0, color1);
  49.                 grad.addColorStop(1, color2);
  50.                 context.save();
  51.                 context.beginPath();
  52.                 context.moveTo(x, y + height)
  53.                 context.lineTo(x + height, y)
  54.                 context.lineTo(x + width, y)
  55.                 context.lineTo(x + width - height, y + height)
  56.                 context.clip();
  57.                 context.fillStyle = grad;
  58.                 context.fillRect(x, y, widthpart, height);
  59.                 context.restore();
  60.                 this._setDirty();
  61.         }
  62.  
  63.         Bitmap.prototype.outlineTrap = function(x, y, width, height, color1, color2) {
  64.                 var context = this._context;
  65.                 var grad = context.createLinearGradient(x, y, x + width, y);
  66.                 var startCoords = [];
  67.                 grad.addColorStop(0, color1);
  68.                 grad.addColorStop(1, color2);
  69.                 context.save();
  70.                 context.beginPath();
  71.                 startCoords = [x, y + height]
  72.                 context.moveTo(x, y + height)
  73.                 context.lineTo(x + height, y)
  74.                 context.lineTo(x + width, y)
  75.                 context.lineTo(x + width - height, y + height)
  76.                 context.lineTo(startCoords[0], startCoords[1])
  77.                 context.strokeStyle = grad;
  78.                 context.stroke();
  79.                 context.restore();
  80.                 this._setDirty();
  81.         }
  82.  
  83. function Window_MapStatus() {
  84.     this.initialize.apply(this, arguments);
  85. }
  86. var parameters = PluginManager.parameters('MrLiu_MapStatus');
  87. var notShowSwitch = Number(parameters['NotShowSwitch']);
  88.  
  89. Window_MapStatus.prototype = Object.create(Window_Selectable.prototype);
  90. Window_MapStatus.prototype.constructor = Window_MapStatus;
  91.  
  92. Window_MapStatus.prototype.initialize = function(x, y) {
  93.     var width = this.windowWidth();
  94.     var height = this.windowHeight();
  95.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  96.     this._formationMode = false;
  97.     this._pendingIndex = -1;
  98.     this.loadImages();
  99.     this._last_hps =  new Array();
  100.     this._last_mps =  new Array();
  101.     this._last_tps =  new Array();
  102.         this._hps =  new Array();
  103.         this._mps =  new Array();
  104.         this._tps =  new Array();
  105.     this.refresh();
  106. };
  107.  
  108. Window_MapStatus.prototype.drawGauge= function(x, y, width, rate, color1, color2) {
  109.                 var fillW = Math.floor(width * rate);
  110.                 var gaugeY = y + this.lineHeight() - 12;
  111.                 this.contents.fillTrap(x, gaugeY, width, width, 5, this.textColor(19), this.textColor(19));
  112.                 this.contents.fillTrap(x, gaugeY, width, fillW, 5, color1, color2);
  113.                 this.contents.outlineTrap1(x, gaugeY, width, 5, "#000000", "#000000");       
  114. };
  115.  
  116. Window_MapStatus.prototype.maxItems = function() {
  117.     return $gameParty.size();
  118. };
  119.  
  120. Window_MapStatus.prototype.itemHeight = function() {
  121.     var clientHeight = this.height - this.padding * 2;
  122.     return Math.floor(clientHeight / this.numVisibleRows());
  123. };
  124.  
  125.  
  126. Window_MapStatus.prototype.loadImages = function() {
  127.     $gameParty.members().forEach(function(actor) {
  128.         ImageManager.loadFace(actor.faceName());
  129.     }, this);
  130. };
  131.  
  132. Window_MapStatus.prototype.drawItem = function(index) {
  133.     this.drawItemBackground(index);
  134.     this.drawItemImage(index);
  135.     this.drawItemStatus(index);
  136. };
  137.  
  138. Window_MapStatus.prototype.drawItemBackground = function(index) {
  139.     if (index === this._pendingIndex) {
  140.         var rect = this.itemRect(index);
  141.         var color = this.pendingColor();
  142.         this.changePaintOpacity(false);
  143.         this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
  144.         this.changePaintOpacity(true);
  145.     }
  146. };
  147.  
  148.  
  149.  
  150. Window_MapStatus.prototype.processOk = function() {
  151.     Window_Selectable.prototype.processOk.call(this);
  152.     $gameParty.setMenuActor($gameParty.members()[this.index()]);
  153. };
  154.  
  155. Window_MapStatus.prototype.isCurrentItemEnabled = function() {
  156.     if (this._formationMode) {
  157.         var actor = $gameParty.members()[this.index()];
  158.         return actor && actor.isFormationChangeOk();
  159.     } else {
  160.         return true;
  161.     }
  162. };
  163.  
  164. Window_MapStatus.prototype.selectLast = function() {
  165.     this.select($gameParty.menuActor().index() || 0);
  166. };
  167.  
  168. Window_MapStatus.prototype.formationMode = function() {
  169.     return this._formationMode;
  170. };
  171.  
  172. Window_MapStatus.prototype.setFormationMode = function(formationMode) {
  173.     this._formationMode = formationMode;
  174. };
  175.  
  176. Window_MapStatus.prototype.pendingIndex = function() {
  177.     return this._pendingIndex;
  178. };
  179.  
  180. Window_MapStatus.prototype.setPendingIndex = function(index) {
  181.     var lastPendingIndex = this._pendingIndex;
  182.     this._pendingIndex = index;
  183.     this.redrawItem(this._pendingIndex);
  184.     this.redrawItem(lastPendingIndex);
  185. };
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Window_MapStatus.prototype.windowWidth = function() {
  196.         return Graphics.boxWidth * 0.7;
  197.     };
  198.  
  199.     Window_MapStatus.prototype.windowHeight = function() {
  200.         var h1 = this.fittingHeight(1);
  201.         var h2 = this.fittingHeight(2);
  202.         return Graphics.boxHeight - h1 - h2;
  203.     };
  204.  
  205.     Window_MapStatus.prototype.maxCols = function() {
  206.         return 4;
  207.     };
  208.  
  209.     Window_MapStatus.prototype.numVisibleRows = function() {
  210.         return 1;
  211.     };
  212.  
  213.     Window_MapStatus.prototype.drawItemImage = function(index) {
  214.         var actor = $gameParty.members()[index];
  215.         var rect = this.itemRectForText(index);
  216.         var w = Math.min(rect.width, 144);
  217.         var h = Math.min(rect.height, 144);
  218.         var lineHeight = this.lineHeight();
  219.         this.changePaintOpacity(actor.isBattleMember());
  220.         this.drawActorFace1(actor, rect.x, 380, w, h);//(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
  221.         this.changePaintOpacity(true);
  222.     };
  223. Window_MapStatus.prototype.drawActorFace1 = function(actor, x, y, width, height) {
  224.     this.drawFace1(actor._actorId,  x, y, width, height);
  225.    };
  226. ImageManager.loadFace1 = function(filename, hue) {
  227.     return this.loadBitmap('img/faces/', 'Actor'+filename+'_face', hue, true);
  228. };
  229.  
  230.  
  231. Window_MapStatus.prototype.drawFace1 = function(faceName,  x, y, width, height) {
  232.     width = width || Window_Base._faceWidth;
  233.     height = height || Window_Base._faceHeight;
  234.     var bitmap1 = ImageManager.loadFace1(faceName);
  235.         var dx = Math.floor(x + Math.max(width - 144, 0) / 2);
  236.     var dy = Math.floor(y + Math.max(height - 144, 0) / 2);
  237.     this.contents.blt(bitmap1, 0, 0, 72, 72, dx, dy,72,72);//gradientFillRect ( x , y , width , height , color1 , color2 , vertical )
  238. };
  239.  
  240.  
  241.  
  242.  
  243. Window_MapStatus.prototype.drawActorFace = function(actor, x, y, width, height) {
  244.     this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height);
  245.    };
  246. Window_MapStatus.prototype.drawFace = function(faceName, faceIndex, x, y, width, height) {
  247.     width = width || Window_Base._faceWidth;
  248.     height = height || Window_Base._faceHeight;
  249.     var bitmap1 = ImageManager.loadFace(faceName);
  250.     var pw = Window_Base._faceWidth;
  251.     var ph = Window_Base._faceHeight;
  252.     var sw = Math.min(width, pw);
  253.     var sh = Math.min(height, ph);
  254.     var dx = Math.floor(x + Math.max(width - pw, 0) / 2);
  255.     var dy = Math.floor(y + Math.max(height - ph, 0) / 2);
  256.     var sx = faceIndex % 4 * pw + (pw - sw) / 2;
  257.     var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
  258.     this.contents.blt(bitmap1, sx, sy, sw, sh, dx, dy,72,72);
  259.         this.clear_edge(bitmap1,sx,sy);
  260. };
  261.  
  262. Window_MapStatus.prototype.clear_edge = function(bitmap,sx,sy) {
  263.         for(var i=0 ;i<=72;i++){
  264.       bitmap.clearRect (sx, i+sy, 72 - i, 1);//72
  265.       bitmap.clearRect (sx+74 + i, i+sy, 72 - i, 1);
  266.       bitmap.clearRect (sx, i + 74+sy, i, 1);
  267.       bitmap.clearRect (sx+144 - i, i + 74+sy, i, 1);
  268.         }       
  269. };
  270.  
  271.     Window_MapStatus.prototype.drawItemStatus = function(index) {
  272.         var actor = $gameParty.members()[index];
  273.         var rect = this.itemRectForText(index);
  274.         var x = rect.x;
  275.         var y = rect.y;
  276.         var width = rect.width;
  277.         var bottom = y + rect.height-40;
  278.         var lineHeight = this.lineHeight();
  279.         this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
  280.         this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
  281.                 this.drawActorTp(actor, x, bottom - lineHeight * 1, width);
  282.     };
  283.  
  284.         Window_MapStatus.prototype.lineHeight = function() {
  285.        return 6;
  286.     };
  287.  
  288.  
  289.  
  290. Window_MapStatus.prototype.drawActorHp = function(actor, x, y, width) {
  291.     width = width || 186;
  292.     var color1 = this.hpGaugeColor1();
  293.     var color2 = this.hpGaugeColor2();
  294.     this.drawGauge(x+54, y, width-54, actor.hpRate(), color1, color2);
  295. };
  296.  
  297. Window_MapStatus.prototype.drawActorMp = function(actor, x, y, width) {
  298.     width = width || 186;
  299.     var color1 = this.mpGaugeColor1();
  300.     var color2 = this.mpGaugeColor2();
  301.     this.drawGauge(x+44, y, width-54, actor.mpRate(), color1, color2);
  302. };
  303.  
  304. Window_MapStatus.prototype.drawActorTp = function(actor, x, y, width) {
  305.     width = width || 96;
  306.     var color1 = this.tpGaugeColor1();
  307.     var color2 = this.tpGaugeColor2();
  308.     this.drawGauge(x+34, y, width-54, actor.tpRate(), color1, color2);
  309. };
  310.  
  311. Window_MapStatus.prototype.update = function() {
  312.   Window_Base.prototype.update.call(this);
  313.   this._hps.length = 0;
  314.   this._mps.length = 0;
  315.   this._tps.length = 0;
  316.   for(var el=0;el<$gameParty.size();el++){
  317.     this._hps.push($gameParty.members()[el].hpRate());
  318.         this._mps.push($gameParty.members()[el].mpRate());
  319.         this._tps.push($gameParty.members()[el].tpRate());
  320.   }
  321.    for(var i=0;i<this._hps.length;i++){
  322.     if (this._hps[i] != this._last_hps[i]){
  323.                 this.refresh();
  324.                 break;
  325.         }
  326.         if (this._mps[i] != this._last_mps[i]){
  327.                 this.refresh();
  328.                 break;
  329.         }
  330.         if (this._tps[i] != this._last_tps[i]){
  331.                 this.refresh();
  332.                 break;
  333.         }
  334.   }
  335. };
  336.  
  337. Window_MapStatus.prototype.refresh = function() {
  338.     this.contents.clear();
  339.         this.drawAllItems();
  340.         this._last_hps.length = 0;
  341.     this._last_mps.length = 0;
  342.     this._last_tps.length = 0;
  343. };
  344. Window_MapStatus.prototype.drawAllItems = function() {
  345.     var topIndex = this.topIndex();
  346.     for (var i = 0; i < this.maxPageItems(); i++) {
  347.         var index = topIndex + i;
  348.         if (index < this.maxItems()) {
  349.             this.drawItem(index);
  350.         }
  351.     }
  352.   for(var el=0;el<$gameParty.size();el++){
  353.     this._last_hps.push($gameParty.members()[el].hpRate());
  354.         this._last_mps.push($gameParty.members()[el].mpRate());
  355.         this._last_tps.push($gameParty.members()[el].tpRate());
  356.   }
  357. };       
  358.  
  359.  
  360.         var _Scene_Map_createMapStatusWindow = Scene_Map.prototype.createDisplayObjects;
  361.         Scene_Map.prototype.createDisplayObjects = function() {
  362.         _Scene_Map_createMapStatusWindow.call(this);
  363.         this._mapStatusWindow = new Window_MapStatus();
  364.         this._mapStatusWindow.opacity = 0;
  365.         this._mapStatusWindow.y = 150;
  366.         this.addWindow(this._mapStatusWindow);
  367.         };
  368.  
  369. var _Scene_Map_updateMapStatusWindow1 = Scene_Map.prototype.update;
  370. Scene_Map.prototype.update = function() {
  371.         _Scene_Map_updateMapStatusWindow1.call(this);////gameSwitches.value(dataId)
  372.         if(($gameMap._interpreter.isRunning()) || ($gameSwitches.value(notShowSwitch) == true)){
  373.  
  374.            this._mapStatusWindow.close();
  375.      }
  376.         else{
  377.            this._mapStatusWindow.open();  
  378.      }
  379. };

MrLiu_MapStatus.rar

78.63 KB, 下载次数: 2144


作者: larbi    时间: 2015-11-21 20:37
云烟君真是勤奋的劳模,继续支持
ps.我是群里的汽水~
作者: 墟源    时间: 2015-11-21 20:45
感谢大神贡献{:2_275:}
作者: 雪明辉    时间: 2015-11-21 20:47
在此膜拜大神,感谢分享\(≧▽≦)/
作者: 诗俊熙    时间: 2015-11-21 20:49
云烟出品,必须顶啊,无决来报道啦!
作者: soken1314    时间: 2015-11-21 20:51
来支持云烟酱拉!猜猜我是谁
作者: 高须小龙    时间: 2015-11-21 21:03
前排支持~!
作者: 邪神    时间: 2015-11-22 23:03
现在的rm mv的脚本用的是ruby还是javascript?
作者: 夏末渐离    时间: 2015-11-25 22:05
正好可以学习学习。最近做的那个HUD简直糟糕,只能绘制出位图,但是血蓝条却没有实际功能。
作者: 苍刃君    时间: 2015-11-26 18:38
哎哟,不错哦
作者: 西姐    时间: 2015-11-27 09:29
可以改成在右边竖排吗
作者: ytqlovehjl    时间: 2015-11-30 09:05
楼主好厉害,膜拜中。。。
作者: chaizi1992    时间: 2016-1-4 11:36
{:2_286:}大神,我想问下插件命令怎么用,如何隐藏掉小头像显示
我试了下var notShowSwitch = 1 并没有用
作者: chaizi1992    时间: 2016-1-4 14:12
{:2_270:}原来是关联到一个开关,我愚昧了-。-谢谢楼主解惑
作者: huntluo    时间: 2016-1-4 18:26
感谢分享
作者: k47363312    时间: 2016-1-23 19:55
作为伸手党也要做点啥,顶一个
作者: 13701225339    时间: 2016-2-1 19:30
你好,我想问一下要是修改血条的高度应该在哪里修改,宽度我会,高度没找到。。不是坐标,是想把血条变大一些
作者: bigmositer    时间: 2016-2-3 11:41
已经用上了,好帮啊。另外楼主你的地图类似树叶遮荫怎么做的?
作者: 伽菈弥    时间: 2016-2-3 14:28
感谢分享!
作者: 咿雪の魂    时间: 2016-2-18 23:25
支持!该贴已收藏,以后学习用
作者: mulderz    时间: 2016-2-21 17:26
首先感谢楼主的分享!

不过,其实我想知道的是……画面上那种阴影效果是怎么实现的那?新人冒昧的询问一下,这画面感觉非常棒啊。
作者: 我是一个小白    时间: 2016-4-8 22:57
界面好美,但是头像位置不知道怎么改;游戏分辨率一改头像位置就跑偏了

360桌面截图20160408225509.jpg (514.37 KB, 下载次数: 18)

360桌面截图20160408225509.jpg

作者: pandeng421    时间: 2016-6-11 21:31
求大神指导: 我的游戏分辨率和你的不一样,导致角色头像位置偏了,要改头像的Y轴,在JS的哪里改,谢谢大神!!
作者: Zackyooo    时间: 2016-11-8 01:06
6666666666
作者: 大世界    时间: 2017-1-17 08:02
非常感谢大神!
但是怎么必须使用四个啊!少一张图片都不能运行的!还不能实时更新的!!!
作者: 柳岳枫    时间: 2017-1-31 15:40
很精美的插件!楼主系列的插件都很精致 求问 我试了一下开闭开关 咋都关不掉这个血条呀
作者: q2571875    时间: 2017-2-5 09:31
请问一下这个怎么放到游戏上方呢
作者: r8u3s4h7    时间: 2017-2-22 19:29
超级棒啊,感谢分享,下来学习一下。这个血条显示超级管用
作者: 废剑    时间: 2017-6-29 15:11
晚生,谢过了
作者: yeyong    时间: 2017-10-27 00:32
这是很有趣的效果啊,谢谢分享
作者: qrb1026331406    时间: 2017-11-3 10:55
好东西,感谢分享!
作者: ie486huhu    时间: 2017-11-5 23:53
感谢分享
作者: 北极鹅    时间: 2017-11-7 13:26
效果真好,简洁大方!
作者: 狂人狂者    时间: 2018-8-30 20:05
非常感谢!
作者: q1456503215    时间: 2018-8-30 21:05
商业不给用?   你的插件开源了吧?
作者: 普通的呆毛狼    时间: 2018-8-31 18:04
我想问一下,如何把TP槽去掉
作者: chensn8057    时间: 2018-9-7 14:42
云烟出品,必须顶啊
作者: 果砸    时间: 2018-9-25 20:30
超棒的!
作者: mjc2568103    时间: 2018-11-1 12:03
是个不错的的插件,但是,修改过分辨率后,头像坐标会错位,也不知怎么修改坐标
作者: 夸父    时间: 2018-11-3 22:57
大佬····有木有什么办法。
当我改变游戏窗口大小的时候····你这个插件的头像和血条就分开了·····

我琢磨着 能不能加一些可以调节的参数?
作者: URUUR    时间: 2018-11-8 11:41
感觉已经成为rm标配的地图血条了
作者: 2283258119    时间: 2018-12-16 18:30
很不错的插件!支持一下!

作者: tidusm    时间: 2019-3-6 23:22
老板,怎么修改血槽的颜色?
作者: Morix    时间: 2019-7-9 16:25
这个很棒!
作者: eve19810528    时间: 2019-9-14 17:11
感谢老大,这个插件我还不会用
作者: wtdming    时间: 2020-1-29 14:01
很漂亮简洁  感谢分享
作者: a6633069    时间: 2020-8-3 13:14
不错啊不错
作者: wudicc1    时间: 2021-9-1 22:21
感谢分享
作者: xiaolou010    时间: 2021-11-1 11:36
感谢楼主,支持一下。
作者: 上帝羽下    时间: 2021-11-1 14:24
膜拜大佬,感谢分享
作者: moumou00000    时间: 2021-11-2 08:21
感谢大神分享,请问图片中的光影效果是如何实现的呢?望大神不吝赐教。
作者: gary233    时间: 2021-11-2 18:21
好,学习学习
作者: 夜宇星繁    时间: 2024-4-2 04:16
感谢大佬分享




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