Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Mercury Lock Party Leader
- // Merc_LockPartyLeader.js
- //=============================================================================
- var Imported = Imported || {};
- Imported.Merc_LockPartyLeader = true;
- var Mercury = Mercury || {};
- Mercury.LockPartyLeader = Mercury.LockPartyLeader || {};
- Mercury.LockPartyLeader.version = 1.00;
- /*:
- * @target MZ
- * @plugindesc [Version 1.00] Lock Party Leader
- * @author Mercury
- *
- * @param isLockEnabled
- * @text Lock Enabled
- * @desc Whether or not to lock the party leader by default.
- * @type boolean
- * @default true
- *
- * @command setLock
- * @text Set Lock
- * @desc Enable or disable the lock on the party leader.
- *
- * @arg enabled
- * @text Enabled
- * @desc Whether to enable the lock (true) or disable it (false).
- * @type boolean
- * @default true
- *
- * @command setLeader
- * @text Set Leader
- * @desc Change which party member is considered the leader.
- *
- * @arg actorId
- * @text Actor ID
- * @desc The ID of the actor to set as the leader.
- * @type actor
- * @default 1
- *
- * @command openFormation
- * @text Open Formation Menu
- * @desc Open the party formation menu.
- *
- * @help
- *
- * ------------------------------------------------------------------------
- * Information
- * ------------------------------------------------------------------------
- * This plugin allows you to lock the party leader in the party formation menu.
- *
- * There is also a plugin command to enable or disable the lock, and a plugin command
- * to change which actor is considered the leader. I have also included a plugin
- * command that allows you to open the party formation menu directly from an event.
- *
- * ------------------------------------------------------------------------
- * Terms of Use
- * ------------------------------------------------------------------------
- * - Free for commercial and non-commercial use.
- * - You may do whatever you want with this plugin, aside from directly selling it.
- */
- //=============================================================================
- // Settings
- //=============================================================================
- Mercury.LockPartyLeader.parameters = PluginManager.parameters('Merc_LockPartyLeader');
- Mercury.LockPartyLeader.isLockEnabled = Mercury.LockPartyLeader.parameters['isLockEnabled'] === 'true';
- Mercury.LockPartyLeader.needFormationMenu = false;
- //=============================================================================
- // Plugin Commands
- //=============================================================================
- PluginManager.registerCommand('Merc_LockPartyLeader', 'setLock', function(args) {
- Mercury.LockPartyLeader.isLockEnabled = args.enabled === 'true';
- });
- PluginManager.registerCommand('Merc_LockPartyLeader', 'setLeader', function(args) {
- $gameParty.setLeader(Number(args.actorId));
- });
- PluginManager.registerCommand('Merc_LockPartyLeader', 'openFormation', function() {
- Mercury.LockPartyLeader.needFormationMenu = true;
- SceneManager.push(Scene_Menu);
- });
- //=============================================================================
- // Game_Actor
- //=============================================================================
- Mercury.LockPartyLeader.Game_Actor_isFormationChangeOk = Game_Actor.prototype.isFormationChangeOk;
- Game_Actor.prototype.isFormationChangeOk = function() {
- if (Mercury.LockPartyLeader.isLockEnabled && this.index() === 0) {
- return false;
- }
- return Mercury.LockPartyLeader.Game_Actor_isFormationChangeOk.call(this);
- };
- //=============================================================================
- // Game_Party
- //=============================================================================
- Game_Party.prototype.setLeader = function(actorId) {
- const actorIndex = this._actors.indexOf(actorId);
- if (actorIndex > -1) {
- this.swapOrder(0, actorIndex);
- } else {
- console.warn(`Actor ID ${actorId} is not in the party.`);
- }
- };
- //=============================================================================
- // Scene_Menu
- //=============================================================================
- Mercury.LockPartyLeader.Scene_Menu_start = Scene_Menu.prototype.start;
- Scene_Menu.prototype.start = function() {
- Mercury.LockPartyLeader.Scene_Menu_start.call(this);
- if (Mercury.LockPartyLeader.needFormationMenu) {
- this._commandWindow.selectSymbol('formation');
- this._commandWindow.deactivate();
- this.commandFormation();
- Mercury.LockPartyLeader.needFormationMenu = false;
- }
- };
- //=============================================================================
- // Window_MenuCommand
- //=============================================================================
- Mercury.LockPartyLeader.Window_MenuCommand_needsCommand = Window_MenuCommand.prototype.needsCommand;
- Window_MenuCommand.prototype.needsCommand = function(name) {
- if (name === 'formation' && Mercury.LockPartyLeader.needFormationMenu) {
- return true;
- }
- return Mercury.LockPartyLeader.Window_MenuCommand_needsCommand.call(this, name);
- };
Advertisement
Add Comment
Please, Sign In to add comment