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

Project1

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

[有事请教] 懂代码的进

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1390
在线时间
231 小时
注册时间
2017-10-24
帖子
209
跳转到指定楼层
1
发表于 2017-11-2 08:26:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
以下代码,是  的插件,但是他这几天都不在线, 哪位大神帮看下,这个插件该如何设置一个敌人为BOSS,让血条显示出来?谢谢
//===================================================================================
/*:
* @plugindesc  仿DNF血槽。
* @author 芯☆淡茹水
* @help ____________________________________________________________________
* --------------------------------------------------------------------------
* @param bloodCk
* @desc 一条血的血量。
* @default 100
* --------------------------------------------------------------------------
* @param barX
* @desc 血槽X坐标。
* @default 80
* --------------------------------------------------------------------------
* @param barY
* @desc 血槽Y坐标。
* @default 80
*  --------------------------------------------------------------------------
* @param BarMomt
* @desc 是否开启血条动态(0:开启; 1:不开启)。
* @default 0
* --------------------------------------------------------------------------
* @param waitTime
* @desc BOSS血量在持续多少帧未变动时,开始血条动态。
* @default 200
*/
//===================================================================================
(function() {
var XdrsDNFBarDate = XdrsDNFBarDate || {};
var xrdbpeprtr = PluginManager.parameters('Xr_blood_type2');
XdrsDNFBarDate.barX = parseInt(xrdbpeprtr['barX']) || 80;
XdrsDNFBarDate.barY = parseInt(xrdbpeprtr['barY']) || 80;
XdrsDNFBarDate.bCk = parseInt(xrdbpeprtr['bloodCk']) || 100;
XdrsDNFBarDate.barMomt = parseInt(xrdbpeprtr['BarMomt']) || 0;
XdrsDNFBarDate.waitTime = parseInt(xrdbpeprtr['waitTime']) || 200;
//=================================================================================
var XdRsDNFBarGESetup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function(enemyId, x, y) {
    XdRsDNFBarGESetup.call(this, enemyId, x, y)
    this.setupBoss();
};
Game_Enemy.prototype.setupBoss = function() {
    this._isBoss = this.isBossJudeg();
    this._level = this._enemyType = this._enemyKind = 0;
    if (!this._isBoss) return;
    var ar = this.enemy().note.match(/☆(\S*)☆/)[1].split(',')
    this._level = this._level || parseInt(ar[1]);
    this._enemyType = this._enemyType || parseInt(ar[2]);
    this._enemyKind = this._enemyKind || parseInt(ar[3]);
};
Game_Enemy.prototype.isBossJudeg = function() {
    var text = this.enemy().note;
    if (text === '') return false;
    if (text.indexOf('☆DNF_Bar') < 0) return false;
    if (!text.match(/☆(\S*)☆/)) return false;
    return true;
};
Game_Enemy.prototype.isBoss = function() {
    return this._isBoss;
};
Game_Enemy.prototype.level = function() {
    return this._level;
};
Game_Enemy.prototype.enemyType = function() {
    return this._enemyType;
};
Game_Enemy.prototype.enemyKind = function() {
    return this._enemyKind;
};
//=================================================================================
Game_Troop.prototype.boss = function() {
    for (var i=0;i<this.members().length;i++){
        if (this.members()[i].isBoss()) return this.members()[i];
    }
    return null;
};
//=================================================================================
function Xr_DnfBar() {
    this.initialize.apply(this, arguments);
}
Xr_DnfBar.prototype = Object.create(Sprite.prototype);
Xr_DnfBar.prototype.constructor = Xr_DnfBar;
Xr_DnfBar.prototype.initialize = function(enemy) {
    Sprite.prototype.initialize.call(this);
    this._uiName = 'DNF-Bar';
    this._enemy = enemy;
    this._count = 0;
    this.iniRect();
    this.createBar();
    this.move(XdrsDNFBarDate.barX, XdrsDNFBarDate.barY);
};
Xr_DnfBar.prototype.iniRect = function() {
    this._backRect = new Rectangle(0,0,637,41);
    this._barRect = new Rectangle(0,74,598,33);
    this._etRect1 = new Rectangle(598,41,31,13);
    this._etRect2 = new Rectangle(598,171,31,13);
};
Xr_DnfBar.prototype.createBar = function() {
    this.bitmap = ImageManager.loadPicture(this._uiName);
    this.setBitmap(this, this._backRect);
    this._lowBar = new Sprite(ImageManager.loadPicture(this._uiName));
    this._lowBar2 = new Sprite(ImageManager.loadPicture(this._uiName));
    this._upBar = new Sprite(ImageManager.loadPicture(this._uiName));
    this._messShow = new Sprite(new Bitmap(637,411));
    var bitmap = ImageManager.loadFace('e'+this._enemy.enemyId());
    this._messShow.bitmap.blt(bitmap,0,0,24,24,8,12);
    this.iniMomet();
    this.setPlace();
    this.addChild(this._lowBar);
    this.addChild(this._lowBar2);
    this.addChild(this._upBar);
    this.addChild(this._messShow);
};
Xr_DnfBar.prototype.iniMomet = function() {
    this._upBar.opacity = 255;
    this._mmtRect = new Rectangle(0,74,598,33);
    this.setBitmap(this._lowBar2, new Rectangle(0,0,1,0));
    this._lowBar.move(35,8);
    this.drawLowBar();
};
Xr_DnfBar.prototype.setBitmap = function(obj, rect) {
    obj.setFrame(rect.x, rect.y, rect.width, rect.height);
};
Xr_DnfBar.prototype.setPlace = function() {
    this._lowBar.move(35,8);
    this._upBar.move(35,8);
    this._lowBar2.move(36, 8);
};
Xr_DnfBar.prototype.update = function() {
    Sprite.prototype.update.call(this);
    if (this._dataHp !== this._enemy.hp) this.updateBar();
    if (XdrsDNFBarDate.barMomt > 0) return;
    if (this._count > 0) { this._count--; return;}
    if (Graphics.frameCount % 2 === 0) {
        this._mmtRect.width -= 2;
        if (this._mmtRect.width === 560) this._mmtRect.width = 598;
        this.movement();
    }
};
Xr_DnfBar.prototype.updateBar = function() {
    this._count = XdrsDNFBarDate.waitTime;
    this._dataHp = this._enemy.hp;
    this.dataCount();
    this.iniMomet();
    this.drawUpBar();
    this.setShow();
};
Xr_DnfBar.prototype.dataCount = function() {
    this._upNum = Math.ceil(this._enemy.hp / XdrsDNFBarDate.bCk);
    this._lowNum = Math.floor(this._enemy.hp / XdrsDNFBarDate.bCk);
};
Xr_DnfBar.prototype.movement = function() {
    if (this._lowNum < 1) return;
    this._upBar.opacity = 0;
    this._mmtRect.y = (this._lowNum - 1) % 5 * 33 + 74;
    var aw = 598 - this._mmtRect.width;
    var rect = new Rectangle(0,this._mmtRect.y,aw,33);
    this.setBitmap(this._lowBar2, rect);
    this._lowBar.move(35+aw, 8);
    this.setBitmap(this._lowBar, this._mmtRect);
};
Xr_DnfBar.prototype.drawLowBar = function() {
    this._barRect.width = 598;
    this._barRect.y = (this._lowNum - 1) % 5 * 33 + 74;
    this.setBitmap(this._lowBar, this._barRect);
};
Xr_DnfBar.prototype.drawUpBar = function() {
    this._barRect.y = this._lowNum % 5 * 33 + 74;
    this._barRect.width = this._enemy.hp % XdrsDNFBarDate.bCk * 598 / XdrsDNFBarDate.bCk,
    this.setBitmap(this._upBar, this._barRect);
};
Xr_DnfBar.prototype.setShow = function() {
    this._messShow.bitmap.clear();
    this.drawHead();
    this.drawType();
    this.drawMaxNum();
};
Xr_DnfBar.prototype.drawHead = function() {
    var bitmap = ImageManager.loadFace('e'+this._enemy.enemyId());
    this._messShow.bitmap.blt(bitmap,0,0,24,24,8,12);
};
Xr_DnfBar.prototype.drawType = function() {
    this._messShow.bitmap.fontSize = 14;
    this._messShow.bitmap.fontItalic = false;
    var ax = 40;
    if (this._enemy.enemyType() > 0) {
        var bitmap = ImageManager.loadPicture(this._uiName);
        this._messShow.bitmap.blt(bitmap,598,(this._enemy.enemyType()-1) * 13 + 171,31,13,ax,18);
        ax += 32;
    }
    if (this._enemy.enemyKind() > 0) {
        var bitmap = ImageManager.loadPicture(this._uiName);
        this._messShow.bitmap.blt(bitmap,598,(this._enemy.enemyKind()-1) * 13 + 41,31,13,ax,18);
        ax += 38;
    } else {ax += 6;}
    if (this._enemy.level() > 0) {
        var text = 'Lv' + this._enemy.level(),aw = this._messShow.bitmap.measureTextWidth(text);
        this._messShow.bitmap.drawText(text, ax, 12, aw, 20);
        ax += aw+8;
    }
    this._messShow.bitmap.drawText(this._enemy.name(), ax, 12, 160, 20);
};
Xr_DnfBar.prototype.drawMaxNum = function() {
    this._messShow.bitmap.fontSize = 24;
    this._messShow.bitmap.fontItalic = true;
    var text = 'x '+this._upNum, aw = this._messShow.bitmap.measureTextWidth(text);
    this._messShow.bitmap.drawText(text, 620-aw, 6, aw, 32, 2);
};
//===================================================================================
var XdRs_DB_SBCreateAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
    XdRs_DB_SBCreateAllWindows.call(this);
    this.createDNFBar();
};
Scene_Battle.prototype.createDNFBar = function() {
   this._DNGBar = null;
   if (!$gameTroop.boss()) return;
   this._DNGBar = new Xr_DnfBar($gameTroop.boss());
   this.addChild(this._DNGBar);
};
})();
//===================================================================================

Lv4.逐梦者

梦石
0
星屑
7422
在线时间
948 小时
注册时间
2017-9-27
帖子
583
2
发表于 2017-11-2 09:13:03 | 只看该作者
我猜这个插件应该是要在敌人的备注里写这样的notetag:
  1. ☆DNF_Bar
  2. ☆1,2,3☆
复制代码

第一行应该是固定格式,第二行第1个参数是BOSS等级,第2个参数是敌人Type,第3个参数是敌人Kind,但是具体每个参数是什么作用,或者你自己慢慢试,或者去问作者。
另外这插件好像还需要一张血条的图片“DNF-Bar.png”,要放到pictures目录里。
最后,插件的文件名应该是“Xr_blood_type2.js”。
回复 支持 1 反对 0

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1390
在线时间
231 小时
注册时间
2017-10-24
帖子
209
3
 楼主| 发表于 2017-11-2 10:23:05 | 只看该作者
梦想家大魔王 发表于 2017-11-2 09:13
我猜这个插件应该是要在敌人的备注里写这样的notetag:

第一行应该是固定格式,第二行第1个参数是BOSS等级 ...

加我微信q119498229,给你红包,问题解决了。只是需要一个e7的图片,我随便做了一个就可以运行了,不知道是干什么用的
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-10 06:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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