Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 KRefreshFormation
#1
KRefreshFormation

XP + VX + ACE + MV

by Kyonides Arkanthes

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.

XP Version

Code:
# * KRefreshFormation XP

class Game_Party
  def swap_formation(dir)
    return if @actors.size < 2
    if dir == :left
      @actors << @actors.shift
    elsif dir == :right
      @actors.unshift @actors.pop
    end
    $game_player.refresh
  end
end

class Game_Player
  alias :kyon_refresh_form_gm_plyr_up :update
  def update
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      $game_party.swap_formation(:left)
    elsif Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      $game_party.swap_formation(:right)
    end
    kyon_refresh_form_gm_plyr_up
  end
end


VX & VX ACE Version

Code:
# * KRefreshFormation VX & ACE

class Game_Party
  def swap_formation(dir)
    return if @actors.size < 2
    if dir == :left
      @actors << @actors.shift
    elsif dir == :right
      @actors.unshift @actors.pop
    end
    $game_player.refresh
  end
end

class Game_Player
  alias :kyon_refresh_form_gm_plyr_up :update
  def update
    if Input.trigger?(Input::L)
      Sound.play_cursor
      $game_party.swap_formation(:left)
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      $game_party.swap_formation(:right)
    end
    kyon_refresh_form_gm_plyr_up
  end
end


MV Version

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.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#2
Cool to see this done for all the 'Makers, many thank yous!

One feature you could add is to auto-swap forward when the lead character dies.
(In my game, when I was using followers, dead followers were removed from the entourage.)

Also, the ability to let the developer lock the main character from being moved around in the menus.
(In my game, the lead character is the only one programmed with all the action animations. That's why I lock him in key scenes. In other cases, anybody can be lead and different leads have different field map specialties which requires them to be locked as lead player from time to time.)

Not to complicate things, just thinking of how I personally use stuff and I'd imagine others could possibly have similar use cases.

As a sister script, you could make a "designated leader" script. Leader ID = 0 (whoever is index 0 of the party is designated leader), Leader ID >= 1 (leader is actor with ID#). If leader is removed from party, it defaults 0 again.
[Image: Button-BOTB.png]
[Image: Save-Point.gif][Image: Button-You-Tube2.png][Image: Button-Sound-Cloud2.png][Image: Button-Audio-Mack2.png]
[Image: LS-Banner.gif]
NEW ALBUM OUT NOW!

Reply }




Users browsing this thread: