確認お願いします
https://www.youtube.com/watch?v=qO6ZxlCx10M
敵がダメージを受けたときに指定したスイッチをONにします
/*
2023 DoujinRuis
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
/*:
* @plugindesc 敵がダメージを受けたときに指定したスイッチをONにします
* @author DoujinRuis
*
* @param DamageSwitch
* @text ダメージスイッチ
* @desc 敵がダメージを受けたときにONにするスイッチの番号
* @type switch
* @default 1
*
* @help
* このプラグインを有効にすると、バトルシーンで敵がダメージを受けたときに
* 指定したスイッチをONにします。
*/
(() => {
const parameters = PluginManager.parameters('TurnOnSwitchWhenEnemyDamaged');
const damageSwitchId = Number(parameters['DamageSwitch']);
const _Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
Game_Enemy.prototype.performDamage = function() {
// スイッチをONにする
$gameSwitches.setValue(damageSwitchId, true);
_Game_Enemy_performDamage.call(this);
};
})();
バトルシーンで最後に攻撃した敵のHPを変数に入れます
/*
2023 DoujinRuis
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
/*:
* @plugindesc バトルシーンで最後に攻撃した敵のHPを変数に入れます
* @author ChatGPT
*
* @param HPVariableID
* @text HPの変数ID
* @desc 最後に攻撃した敵のHPを保存する変数のID
* @type variable
* @default 1
*
* @help
* このプラグインを有効にすると、バトルシーンでアクターによって最後に攻撃された
* 敵の現在のHPが指定したゲーム変数に保存されます。
*/
(() => {
const parameters = PluginManager.parameters('SaveLastAttackedEnemyHP');
const hpVariableId = Number(parameters['HPVariableID']);
const _Game_Action_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
_Game_Action_apply.call(this, target);
if(target.isEnemy()) {
$gameVariables.setValue(hpVariableId, target.hp);
}
};
})();