查看: 2825|回复: 1

[已经解决] 这个状态插件如何改坐标

[复制链接]
梦石
0
星屑
50
在线时间
491 小时
注册时间
2015-1-7
回帖
110
发表于 2015-12-26 20:25:48 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 西姐 于 2015-12-26 20:28 编辑

我想把它改成这样的 未标题-1.png

我想把人物的立绘带入变量,我之前VA搞过,XX+变量显示立绘,这样可以让玩家选择自己想要的立绘。。

[pre lang="ruby"]//=============================================================================
// MrTS_LuminusStatus.js
//=============================================================================

/*:
* @plugindesc Luminus Status Screen. Changes how data is displayed there.
* @author Mr. Trivel
*
* @param Short Attack
* @desc Short text for Attack
* Default: ATK
* @default ATK
*
* @param Short Defense
* @desc Short text for Defense
* Default: DEF
* @default DEF
*
* @param Short MAttack
* @desc Short text for Magical Attack
* Default: MAT
* @default MAT
*
* @param Short MDefense
* @desc Short text for MDefense
* Default: MDF
* @default MDF
*
* @param Short Agility
* @desc Short text for Agility
* Default: AGI
* @default AGI
*
* @param Short Luck
* @desc Short text for Luck
* Default: LUK
* @default LUK
*
* @help
* --------------------------------------------------------------------------------
* Free for non commercial use.
* Version 1.0
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Required Files
* --------------------------------------------------------------------------------
* "img\system\LuminusBackground.png" - At least as big as screen. Background.
* "img\system\LuminusStatus.png" - 348x539 - Background for stats and equipment.
* "img\system\LuminusBar.png" - 324x48 - background for equipment.
* "img\system\LuminusSeparator.png" - 327x9 - separator bar between blocks.
* "img\system\LuminusStatusName.png" - 264x70 - Status Scene name in top right.
* "img\system\LuminusActor#.png" - any preferred size. # - Actor ID
*    E.g. LuminusActor5.png would be actor's with ID 5 image.
* "img\system\LuminusBottomBar.png" - 40height, width - as big as screen.
*    Is at the very bottom of status screen. Can be used to display controls.
*
*
* --------------------------------------------------------------------------------
* Map Tags
* --------------------------------------------------------------------------------
* <LuminusBackground: [FILENAME]>
* Luminus Status Scene background is set depending on the map you're in.
* If no tag set it uses default background - "LuminusBackground".
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/

(function() {

        var parameters = PluginManager.parameters('MrTS_LuminusStatus');
        var paramATK  = String(parameters['Short Attack']         || "ATK")
        var paramDEF  = String(parameters['Short Defense']         || "DEF")
        var paramMATK = String(parameters['Short MAttack']         || "MAT")
        var paramMDEF = String(parameters['Short MDefense'] || "MDF")
        var paramAGI  = String(parameters['Short Agility']         || "AGI")
        var paramLUK  = String(parameters['Short Luck']         || "LUK")

        Scene_Status.prototype.create = function() {
            Scene_MenuBase.prototype.create.call(this);
            this._statusWindow = new Window_Status();
            this._statusWindow.setHandler('cancel',   this.popScene.bind(this));
            this._statusWindow.setHandler('pagedown', this.nextActor.bind(this));
            this._statusWindow.setHandler('pageup',   this.previousActor.bind(this));
            this.addWindow(this._statusWindow);
            this.refreshActor();
        };

        Scene_Status.prototype.createBackground = function() {
            this._backgroundSprite = new Sprite();
            if ($dataMap.meta.LuminusBackground)
            {
                    var fileName = String($dataMap.meta.LuminusBackground);
                    if (fileName[0] == " ") fileName = fileName.substring(1);
                    this._backgroundSprite.bitmap = ImageManager.loadSystem(fileName);
            }
            else
                    this._backgroundSprite.bitmap = ImageManager.loadSystem("LuminusBackground");
            this.addChild(this._backgroundSprite);

            this._statusBackground = new Sprite();
            this._statusBackground.bitmap = ImageManager.loadSystem("LuminusStatus");
            this._statusBackground.x = 30;
            this._statusBackground.y = Graphics.boxHeight/2 - 540/2;
            this.addChild(this._statusBackground);

            this._actorSprite = new Sprite()
            this.addChild(this._actorSprite);

            this._barSprites = [];
            var equips = $gameActors.actor(1).equips();
            for (var i = 0; i < equips.length; i++) {
                    var sprite = new Sprite();
                    sprite.bitmap = ImageManager.loadSystem("LuminusBar");
                    sprite.x = this._statusBackground.x + 9;
                    sprite.y = this._statusBackground.y + 250 + 48*i;
                        this.addChild(sprite);
            };

            this._bottomBarSprite = new Sprite();
            this._bottomBarSprite.bitmap = ImageManager.loadSystem("LuminusBottomBar");
            this._bottomBarSprite.y = Graphics.boxHeight - 40;
            this.addChild(this._bottomBarSprite);

            this._statusName = new Sprite();
            this._statusName.bitmap = ImageManager.loadSystem("LuminusStatusName");
            var sprite = this._statusName;
            sprite.bitmap.addLoadListener(function() {
                    sprite.x = Graphics.width - sprite.width;
            });
            this.addChild(this._statusName);
        };

        Scene_Status.prototype.refreshActor = function() {
            var actor = this.actor();
            this._statusWindow.setActor(actor);
            var actorSprite = this._actorSprite;
            var statusSprite = this._statusBackground;
            
            actorSprite.bitmap = ImageManager.loadSystem("LuminusActor" + actor.actorId());
            actorSprite.bitmap.addLoadListener(function() {
                    var w = Graphics.boxWidth - statusSprite.x - statusSprite.width;
                    var x = statusSprite.x + statusSprite.width;
                    var y = Graphics.boxHeight - actorSprite.height;
                    if (y < 0) y = 0;
                    actorSprite.x = x + w/2 - actorSprite.width/2;
                    actorSprite.y = y;
            });
        };

        Window_Status.prototype.initialize = function() {
            var width = Graphics.boxWidth;
            var height = Graphics.boxHeight;
            Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
            this.refresh();
            this.activate();
            this.opacity = 0;
        };

        Window_Status.prototype.refresh = function() {
            this.contents.clear();

            var positions = [];
            var x = 30 - this.standardPadding();

            if (this._actor) {
                    var actor = this._actor;
                var lineHeight = this.lineHeight();
                
                var y = Graphics.boxHeight/2 - 540/2 - this.standardPadding() + 8;
                var mw = 348/2;
                this.drawText(TextManager.levelA, x + 9, y);
                this.drawText(actor.level, x, y, mw - 6, 'right');
                this.drawText(actor.name(), x + mw, y, mw, 'center');

                y += lineHeight;
                this.drawText(TextManager.exp, x + 9, y, mw - 6);
                var exp = (actor.currentExp()-actor.currentLevelExp()) + "/" + (actor.nextLevelExp()-actor.currentLevelExp());
                this.drawText(exp, x, y, mw*2-12, 'right');

                y += lineHeight;
                this.drawText(TextManager.hpA, x + 9, y);
                var hp = actor.hp + "/" + actor.mhp;
                var whp = this.textWidth(hp);
                this.drawText(hp, x, y, mw - 6, 'right');
                this.drawText(TextManager.mpA, x + mw + 6, y);
                var mp = actor.mp + "/" + actor.mmp;
                this.drawText(mp, mw, y, mw, 'right');

                y += lineHeight;
                positions.push(y)
                
                y += lineHeight/3;
                var sw = mw  - this.textWidth(paramATK);
                var swx = this.textWidth(paramATK);
                this.drawText(paramATK, x + 9, y);
                this.drawText(actor.atk, x + swx, y, sw, 'center');
                this.drawText(paramDEF, x + mw + 6, y);
                this.drawText(actor.def, mw + swx, y, sw, 'center');

                y += lineHeight;
                this.drawText(paramMATK, x + 9, y);
                this.drawText(actor.mat, x + swx, y, sw, 'center');
                this.drawText(paramMDEF, x + mw + 6, y);
                this.drawText(actor.mdf, mw + swx, y, sw, 'center');

                y += lineHeight;
                this.drawText(paramAGI, x + 9, y);
                this.drawText(actor.agi, x + swx, y, sw, 'center');
                this.drawText(paramLUK, x + mw + 6, y);
                this.drawText(actor.luk, mw + swx, y, sw, 'center');

                y += lineHeight;
                positions.push(y);

                y += lineHeight/3+2;
                var equips = this._actor.equips();
                    var count = Math.min(equips.length, this.maxEquipmentLines());
                    for (var i = 0; i < count; i++) {
                            this.drawItemName(equips, x + 18, y + 48 * i + 6);
                    }
            }

            var bitmapSeparator = ImageManager.loadSystem("LuminusSeparator");
            var c = this.contents;
            bitmapSeparator.addLoadListener(function() {
                    for (var i = 0; i < positions.length; i ++)
                            c.blt(bitmapSeparator, 0, 0, bitmapSeparator.width, bitmapSeparator.height, x + 9, positions);
            });
        };

        Window_Status.prototype.drawVertLine = function(x) {
            this.contents.paintOpacity = 48;
            this.contents.fillRect(x, 0, 2, this.contentsHeight(), this.lineColor());
            this.contents.paintOpacity = 255;
        };
})();
[/pre]
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-12-26 20:38:15 | 显示全部楼层
  actorSprite.bitmap = ImageManager.loadSystem("LuminusActor" + actor.actorId());
            actorSprite.bitmap.addLoadListener(function() {
                    var w = Graphics.boxWidth - statusSprite.x - statusSprite.width;
                    var x = statusSprite.x + statusSprite.width;
                    var y = Graphics.boxHeight - actorSprite.height;
                    if (y < 0) y = 0;
                    actorSprite.x = x + w/2 - actorSprite.width/2;
                    actorSprite.y = y;
            });
这一句?

点评

多谢,刚发完帖子,我就搜到怎么带入变量了。。。。  发表于 2015-12-26 20:54

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 /w\

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部