查看: 3010|回复: 10

[有事请教] 怎么更改技能动画的层级?

[复制链接]
梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
发表于 2022-3-25 02:27:06 | 显示全部楼层 |阅读模式

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

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

×
技能动画都是显示在人物或敌人图的上层,我要做一些光环类的技能,但是动画会遮盖人物
有什么办法改变这个动画的层级? 让它在人物下层
梦石
0
星屑
7771
在线时间
1525 小时
注册时间
2013-12-3
回帖
303
发表于 2022-3-25 22:58:51 | 显示全部楼层
  1. Sprite_Animation.prototype.initMembers = function() {
  2.     this._targets = [];
  3.     this._animation = null;
  4.     this._mirror = false;
  5.     this._delay = 0;
  6.     this._previous = null;
  7.     this._effect = null;
  8.     this._handle = null;
  9.     this._playing = false;
  10.     this._started = false;
  11.     this._frameIndex = 0;
  12.     this._maxTimingFrames = 0;
  13.     this._flashColor = [0, 0, 0, 0];
  14.     this._flashDuration = 0;
  15.     this._viewportSize = 4096;
  16.     this.z = 8;
  17. };
复制代码


给动画加个字段 根据这个字段调整Sprite_Animation类的.z
默认是8 改成0就到角色下层去了
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
 楼主| 发表于 2022-3-26 02:29:32 | 显示全部楼层
HM495 发表于 2022-3-25 22:58
给动画加个字段 根据这个字段调整Sprite_Animation类的.z
默认是8 改成0就到角色下层去了 ...

不会... 这个要怎么加
回复

使用道具 举报

梦石
0
星屑
7771
在线时间
1525 小时
注册时间
2013-12-3
回帖
303
发表于 2022-3-26 09:15:17 | 显示全部楼层
本帖最后由 HM495 于 2022-3-26 09:19 编辑
dabaxhei 发表于 2022-3-26 02:29
不会... 这个要怎么加


我只会比较暴力一点的做法
找到rmmz_sprites.js的Spriteset_Base.prototype.createAnimationSprite这个方法
大概在3267行

改成
  1. Spriteset_Base.prototype.createAnimationSprite = function(
  2.     targets, animation, mirror, delay
  3. ) {
  4.     const mv = this.isMVAnimation(animation);
  5.     const sprite = new (mv ? Sprite_AnimationMV : Sprite_Animation)();
  6.     const targetSprites = this.makeTargetSprites(targets);
  7.     const baseDelay = this.animationBaseDelay();
  8.     const previous = delay > baseDelay ? this.lastAnimationSprite() : null;
  9.     if (this.animationShouldMirror(targets[0])) {
  10.         mirror = !mirror;
  11.     }
  12.     sprite.targetObjects = targets;
  13.     sprite.setup(targetSprites, animation, mirror, delay, previous);

  14.     const lowerLayerAnimationList = [1,2,3,4];//数组里填你要显示在角色层之下的动画ID
  15.     sprite.z = lowerLayerAnimationList.includes(sprite._animation.id) ? 0 : 8;

  16.     this._effectsContainer.addChild(sprite);
  17.     this._animationSprites.push(sprite);
  18. };
复制代码


如果其他插件没动这段的话这样就行
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
 楼主| 发表于 2022-3-26 17:56:45 | 显示全部楼层
HM495 发表于 2022-3-26 09:15
我只会比较暴力一点的做法
找到rmmz_sprites.js的Spriteset_Base.prototype.createAnimationSpri ...

新建了个项目试了下,还是不行
回复

使用道具 举报

梦石
0
星屑
7771
在线时间
1525 小时
注册时间
2013-12-3
回帖
303
发表于 2022-3-26 20:06:53 | 显示全部楼层
dabaxhei 发表于 2022-3-26 17:56
新建了个项目试了下,还是不行

我试了下可以啊
那个id是动画id 不是技能id 没填错吧
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
 楼主| 发表于 2022-3-27 17:58:47 | 显示全部楼层
HM495 发表于 2022-3-26 20:06
我试了下可以啊
那个id是动画id 不是技能id 没填错吧

嗯 没填错
回复

使用道具 举报

梦石
0
星屑
34459
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2022-3-28 08:52:30 | 显示全部楼层
是这样?
在动画名字里备注 <Lower>  , 这个动画就显示到人物脚下。

[pre lang="javaScript"]//=================================================================================================
;(() => {
//=================================================================================================
Sprite_Animation.prototype.isLower = function() {
    return this._animation && /<Lower>/.test(this._animation.name);
};
//=================================================================================================
Sprite_AnimationMV.prototype.isLower = function() {
    return this._animation && /<Lower>/.test(this._animation.name);
};
//=================================================================================================
const XR_Spriteset_Battle_createBattleField = Spriteset_Battle.prototype.createBattleField;
Spriteset_Battle.prototype.createBattleField = function() {
    XR_Spriteset_Battle_createBattleField.call(this);
    this._effectsContainer.lowerLayer = new Sprite();
    this._effectsContainer.addChild(this._effectsContainer.lowerLayer);
    this._effectsContainer.addChild = (child) => {
        if (child && child.isLower && child.isLower()) {
            this._effectsContainer.lowerLayer.addChild(child);
        } else Sprite.prototype.addChild.call(this._effectsContainer, child);
    };
    this._effectsContainer.removeChild = (child) => {
        if (child && child.isLower && child.isLower()) {
            this._effectsContainer.lowerLayer.removeChild(child);
        } else Sprite.prototype.removeChild.call(this._effectsContainer, child);
    };
};
//=================================================================================================
})();
//=================================================================================================[/pre]
xp vx va mv  va mz 各类型脚本/插件定制
回复 0 1

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
 楼主| 发表于 2022-3-28 19:48:09 | 显示全部楼层
芯☆淡茹水 发表于 2022-3-28 08:52
是这样?
在动画名字里备注   , 这个动画就显示到人物脚下。

谢谢大佬 解决了
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
 楼主| 发表于 2022-3-28 20:13:28 | 显示全部楼层
芯☆淡茹水 发表于 2022-3-28 08:52
是这样?
在动画名字里备注   , 这个动画就显示到人物脚下。

和VisuMZ_Battle Core有冲突...怎么办?

点评

不知道别人是怎么魔改的战斗,那就没办法了  发表于 2022-3-28 22:53
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部