查看: 2790|回复: 1

[有事请教] 如何根据属性或则变量数值绘制槽值?

[复制链接]
梦石
0
星屑
143
在线时间
21 小时
注册时间
2018-7-25
回帖
15
发表于 2019-3-16 10:55:56 | 显示全部楼层 |阅读模式

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

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

×
最近在魔改战斗界面的时候发现属性条目用类似HP\MP\TP的槽值来表现更为直观。
想要对照
[pre lang="javascript"]Window_Base.prototype.drawActorTP = function(actor, x, y, width) {
    width = width || 184;
    var color1 = this.tpGaugeColor1();
    var color2 = this.tpGaugeColor2();
    this.drawGauge(x, y, width, actor.tpRate(), color1, color2);
    this.changeTextColor(this.systemColor());
    this.drawText(TextManager.tpA, x, y, 44);
    this.changeTextColor(this.tpColor(actor));
    this.drawText(actor.tp, x + width - 64, y, 64, 'right');
};[/pre]
来写一个根据变量属性(满值999)在战斗中动态调整的槽值。

单纯的写成“变量Rate”当然会提示没有定义,但是发现actor.tpRate()这个比例条目类型在系统插件里面找不到写法,想要仿写一个定义有有点儿不知道肿么写,希望大佬指点谢谢。

PS:没有使用市面已有的系列插件,因为用不上那么多功能。。。
个人公众号:苍极
抖音号:手游鉴毒师
游戏行业边缘人,谢谢关注~
梦石
0
星屑
143
在线时间
21 小时
注册时间
2018-7-25
回帖
15
 楼主| 发表于 2019-3-16 11:56:17 | 显示全部楼层
本帖最后由 游鱼戏虾 于 2019-3-16 12:01 编辑

照着大佬的教程,自己搞了一个出来,谢谢大家23333
[pre lang="javascript"]Window_NEWBattleStatus.prototype.drawsxcz = function(x, y) {
    var color1 = this.textColor(0);
    var color2 = this.textColor(20);
    var v1 = $gameVariables.value(1);
    var v2 = 999;
        var rate = v1 / v2;
        var width = 300;
        var fill = Math.floor(width * rate)
        this.contents.fillRect(x, y ,width,5,color1)
        this.contents.gradientFillRect(x, y ,fill ,5,color2,color2)
};[/pre]
但是这个只是针对1个变量的槽值。。。一个个写实在是...
如果大佬能告诉我如何用$gameVariables.value(i)和i++来直接写一列的属性槽就更好了。
个人公众号:苍极
抖音号:手游鉴毒师
游戏行业边缘人,谢谢关注~
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部