the following plugins are code chatgpt coded for me but clearly something went wrong as it kept flinging errors at me, i even had the ai annalyze yanfly's atb code and it made a "compatablity patch" which failed...the ai advised me to seek help so here i am...
and the "compatibility patch"
I understand this ia complicated matter but i would love some assistance as i am not code savy...hense me running to an AI for help...
// ChargeCombatPlugin.js
/*:
* @plugindesc RPG Maker MV Charge Combat Plugin - Allows charging actions, interruption, and temporary status effects upon interruption.
* @author Your Name
*
* @param Interrupt Skill ID
* @desc The ID of the skill that can interrupt charging.
* @default 2
*
* @param Status ID
* @desc The ID of the status effect that afflicts a damage multiplier.
* @default 1
*
* @param Interrupted Status ID
* @desc The ID of the temporary status effect upon interruption.
* @default 2
*
* @param Charging Turns
* @desc Number of turns required to charge the skill.
* @default 3
*
* @param Status Turns
* @desc Number of turns the status effect lasts.
* @default 2
*
* @help
* This is a plugin for RPG Maker MV that allows charging actions, interruption,
* and temporary status effects upon interruption.
*/
(function() {
'use strict';
var parameters = PluginManager.parameters('ChargeCombatPlugin');
var interruptSkillId = Number(parameters['Interrupt Skill ID'] || 2);
var statusId = Number(parameters['Status ID'] || 1);
var interruptedStatusId = Number(parameters['Interrupted Status ID'] || 2);
var chargingTurns = Number(parameters['Charging Turns'] || 3);
var statusTurns = Number(parameters['Status Turns'] || 2);
var _Game_Action_setSubject = Game_Action.prototype.setSubject;
Game_Action.prototype.setSubject = function(subject) {
_Game_Action_setSubject.call(this, subject);
if (subject && subject.isActor() && this.item() && this.item().meta.chargeSkill) {
subject._chargedSkill = this.item().id;
}
};
var _Scene_Battle_commandSkill = Scene_Battle.prototype.commandSkill;
Scene_Battle.prototype.commandSkill = function() {
var skill = this._skillWindow.item();
if (skill && skill.meta.chargeSkill && this._actor._chargedSkill === skill.id) {
this._actor._chargedSkill = 0;
this._actor._chargedTurns = 0;
this._actor._interrupted = false;
}
_Scene_Battle_commandSkill.call(this);
};
var _Game_Battler_onAllActionsEnd = Game_Battler.prototype.onAllActionsEnd;
Game_Battler.prototype.onAllActionsEnd = function() {
_Game_Battler_onAllActionsEnd.call(this);
this._interrupted = false;
};
var _Game_Battler_onTurnEnd = Game_Battler.prototype.onTurnEnd;
Game_Battler.prototype.onTurnEnd = function() {
_Game_Battler_onTurnEnd.call(this);
if (this._chargedSkill !== 0) {
this._chargedTurns++;
if (this._chargedTurns >= chargingTurns) {
this.useSkill(this._chargedSkill);
this._chargedSkill = 0;
this._chargedTurns = 0;
}
}
if (this._statusTurns > 0) {
this._statusTurns--;
if (this._statusTurns === 0) {
this.removeState(statusId);
}
}
};
var _Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd;
Game_Battler.prototype.onBattleEnd = function() {
_Game_Battler_onBattleEnd.call(this);
this._chargedSkill = 0;
this._chargedTurns = 0;
this._interrupted = false;
this._statusTurns = 0;
};
var _Game_Battler_canUse = Game_Battler.prototype.canUse;
Game_Battler.prototype.canUse = function(item) {
if (item && item.id === interruptSkillId) {
return !this._interrupted && _Game_Battler_canUse.call(this, item);
}
return _Game_Battler_canUse.call(this, item);
};
var _Game_Battler_useItem = Game_Battler.prototype.useItem;
Game_Battler.prototype.useItem = function(item) {
if (item && item.id === interruptSkillId) {
this._interrupted = true;
this.addState(interruptedStatusId);
this._statusTurns = statusTurns;
}
_Game_Battler_useItem.call(this, item);
};
var _Window_BattleLog_displayActionResults = Window_BattleLog.prototype.displayActionResults;
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
if (target && target.isEnemy() && target._interrupted) {
this.push('addText', target.name() + ' was interrupted!');
target._interrupted = false;
}
_Window_BattleLog_displayActionResults.call(this, subject, target);
};
// Compatibility with Yanfly's ATB plugin
if (Imported.YEP_X_BattleSysATB) {
var _Scene_Battle_startActorCommandSelection = Scene_Battle.prototype.startActorCommandSelection;
Scene_Battle.prototype.startActorCommandSelection = function() {
if (!BattleManager.isInputting() && BattleManager.actor()) {
BattleManager.actor().clearChargedSkill();
}
_Scene_Battle_startActorCommandSelection.call(this);
};
Game_Actor.prototype.clearChargedSkill = function() {
this._chargedSkill = 0;
this._chargedTurns = 0;
this._interrupted = false;
};
}
})();
and the "compatibility patch"
//=============================================================================
// Charge Combat Plugin - Compatibility Patch for Yanfly's ATB
// by [Your Name]
// Created: [Date]
//=============================================================================
/*:
* @plugindesc Compatibility patch for Charge Combat Plugin with Yanfly's ATB.
* Requires Charge Combat Plugin and Yanfly's ATB.
* @author [Your Name]
*
* @help This plugin provides compatibility between the Charge Combat Plugin and
* Yanfly's ATB plugin. Place this plugin below both Charge Combat Plugin and
* Yanfly's ATB in the Plugin Manager.
*
* Note: This compatibility patch assumes you have configured Yanfly's ATB
* plugin properly and set up your battle system accordingly.
*/
(function() {
var parameters = PluginManager.parameters('ChargeCombatPlugin');
// Charge Combat Plugin parameters
var interruptSkillId = Number(parameters['Interrupt Skill ID'] || 0);
var interruptedStatusId = Number(parameters['Interrupted Status ID'] || 0);
var statusTurns = Number(parameters['Status Turns'] || 0);
// Compatibility with Yanfly's ATB plugin
if (Imported.YEP_X_BattleSysATB) {
var _Scene_Battle_create = Scene_Battle.prototype.create;
Scene_Battle.prototype.create = function() {
_Scene_Battle_create.call(this);
BattleManager.setStatusWindow(this._statusWindow);
};
var _Window_BattleStatus_update = Window_BattleStatus.prototype.update;
Window_BattleStatus.prototype.update = function() {
_Window_BattleStatus_update.call(this);
if (this._statusWindow) {
this._statusWindow.updateATBGauge();
}
};
Window_BattleStatus.prototype.updateATBGauge = function() {
var members = $gameParty.battleMembers();
for (var i = 0; i < this.maxItems(); i++) {
var actor = members[i];
var rect = this.itemRect(i);
var gaugeRect = new Rectangle(rect.x, rect.y, rect.width, rect.height);
this.drawActorAtbGauge(actor, gaugeRect);
}
};
Window_BattleStatus.prototype.drawActorAtbGauge = function(actor, rect) {
if (actor) {
var rate = actor.atbRate();
var color1 = this.atbGaugeColor1();
var color2 = this.atbGaugeColor2();
this.drawGauge(rect.x, rect.y, rect.width, rate, color1, color2);
}
};
BattleManager.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
};
var _Game_Battler_onTurnEnd = Game_Battler.prototype.onTurnEnd;
Game_Battler.prototype.onTurnEnd = function() {
_Game_Battler_onTurnEnd.call(this);
if (this.canMove()) {
this.updateChargeTurns();
}
};
Game_Battler.prototype.updateChargeTurns = function() {
if (this._chargedSkill) {
this._chargedTurns++;
if (this._chargedTurns >= this._chargedSkill.chargeTurns) {
this._chargedSkill = null;
this._chargedTurns = 0;
}
}
};
var _Game_Battler_addState = Game_Battler.prototype.addState;
Game_Battler.prototype.addState = function(stateId) {
_Game_Battler_addState.call(this, stateId);
if (this._chargedSkill && stateId === interruptedStatusId) {
this._chargedSkill = null;
this._chargedTurns = 0;
}
};
var _Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart;
Game_Battler.prototype.onBattleStart = function() {
_Game_Battler_onBattleStart.call(this);
this.clearChargedSkill();
};
Game_Battler.prototype.clearChargedSkill = function() {
this._chargedSkill = null;
this._chargedTurns = 0;
};
var _Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd;
Game_Battler.prototype.onBattleEnd = function() {
_Game_Battler_onBattleEnd.call(this);
this.clearChargedSkill();
};
var _Game_Action_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
_Game_Action_apply.call(this, target);
if (target && target.result().isHit() && this.isInterruptSkill()) {
target.addState(interruptedStatusId);
target.removeCurrentAction();
}
};
Game_Action.prototype.isInterruptSkill = function() {
return this.item().id === interruptSkillId;
};
var _Game_Actor_makeActions = Game_Actor.prototype.makeActions;
Game_Actor.prototype.makeActions = function() {
_Game_Actor_makeActions.call(this);
if (this.canInput()) {
this.makeChargedAction();
}
};
Game_Actor.prototype.makeChargedAction = function() {
if (this._chargedSkill) {
var action = new Game_Action(this);
action.setSkill(this._chargedSkill.skillId);
action.setCharge(this._chargedSkill.chargeTurns);
this._actions.push(action);
}
};
var _Game_Actor_setup = Game_Actor.prototype.setup;
Game_Actor.prototype.setup = function(actorId) {
_Game_Actor_setup.call(this, actorId);
this.clearChargedSkill();
};
var _Game_Action_setSubject = Game_Action.prototype.setSubject;
Game_Action.prototype.setSubject = function(subject) {
if (subject && subject.isActor()) {
var action = subject.currentAction();
if (action && action.item() && action.item().meta.chargeSkill) {
var chargeTurns = parseInt(action.item().meta.chargeTurns) || 0;
this.setCharge(chargeTurns);
}
}
_Game_Action_setSubject.call(this, subject);
};
Game_Action.prototype.setCharge = function(chargeTurns) {
if (chargeTurns > 0) {
this.subject()._chargedSkill = {
skillId: this.item().id,
chargeTurns: chargeTurns
};
}
};
}
})();
I understand this ia complicated matter but i would love some assistance as i am not code savy...hense me running to an AI for help...