お世話になります。
RPGツクールMVでメニュー画面で
スキルやアイテムを使用し回復を
行った際に対象キャラのフェイスに
回復アニメーションを表示させたいの
ですが、やり方がわかりません。
画面全体をフラッシュする
演出だけでも構いません。
現状はSEのみが鳴り回復処理は
ちゃんと出来るのですが…
どなたか御指南お願い致します。
メニュー画面で回復演出
Re: メニュー画面で回復演出
どうもこんばんは。
ここまで返信がつかない事で察しがつくとは思いますけどどちらも意外に難しい話ですね。
アニメーション再生の対象を指定するにはSprite_Baseというものが
フラッシュ(画面演出)にはSpriteset_Baseというものが必要不可欠ですが
どちらもメニュー画面系ではサポートしていないものです。
一から書くには車輪の再発明になり、既存のシステムを流用すると歪つな構造になります。
一番手軽な改造はSpriteset_Baseから
下地の透明化とピクチャー・タイマーの生成を無効化したフィルターを追加する方法ですかね。
未だ余計な機能まで付随しているので、どんな副作用が発生するか分かりませんけどね。
アニメーションの再生を可能にしたコードも試作しましたけど
実際に動かしてみるとサイズ感が合わなかったり演出過剰でしっくり来なかったのでボツにしました。
まぁ、参考程度に。
ここまで返信がつかない事で察しがつくとは思いますけどどちらも意外に難しい話ですね。
アニメーション再生の対象を指定するにはSprite_Baseというものが
フラッシュ(画面演出)にはSpriteset_Baseというものが必要不可欠ですが
どちらもメニュー画面系ではサポートしていないものです。
一から書くには車輪の再発明になり、既存のシステムを流用すると歪つな構造になります。
一番手軽な改造はSpriteset_Baseから
下地の透明化とピクチャー・タイマーの生成を無効化したフィルターを追加する方法ですかね。
未だ余計な機能まで付随しているので、どんな副作用が発生するか分かりませんけどね。
コード: 全て選択
(() => {
'use strict'
class FlashFilter extends Spriteset_Base {
createBaseSprite() {
super.createBaseSprite();
this._blackScreen.opacity = 0;
}
createPictures() {}
createTimer() {}
};
const _Scene_ItemBase_create = Scene_ItemBase.prototype.create;
Scene_ItemBase.prototype.create = function() {
_Scene_ItemBase_create.apply(this, arguments);
this._flashFilter = new FlashFilter();
this.addChild(this._flashFilter);
};
const _Scene_ItemBase_update = Scene_ItemBase.prototype.update;
Scene_ItemBase.prototype.update = function() {
_Scene_ItemBase_update.apply(this, arguments);
$gameScreen.update();
};
const _Scene_ItemBase_useItem = Scene_ItemBase.prototype.useItem;
Scene_ItemBase.prototype.useItem = function() {
const color = [255, 255, 255, 128];
$gameScreen.startFlash(color, 30);
_Scene_ItemBase_useItem.apply(this, arguments);
};
})();
実際に動かしてみるとサイズ感が合わなかったり演出過剰でしっくり来なかったのでボツにしました。
まぁ、参考程度に。
コード: 全て選択
(() => {
'use strict'
const _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
Window_MenuActor.prototype.initialize = function() {
this._animationTargets = [];
_Window_MenuActor_initialize.apply(this, arguments);
};
const _Window_MenuActor_drawItemImage = Window_MenuActor.prototype.drawItemImage;
Window_MenuActor.prototype.drawItemImage = function(index) {
_Window_MenuActor_drawItemImage.apply(this, arguments);
const sprite = new Sprite_Base();
sprite.bitmap = new Bitmap(Window_Base._faceWidth, Window_Base._faceHeight);
sprite.anchor.x = 0.5;
sprite.anchor.y = 1.0;
this._animationTargets.push(sprite);
};
Window_MenuActor.prototype.animationTargetsUpdatePlacement = function() {
this._animationTargets.forEach((sprite, index) => {
const rect = this.itemRect(index);
sprite.x = this.x + this._windowContentsSprite.x + rect.x + 1 + Window_Base._faceWidth / 2;
sprite.y = this.y + this._windowContentsSprite.y + rect.y + 1 + Window_Base._faceHeight;
});
};
const _Window_MenuActor_update = Window_MenuActor.prototype.update;
Window_MenuActor.prototype.update = function() {
_Window_MenuActor_update.apply(this, arguments);
this._animationTargets.forEach(sprite => sprite.update());
};
Window_MenuActor.prototype.startAnimation = function(animationId, targets) {
const animation = $dataAnimations[animationId];
targets.map(actor => $gameParty.allMembers().indexOf(actor)).forEach(index => {
this._animationTargets[index].startAnimation(animation);
});
};
const _Scene_ItemBase_createActorWindow = Scene_ItemBase.prototype.createActorWindow;
Scene_ItemBase.prototype.createActorWindow = function() {
_Scene_ItemBase_createActorWindow.apply(this, arguments);
this._actorWindow._animationTargets.forEach(sprite => this.addChild(sprite));
};
const _Scene_ItemBase_showSubWindow = Scene_ItemBase.prototype.showSubWindow;
Scene_ItemBase.prototype.showSubWindow = function(window) {
_Scene_ItemBase_showSubWindow.apply(this, arguments);
this._actorWindow.animationTargetsUpdatePlacement();
};
Scene_ItemBase.prototype.useItem = function() {
this._actorWindow.startAnimation(45, this.itemTargetActors());
this.user().useItem(this.item());
this.applyItem();
this.checkCommonEvent();
this.checkGameover();
this._actorWindow.refresh();
};
})();
Re: メニュー画面で回復演出
ご回答有難う御座います!
まさかその様な処理になっていたとは!
意外に難しいのですね…
スクリプトまで書いていただき
ありがとうございます!
書いて頂いたスクリプトを使いつつ
試行錯誤してやってみます!
ありがとうございました!
まさかその様な処理になっていたとは!
意外に難しいのですね…
スクリプトまで書いていただき
ありがとうございます!
書いて頂いたスクリプトを使いつつ
試行錯誤してやってみます!
ありがとうございました!