Im trying to make a skill (We'll call it Qkill) that copies and performs the last skill an ally or enemy has used in combat, whatever the most recent skill before Qkill is selected was, gets used.
I wrote this but I dont know if its right, I have a few other things going on in this skill.
<Instant Cast>
<Custom Requirement>
value = $gameVariables.value(6) < 7;
</Custom Requirement>
<After Eval>
$gameVariables.setValue(6, $gameVariables.value(6) + 1);
</After Eval>
<Custom Action>
if (BattleManager._actionHistory && BattleManager._actionHistory.length > 0) {
var lastAction = BattleManager._actionHistory[BattleManager._actionHistory.length - 1];
var skill = lastAction.item();
if (skill && skill.id !== this.item().id) {
var targetIndex = lastAction._targetIndex >= 0 ? lastAction._targetIndex : 0;
BattleManager.forceAction(user, skill.id, targetIndex);
BattleManager._phase = 'input';
} else {
value = false;
}
} else {
value = false;
}
</Custom Action>
I was told to make this plugin to call upon a certain state so that it would work properly
(() => {
const _Game_Battler_useItem = Game_Battler.prototype.useItem;
Game_Battler.prototype.useItem = function(item) {
BattleManager._actionHistory = BattleManager._actionHistory || [];
BattleManager._actionHistory.push(this._actions[0]);
_Game_Battler_useItem.call(this, item);
};
})();
Please help.
I wrote this but I dont know if its right, I have a few other things going on in this skill.
<Instant Cast>
<Custom Requirement>
value = $gameVariables.value(6) < 7;
</Custom Requirement>
<After Eval>
$gameVariables.setValue(6, $gameVariables.value(6) + 1);
</After Eval>
<Custom Action>
if (BattleManager._actionHistory && BattleManager._actionHistory.length > 0) {
var lastAction = BattleManager._actionHistory[BattleManager._actionHistory.length - 1];
var skill = lastAction.item();
if (skill && skill.id !== this.item().id) {
var targetIndex = lastAction._targetIndex >= 0 ? lastAction._targetIndex : 0;
BattleManager.forceAction(user, skill.id, targetIndex);
BattleManager._phase = 'input';
} else {
value = false;
}
} else {
value = false;
}
</Custom Action>
I was told to make this plugin to call upon a certain state so that it would work properly
(() => {
const _Game_Battler_useItem = Game_Battler.prototype.useItem;
Game_Battler.prototype.useItem = function(item) {
BattleManager._actionHistory = BattleManager._actionHistory || [];
BattleManager._actionHistory.push(this._actions[0]);
_Game_Battler_useItem.call(this, item);
};
})();
Please help.