Save-Point
KRefreshFormation MV - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Plugins and Mods (https://www.save-point.org/forum-74.html)
+---- Forum: RPGMaker MV/MZ Engines (https://www.save-point.org/forum-120.html)
+---- Thread: KRefreshFormation MV (/thread-9009.html)



KRefreshFormation MV - kyonides - 09-01-2024

KRefreshFormation MV

by Kyonides

Introduction

You can press L or R buttons to change the current formation while walking through the map.
In the RPG Maker series, PageUp and PageDown buttons serve the same purpose as L and R, respectively.

The Plugin

Code:
//========================================================================================
// KRefreshFormation MV.js
//========================================================================================
/*:
* @plugindesc Change the Current Party's Formation with a Button!
* version 0.1.0
* @author Kyonides Arkanthes
*
* @param None
*
* @help Instructions:
*   While playing on the map, simply hit:
*     L or R buttons
*     PageUp or PageDown buttons
*/

Game_Party.prototype.swapFormation = function(dir) {
  if (this._actors.size < 2) { return; }
  if (dir == "left") {
    this._actors.push(this._actors.shift());
  } else if (dir == "right") {
    this._actors.unshift(this._actors.pop());
  }
  $gamePlayer.refresh();
};

const Game_Player_update_refresh_heroes = Game_Player.prototype.update;

Game_Player.prototype.update = function(sceneActive) {
  if (Input.isTriggered('pageup')) {
    SoundManager.playCursor();
    $gameParty.swapFormation("left");
  } else if (Input.isTriggered('pagedown')) {
    SoundManager.playCursor();
    $gameParty.swapFormation("right");
  }
  Game_Player_update_refresh_heroes.call(this, sceneActive);
};

Terms & Conditions

Free for use in any kind of project. There is nothing else you should know about them.