I'll help you create a script that makes enemies attack independently on a timer without waiting for player input. This will create a real-time battle system for enemies while keeping everything else the same.
Here's a plugin script for RPG Maker MV:
/*:
* @plugindesc Real-Time Enemy Attacks v1.0
* @author YourName
*
* @help
* This plugin makes enemies attack randomly every 4-6 seconds
* without waiting for player input. Enemies will use random
* skills from their action patterns.
*
* Place this plugin in your js/plugins folder and activate it
* in the Plugin Manager.
*/
(function() {
// Store original battle system functions
var _BattleManager_update = BattleManager.update;
var _Game_Enemy_makeActions = Game_Enemy.prototype.makeActions;
// Add enemy timers
BattleManager._enemyTimers = {};
// Initialize enemy timers when battle starts
var _BattleManager_startBattle = BattleManager.startBattle;
BattleManager.startBattle = function() {
_BattleManager_startBattle.call(this);
this.initializeEnemyTimers();
};
// Initialize timers for all enemies
BattleManager.initializeEnemyTimers = function() {
this._enemyTimers = {};
$gameTroop.members().forEach(function(enemy) {
if (enemy.isAlive()) {
// Random initial delay between 1-3 seconds
this._enemyTimers[enemy.index()] = Math.randomInt(180) + 60;
}
}, this);
};
// Update battle and enemy timers
BattleManager.update = function() {
_BattleManager_update.call(this);
// Only process enemy timers during battle
if (this._phase === 'turn' || this._phase === 'action') {
this.updateEnemyTimers();
}
};
// Update all enemy timers
BattleManager.updateEnemyTimers = function() {
$gameTroop.members().forEach(function(enemy) {
if (enemy.isAlive() && !enemy.isActing()) {
var index = enemy.index();
// Decrease timer
if (this._enemyTimers[index] > 0) {
this._enemyTimers[index]--;
}
// When timer reaches 0, make enemy attack
if (this._enemyTimers[index] <= 0) {
this.forceEnemyAction(enemy);
// Reset timer to 4-6 seconds (240-360 frames)
this._enemyTimers[index] = Math.randomInt(121) + 240;
}
}
}, this);
};
// Force an enemy to take action
BattleManager.forceEnemyAction = function(enemy) {
// Clear any existing actions
enemy.clearActions();
// Make the enemy select an action
enemy.makeActions();
// Get the enemy's action
var action = enemy.currentAction();
if (action && action.item()) {
// Set up the action
action.prepare();
// If the action needs a target, select one
if (action.needsSelection()) {
var targets = action.targetsForOpponents();
if (targets.length > 0) {
var target = targets[Math.randomInt(targets.length)];
action.setTarget(target.index());
}
}
// Execute the action immediately
this.processForcedAction(enemy, action);
}
};
// Process the forced enemy action
BattleManager.processForcedAction = function(subject, action) {
// Store current action subject
var previousSubject = this._subject;
this._subject = subject;
// Process the action
this._action = action;
// Show animation and apply effects
if (action.isValid()) {
this.startAction();
this._subject.useItem(action.item());
this.updateAction();
this.invokeAction(this._subject, action.makeTargets());
// Display action results
this._logWindow.displayAction(this._subject, action.item());
// Wait for animation
this._logWindow.wait();
this._logWindow.waitForEffect();
}
// Restore previous subject
this._subject = previousSubject;
// Clear the enemy's action
subject.clearActions();
};
// Prevent enemies from waiting for input phase
var _BattleManager_isInputting = BattleManager.isInputting;
BattleManager.isInputting = function() {
// Always return false for enemy actions so they don't wait
return _BattleManager_isInputting.call(this) && !this._subject ||
(this._subject && this._subject.isActor());
};
// Reset enemy timer when they die
var _Game_Enemy_die = Game_Enemy.prototype.die;
Game_Enemy.prototype.die = function() {
_Game_Enemy_die.call(this);
if (BattleManager._enemyTimers) {
BattleManager._enemyTimers[this.index()] = 0;
}
};
// Ensure enemies can act even during input phase
var _Game_Enemy_canMove = Game_Enemy.prototype.canMove;
Game_Enemy.prototype.canMove = function() {
return this.isAlive() && !this.isRestricted();
};
})();
To use this plugin:
- Copy the code above and save it as a .js file (for example:
RealTimeEnemyAttacks.js)
- Place the file in your project's
js/plugins/ folder
- Open RPG Maker MV and go to the Plugin Manager
- Add the plugin and make sure it's turned ON
- Place it near the bottom of your plugin list to ensure compatibility
The plugin works by:
- Giving each enemy an independent timer that counts down from 4-6 seconds
- When a timer reaches 0, the enemy automatically uses a random skill from their action patterns
- The enemy doesn't wait for player input - they attack whenever their timer is up
- All normal skill effects, animations, and damage calculations work as usual
- Player characters remain unchanged and work normally
The enemies will now attack continuously during battle without waiting for your turn, creating a more dynamic combat experience!