#------------------------------------------------------------------------------
# On map party switch
# By Legacyblade
#------------------------------------------------------------------------------
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Configuration
#
#
# With the configuration, you can do the following
#
# Select a switch number to allow and disallow the switching of party members
# Select a switch number to disable the automatic gameover when all party
# memer have died
#
# Remember, Aleworks Input Module is included with the script, so you can use
# any key you want.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#The running key
PSWITCH_BUTTON = [Keys::E]
#The disable party switching game switch number
PSWITCH_NUM = 1
#The switch to be flipped when all party members are dead
GOVER_FLIP = 2
#The automatic gameover game switch number. If it is disabled,
GOVER_CHECK = 3
class Scene_Map
alias_method :lebl_party_switch_update, :update
def update
dead_or_alive
leader_dead
# check if party switching is enabled, and the player has pressed the party
# switch button
if($game_switches[PSWITCH_NUM] == false &&
Input.trigger?(PSWITCH_BUTTON) && @liveParty.size > 1)
# shift the current leader to the back
id = @liveParty[0].id
$game_party.remove_actor(id)
$game_party.add_actor(id)
# Refresh the XAS hud
$game_system.xas_skill_id = 0
$game_temp.skill_refresh = true
end
lebl_party_switch_update
end
def dead_or_alive
@liveParty = []
@deadParty = []
for i in 0...$game_party.actors.size
#if a party member has at least 1 hp, add him to the liveParty array
if $game_party.actors[i].hp >= 1
#check to see if the liveParty has anything in it, and if not,
#initialize the liveParty index counter
if @liveParty.size == 0
n = 0
end
#put the proper actor in thier liveParty array location and updated
#the liveParty index counter
@liveParty[n] = $game_party.actors[i]
n = n + 1
#if a party member doesn't have at least 1 hp, add him to the deadParty
#array
else
#check to see if the deadParty has anything in it, and if not,
#initialize the deadParty index counter
if @deadParty.size == 0
p = 0
end
#put the proper actor in thier deadParty array location and updated
#the deadParty index counter
@deadParty[n] = $game_party.actors[i]
p = p + 1
end
end
end
def leader_dead
#Check if the lead actor is out of HP
if @liveParty[0].hp == 0
#call the sort DA method to make sure the arrays are updated before
#proceeding
sort_DA
#Check if the liveParty array is less than one, and that gameovers
#will be called
if @liveParty[0].size < 1 && $game_switches[GOVER_CHECK] == false
#call the gameover
$scene = Scene_Gameover.new
#Check if the liveParty array is less than one, but that gameovers
#will not be called
elsif @liveParty[0].size < 1 && $game_switches[GOVER_CHECK] == true
#flip the gameover handeling switch for the player
$game_switches[GOVER_CHECK] == true
end
end
end
end