Posts: 4,934
Threads: 598
Joined: Dec 2009
09-07-2025, 06:35 PM
(This post was last modified: 09-30-2025, 12:44 AM by kyonides.
Edit Reason: Script Updated Once Again
)
Kuick Leader Swap XP
by Kyonides
Introduction
Once upon a gaming time, some forumer, who might have recently escaped from Minecraft for unknown reasons, wanted to easily swap the current party leader, not just by pressing the L or R button but also via direct assignment.
 Well, we don't know how accurate this legend might be, but this is the final outcome of that ancient story.
Script Calls
Set a Temporary Leader:
- RememberLeaderIndex? stands for a boolean value: true or false.
- This new leader becomes permanent if RememberLeaderIndex? is false.
Code: $game_party.temp_leader(PartyIndex, RememberLeaderIndex?)
Restore the Previous Leader (If Any):
Code: $game_party.restore_leader
Set a Leader by Actor's ID:
Code: $game_party.set_leader_by_id(ActorID)
Set a Leader Randomly!
Code: $game_party.set_random_leader!
L & R Button-Related Script Calls
Prevent the player from Swapping the current Leader:
Code: $game_party.keep_leader!
Reenable the player to Swap the current Leader:
Code: $game_party.swap_leader!
Check Current Keep Leader State - Returns either true or false:
Code: $game_party.keep_leader
The Script
Code: # * Kuick Leader Swap XP * #
# Scripter : Kyonides
# v1.1.3 - 2025-09-29
# * Script Calls * #
# - Set a Temporary Leader!
# RememberLeaderIndex? stands for a boolean value: true or false.
# This new leader becomes permanent if RememberLeaderIndex? is false.
# $game_party.temp_leader(PartyIndex, RememberLeaderIndex?)
# - Restore the Previous Leader! (If Any!)
# $game_party.restore_leader
# - Set a Leader by Actor's ID!
# $game_party.set_leader_by_id(ActorID)
# - Set a Leader Randomly!
# $game_party.set_random_leader!
# * L & R Button-Related Script Calls * #
# - Prevent the player from Swapping the current Leader:
# $game_party.keep_leader!
# - Reenable the player to Swap the current Leader:
# $game_party.swap_leader!
# - Check Current Keep Leader State:
# $game_party.keep_leader (Returns: true or false)
class Game_Party
def leader
@actors[0]
end
def keep_leader!
@keep_leader = true
end
def swap_leader!
@keep_leader = false
nil
end
def change_leader(n)
return if @keep_leader or @actors.empty?
if n < 0
@actors.unshift @actors.pop
else
@actors << @actors.shift
end
end
def set_leader_by_id(actor_id)
actor = $game_actors[actor_id]
n = @actors.index(actor)
swap_leader(n) if n and n != 0
end
def set_random_leader!
n = rand(@actors.size)
swap_leader(n) if n and n != 0
end
def temp_leader(n, remember)
@temp_leader_index = n if remember
swap_leader(n)
end
def restore_leader
swap_leader(@temp_leader_index) if @temp_leader_index
@temp_leader_index = nil
end
private
def swap_leader(n)
@actors[0], @actors[n] = @actors[n], @actors[0]
$game_player.refresh
end
attr_accessor :keep_leader
end
class Game_Player
alias :kyon_kuick_leader_swap_gm_plyr_up :update
def update
kyon_kuick_leader_swap_gm_plyr_up
if Input.trigger?(Input::L)
$game_party.change_leader(-1)
refresh
return
elsif Input.trigger?(Input::R)
$game_party.change_leader(1)
refresh
end
end
end
Terms & Conditions
Free as in  beer for any kind of  games.
Include my nickname in your game credits.
Thank Ace_V for unwillingly inspiring me to  craft the script. (Just don't or else his PM box will get full any time soon.  )
That's it!
"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.
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!
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
Posts: 120
Threads: 10
Joined: Nov 2024
This really is useful and very light and easy to implement! Thanks again, kyonides! I spent the better part of a day going through all my previously-finished quest lines to implement the script call to ensure the correct character is in the lead to further enhance some cutscenes.
(I've never played Minecraft, though!)
Posts: 4,934
Threads: 598
Joined: Dec 2009
Script Update
Starting from version 1.1.0, you can now make script calls that will affect the way the L & R buttons work. They will allow you to either (re-)enable or disable that feature at will.  But don't worry pals! The original features remain intact and unblocked by this change.
"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.
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!
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
Posts: 120
Threads: 10
Joined: Nov 2024
Nice new feature! That's very useful for scenes that rely on parallel processes (perhaps a hallway with text/effects popping up slowly as you walk through) and you need a specific leader.
Posts: 4,934
Threads: 598
Joined: Dec 2009
Just in case I didn't explain myself clearly enough on my previous post, I am leaving a summary here as well.
The only new feature in version 1.1.0 is the ability to disable the L & R buttons and to reenable them later on. Needing a specific leader was taken care of by the previous release, namely 1.0.2.
 Rest assure that I have NOT removed any previous feature so you are free to change the leader by using any of the previous script calls. If deemed necessary.
"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.
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!
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
Posts: 4,934
Threads: 598
Joined: Dec 2009
New Feature Available!
Version 1.1.1 sports a quite weird feature indeed: to set your next party's leader randomly!
Here's the script call:
Code: $game_party.set_random_leader!
"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.
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!
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
Posts: 120
Threads: 10
Joined: Nov 2024
09-29-2025, 05:51 PM
(This post was last modified: 09-29-2025, 06:07 PM by Ace_V.)
I've encountered a tiny issue:
Whenever I play the intro of my game (which temporarily removes all characters in the party) and I accidentally press Q/W, the game would crash. So, I ran the disable script call
Code: $game_party.keep_leader!
Which fixed that issue. Nothing happens when the player presses Q/W and the intro proceeds as planned.
However, another issue arose. After the intro and after returning the character to the party, I then ran the second script call to re-enable the swap function
Code: $game_party.swap_leader!
Unfortunately, for some reason this causes the game to hang. No inputs register ASIDE from the Q/W swap, the music keeps playing, but the player can do nothing else. No directional button input and menu doesn't pop up.
I tried this on both a new game and an old save, with the same results.
EDIT: I should also note that the other events still run (in my testing with an older save, NPCs still walked around after the script call to re-enable the swapper, but effects like fade to black and fade to normal all stop (basically anything after the script call won't run).
Posts: 4,934
Threads: 598
Joined: Dec 2009
Script Update!
To prevent the game from changing the current leader if you're using a map intro scene, I added a check that will stop the changing process if the actors' list is empty.
Concerning the $game_party.swap_leader! call, that's not really my script's fault. You see, the Interpreter script has a bug where returning a false value  freezes any game.  You'd have to either look for a Interpreter bug fix or make sure the script call event command never return a false value in the first place. (We even had a long discussion on that topic here on the board.)
Even so, I altered that call to still change its value to false but it'll now return a nil right thereafter. AFAIK, a nil value won't cause any issues.
"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.
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!
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
Posts: 120
Threads: 10
Joined: Nov 2024
Hooray! I removed the script calls in my intro altogether and v1.1.3 no longer causes any crashes! Thanks, kyonides.
|