01-24-2013, 05:26 PM
Master Party-Leader Substitution
Version: 1.0
Version: 1.0
Introduction
Have you ever wanted to make an event to add a new spell to the current party leader but noticed that the map event code asked you for a specific 'actor' and you were like .... "How do I do that? Make a freakin' conditional branch?" ? Did you want to equip the party leader with a new sword or shield, but ran into the same situation where it only asked for the actual actor? It sucks that you can't tell it to make this change to the leader of your party rather than an individual member in your database without using some branching method.
Until now.
By creating (what I call) a dummy or substitute actor in your database, you can use this script to have these changes apply to the lead member of your party without the need of complicated event systems. Technically, it only required a line entered into each method in the Interpreter class that lets it know if you're using the dummy actor and a CONSTANT value that holds the ID number of your dummy actor.
Script
Yes... the script. And not even a download, but right here. It was just too easy an edit.
Code:
#==============================================================================
# ** MASTER PARTY-LEADER SUBSTITUTION
#------------------------------------------------------------------------------
# Version 1.0
# by DerVVulfman
# January 23, 2013
# RPGMaker XP/RGSS
#==============================================================================
#
# INTRODUCTION AND INSTRUCTIONS:
#
# This simple replacement of some methods in the interpreter class lets you
# use a 'dummy' actor to act as your party leader, whomever it may be. This
# allows you to have a system that cycles through your members or substitute
# one member for another, yet allows you to use certain MAP EVENT calls to
# affect the party leader, whoever it may be.
#
# It certainly makes more sense than needing a series of conditional branches
# just to figure out WHO the party leader is for these effects. ^_^
#
#
# The calls affected are:
# * Change Party Member (Only to remove the party leader, not add)
# * Change Skills
# * Change Equipment
# * Change Actor Name
# * Change Actor Class
# * Change Actor Graphic
#
# Just set the MASTER_CALL_ACTOR id to the ID of your dummy actor in your
# Actors Database. And when you want to make an event that effects your
# Party leader, just tell the event to affect that dummy actor.
#
#------------------------------------------------------------------------------
#
# KNOWN COMPLICATIONS:
#
# The change Party Member (command_129) conflicts with MultiSlots. If placed
# before Multislots, it will not function. But if placed after MultiSlots,
# then MultiSlots may not work correctly.
#
#------------------------------------------------------------------------------
#
# TERMS AND CONDITIONS:
#
# Free for use. Just give due credit
#
#==============================================================================
# THIS IS YOUR ONLY CONFIGURABLE
# Just have it set to the ID of your dummy actor
#
MASTER_CALL_ACTOR = 19
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Change Party Member
#--------------------------------------------------------------------------
def command_129
# Get actor
actor = $game_actors[@parameters[0]]
# If actor is valid
if actor != nil
# Branch with control
if @parameters[1] == 0
if @parameters[2] == 1
$game_actors[@parameters[0]].setup(@parameters[0])
end
$game_party.add_actor(@parameters[0])
else
# Substitute the actor if needed
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
$game_party.remove_actor(@parameters[0])
end
end
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Parameters
#--------------------------------------------------------------------------
def command_317
# Get operate value
value = operate_value(@parameters[2], @parameters[3], @parameters[4])
# Get actor
actor = $game_actors[@parameters[0]]
# Substitute the actor
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
# Change parameters
if actor != nil
case @parameters[1]
when 0 ; actor.maxhp += value # MaxHP
when 1 ; actor.maxsp += value # MaxSP
when 2 ; actor.str += value # strength
when 3 ; actor.dex += value # dexterity
when 4 ; actor.agi += value # agility
when 5 ; actor.int += value # intelligence
end
end
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Skills
#--------------------------------------------------------------------------
def command_318
# Get actor
actor = $game_actors[@parameters[0]]
# Substitute the actor
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
# Change skill
if actor != nil
if @parameters[1] == 0
actor.learn_skill(@parameters[2])
else
actor.forget_skill(@parameters[2])
end
end
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Equipment
#--------------------------------------------------------------------------
def command_319
# Get actor
actor = $game_actors[@parameters[0]]
# Substitute the actor
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
# Change Equipment
actor.equip(@parameters[1], @parameters[2]) if actor != nil
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Actor Name
#--------------------------------------------------------------------------
def command_320
# Get actor
actor = $game_actors[@parameters[0]]
# Substitute the actor
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
# Change name
actor.name = @parameters[1] if actor != nil
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Actor Class
#--------------------------------------------------------------------------
def command_321
# Get actor
actor = $game_actors[@parameters[0]]
# Substitute the actor
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
# Change class
actor.class_id = @parameters[1] if actor != nil
# Continue
return true
end
#--------------------------------------------------------------------------
# * Change Actor Graphic
#--------------------------------------------------------------------------
def command_322
# Get actor
actor = $game_actors[@parameters[0]]
# Substitute the actor
actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR
# Change graphic
if actor != nil
actor.set_graphic(@parameters[1], @parameters[2],
@parameters[3], @parameters[4])
end
# Refresh player
$game_player.refresh
# Continue
return true
end
end
Instructions
Not a lot actually. A simple little thing in fact.
Notes
I forgot to paste this last night.
Compatability
Designed for use solely for RPGMaker XP. However, it may conflict with DerVVulfman's MultiSlots as both it and this script rewrite command_129. If placed above Multislots, Multislots will work fine but changes to the 'Change Party Member' command done by this script will not function. And if reversed, MultiSlots may not function properly. Please note, that all it takes is that you insert a simple line ( actor = $game_party.actors[0] if actor.id == MASTER_CALL_ACTOR ) above/before the remove_actor statement in Multislots's command_129 method if you decide to use both and place this script above MultiSlots.
Terms and Conditions
Free for use. Just give proper credits.