#============================================================
#------------------------------------------------------------------------------------------------------------------------
#============================================================
#Class name: Game_Ex
#Class version 1.2.0
#Created on 4-22-2007
#Last updated: 3-18-2008
#refer to $game_ex for methods stored within this class.
#
#TABLE OF CONTENTS:
#SECTION 1:Compability and other issues - CAOI
#SECTION 2:Changes made to each version - CMTEV
#SECTION 3:Setting up the class database - SUTCB
#SECTION 4:Class bonus changing tutorial - CBCT
#SECTION 5:Method names and their functions - MNATF
#SECTION 6:Final notes concerning the script - FNCTS
#
#To quick jump to a section, use the capital letters by the section name.
#
#-------()=======================================================>
#SECTION 1:Compability and other issues - CAOI
#-------()=======================================================>
#First things first...BACK UP YOUR PROJECT BEFORE USING THIS SCRIPT!!! This will ensure no work
#is lost if something goes wrong. How do you back up your project? Make a game disk. In the event
#this script DOES cause a major error in your project even AFTER it has been removed from the
#project, then you will have the back up game disk to fall back on. Simply have the game disk
#overwrite your projects directory.
#
#This script corrupts your old save games because it saves new data in the save game files.
#
#This script has 3% chance of being incompatible with SDK but has not been tested with SDK.
#
#This script has a 10% chance of being incompatible with other scripts that alter or otherwise change
#the Game_Actor class. This involves scripts that add new attributes, change existing attributes, or
#otherwise alter character data.
#
#This script has a 5% of being incompatible with other scripts that alter or otherwise change the way
#a project saves or loads data. I have taken a measure to prevent incompatibilities but the chance
#is still there.
#
#CLASSES ALTERED:
#Interpreter - Changing the actor's class with event commands will now trigger defined changes.
#Scene_Title - Creates $game_ex to be used similar to the other class global variables.
#Scene_Save - Stores $game_ex data in the save file of a project.
#Scene_Load - Loads $game_ex data from a save file for continued usage.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#SECTION 2:Changes made to each version - CMTEV
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------------------------------------------------
#============================================================
#CHANGES IN v1.2
#============================================================
#------------------------------------------------------------------------------------------------------------------------
#CHANGE #1:
#The Interpreter class changing method was slightly altered to process the removal and addition of
#class bonuses. I can't believe I didn't think of doing this before!
#
#CHANGE #2:
#Various bits of the notes were changed to accomodate CHANGE #1 so people who read the notes
#wouldn't get confused.
#
#------------------------------------------------------------------------------------------------------------------------
#============================================================
#CHANGES IN v1.1
#============================================================
#------------------------------------------------------------------------------------------------------------------------
#CHANGE #1:
#The method add_ex_class_bonus has been renamed to ex_class_bonus for the simple reason
#that the method used to remove bonuses and such no longer exists, leaving the old name to
#be misleading.
#
#CHANGE #2:
#The method ex_class_bonus has been changed to handle the adding and removing of class bonuses.
#For a full break down of how ex_class_bonus works now, read SECTION 4.
#
#CHANGE #3:
#The method remove_ex_class_bonus was completely removed.
#------------------------------------------------------------------------------------------------------------------------
#============================================================
#CHANGES IN v1.0
#============================================================
#------------------------------------------------------------------------------------------------------------------------
#The original release version. I didn't like the original structure of the script so I released a v1.1
#fixing the issues I had with the script. You should find this script to be a bit easier to use now.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#SECTION 3:Setting up the class database - SUTCB
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#You will have to set up the method ex_class_bonus as follows
# Let's say you want to use an equation to return 16% of an actor's attribute.
#You would use the following formula.
#
#((actors stat syntax * 1.0) * 0.16)
#
#List of actor stat syntax:
#Agility: actor.agi
#Dexterity: actor.dex
#Max Hp: actor.maxhp
#Max Sp: actor.maxsp
#Strength: actor.str
#Intelligence: actor.int
#
#Something to note about decimals in RGSS:
#You need the 0. because RGSS does not automatically add the zero to decimals without a zero at the
#front of them. It causes funny things to happen when you forget the zero in your decimals.
#Also, I have setup two default settings for class IDs 1 and 2 as examples for you.
#
#The method add_ex_class_bonus has been renamed to ex_class bonus and is located at line 317.
#
#The method remove_ex_class_bonus is removed and no longer usable.
#
#
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#SECTION 4:Class bonus changing tutorial - CBCT
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#Now to show you how to setup an event to remove an actor's bonus, change their class, and add the
#bonuses from the new class. We'll use the default database and Arshes(default party) as an example
#by changing his class and bonuses from Fighter to Lancer. Read along while doing this to ensure you
#know how to remove and add bonuses if at any point in the story you want an actor's class and/or
#bonuses to be changed.
#
#STEP 1:
#Use the Change Class event command to change a character's class to whatever class you want.
#
#Done! Everything is now handled internally by the scripting whenever the classes are changed through
#event commands.
#
#
#********************************************************************************
#SECTION 5:Method names and their functions - MNATF
#********************************************************************************
#Alphabetical listing of methods, their fuctions within Game_Ex, and arguments to be passed along
#to said methods.
#
# add_ex_class_bonus(class_id, actor_id)
# RENAMED TO ex_class_bonus IN v1.1
#
# ex_class_bonus(class_id, actor_id, bonus)
# class_id - The actor's current class id in the database
# actor_id - Id of the actor who's stats are being modified by Game_Ex.
# bonus - Set as true if you are applying a set of new "bonuses". Set as false if you're removing the "bonuses".
# -Shinami-
# I use $data_actors instead of $game_actors for the class_id argument.
# Without the use of $data_actors, for unknown reasons I am unable to
# call the player's class id. Not exactly efficient but it works.
#
# -processing notes-
# This method functions through the use of a case based on the value of
# $data_actors[actor's id].class_id passed on as an argument during the calling
# of the method. Pass off the actor's ID and class ID for proper addition of class
# bonuses and/or penalties.
#
# base_class
# No arguments passed on. Purpose is to store the starting class of each actor.
# This allows the project team to have the ability to give a character their own
# unique class that only they can use.
# -Shinami-
# This method is still in early developement. May be subject to change.
# Currently, this method serves no purpose in the original script written by me.
#
# -processing notes-
# The sole purpose of this method is to store the actor's starting class for the reason
# that in future updates, a class changing scene may be made to handle the changing
# of each character's class while using their starting class as a "base" class that is unique
# to that actor alone but still allowing an actor access to other classes as conditions are met.
# Currently, this method serves no purpose.
#
# remove_bonus(class_id, actor_id)
# METHOD WAS REMOVED FOR INEFFICENCIES IN v1.1
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#SECTION 6:Questions and final notes concerning the script - FNCTS
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#More questions will be added as they are asked while others are simply questions I've had numerous
#times with other people's scripts. If you get an error while messing around with this script, read the
#questions here to see if one answers your problem.
#
#Question 1
#What the hell is with the screwy ASCII art crap things around the section names?
#
#Answer
#That's just to denote you're at the start/end of a section. I could have just not included ANY notes
#at all though so just put up with it. Hell, I did! XD =^-^= I'm a sword fanatic though...hence the
#crappy sword thingy at SECTION 1.
#
#Question 2
#I don't understand how to use this script. How do I use it?
#
#Answer
#Just PM me on the forum at http://rmrk.net/index.php/board,25.0.html
#I'm busy with a FFT Class Changing/Skill System at the moment though so I won't be responding
#immediatly. While you wait for my response, you can read the notes while experimenting with the
#script. Seriously though, asking this after someone took the time to note out how everything works
#will piss a few people off but I'm nice and don't bite, unless you have cookies, so ask away. ^_^
#
#Question 3
#I want to learn scripting. Where did you learn?
#
#Answer
#I didn't learn from just one place. Actually, I learned by experimenting with dozens of scripts as well
#as taking script requests to further sharpen my skills. I remember the first CMS I did...horribly done
#when I look back at it but the sense of pride I felt when I completed my first request was enough to
#keep me learning how to script so that I could take more than just CMS requests.
#
#Question 4
#What the hell is a syntax? You lost me there in the questions below!
#
#Answer
#A syntax is something used in any sort of programming language to do special things. Inside the
#RGSS editor, RGSS syntax such as if, and, else, class etc. appear in blue to denote they are syntax.
#
#Question 5
#The script isn't working! It keeps crashing and taking me to a line in ex_class_bonus! I did everything
#right!!! What's wrong?!
#
#Answer
#What you most likely forgot was to put a zero in your decimals. If they're put in like this, .08, it'll
#cause an error. You MUST have a zero before your decimals or the script WILL crash. Like I said
#before, if you forget the zero at the front of your decimals, you'll encounter some strange things.
#
#Question 6
#I get this wierd error that takes me to the start of a "when" syntax thingy! What's wrong?!
#
#Answer
#Quite simple. You might have forgotten an "end" syntax to close off an "if" syntax.
#
#Question 7
#I want to release a modified version of this script with my own changes. Can I do that?
#
#Answer
#Under four conditions I will allow this.
#Condition 1: You CAN NOT charge for this script in any way, fashion, or form! If you see someone
#charging for this script, e-mail me at shinami576@hotmail.com and I WILL put an end to it. Making
#people sign up for your forums to view this script is fine though because lurkers suck.
#Lurker - People who take scripts, graphics, etc. from forums without contributing to a forum's
#community.
#
#Condition 2: You MUST have my permission to post a modified version of this script. I like knowing
#where my works are posted so that I can provide troubleshooting for people who use my scripts. You
#can contact me at shinami576@hotmail.com or malinko576@yahoo.com. My yahoo address is really
#bugged at the moment with tons of junk mail so there is a better chance of you reaching me at my
#hotmail address
#
#Condition 3: You MUST give credit to EVERYONE who has lent a hand in altering this work. People
#get this warm little glow inside that makes them feel good when they see their name in a list of credits.
#
#Condition 4: If you changed anything, you MUST include a full set of notes detailing EVERYTHING you
#changed and how each method inside your version release works. This means having a section
#detailing how to use the script, how the methods work internally, and what role each method's
#arguments play in the script. For a good idea how to do this, look at SECTION 6. You must also
#include a compatibility section that clearly states possible and/or known incompatibilities with the
#script. This helps people that read to keep from screwing up their project.
#
#Question 8
#Why do I need to fulfill those four conditions you just mentioned? They're such a pain in the ass.
#
#Answer
#People won't pay for scripts but people in this world will always try to make a quick buck or two off of
#people who don't know any better. It's called being naive.
#Also, I like knowing where my works are posted so I can provide support for said scripts. It really
#sucks when you find an awesome script on some obscure site but can't find anyone to provide help
#for it when you have questions about it or how to make it work.
#Again, people like seeing their name in a credits list because they worked hard on something you
#used. Also, it's proper etiqute(sp?) to credit people who contributed to your project, just like you see
#tons of names in the credits of a movie. Although in the movies, it's law to credit everyone who did
#had a hand in the making of the movie...or so I think? Regardless, you get my point.
#Finally, I feel it is proper programming etiqute(sp?) to note out EVERY THING in a project, script, or
#program so that others who look at your work can see how you did the things you did and possibly
#learn new things from your programming methods.
#
#
#These are the only questions that I can think of now that'll most likely come up. I'm sure I'll be adding
#to them though! ^_^
#
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
#Class name: Game_Ex
#Class version 1.0.0
#Last updated: 4-22-2007
#The class which holds the coding that makes everything possible.
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
class Game_Ex
def initialize
for i in 1...$data_actors.size
setup(i)
end#of "for"
end#of initialize
def setup(actor_id)
actor = $data_actors[actor_id]
@class_id = actor.class_id
ex_class_bonus(@class_id, actor_id, true)
base_class
end#of setup
def base_class
@base_class = @class_id
return @base_class
end#of base_class
def ex_class_bonus(class_id, actor_id, bonus)#(actor's class id, actor's id, true if giving bonuses and false if removing bonuses)
actor = $game_actors[actor_id]
case class_id #$data_actors & class_id uses the ID numbering you see in the database.
when 1#Class ID #1 Default database:Fighter
ex_class_bonus_hp = ((actor.base_maxhp * 1.0) * 0.2) #20% bonus
ex_class_bonus_sp = ((actor.base_maxsp * 1.0) * 0.25) #25% penalty
ex_class_bonus_str = ((actor.base_str * 1.0) * 0.4) #40% bonus
ex_class_bonus_dex = ((actor.base_dex * 1.0) * 0.3) #30% penalty
ex_class_bonus_agi = ((actor.base_agi * 1.0) * 0.3) #30% penalty
ex_class_bonus_int = ((actor.base_int * 1.0) * 0.16) #16% bonus
if bonus#This is the branch part that adds the "bonuses" from a class
actor.maxhp += ex_class_bonus_hp#If you subtracted from a stat in the other branch
actor.maxsp -= ex_class_bonus_sp#then you'll add to that stat in this branch.
actor.str += ex_class_bonus_str
actor.dex -= ex_class_bonus_dex
actor.agi -= ex_class_bonus_agi
actor.int += ex_class_bonus_int
elsif bonus == false#This is the branch part that removes the "bonuses" from a class
actor.maxhp -= ex_class_bonus_hp#If you added to a stat in the other branch
actor.maxsp += ex_class_bonus_sp#then you'll subtract from that stat in this branch.
actor.str -= ex_class_bonus_str
actor.dex += ex_class_bonus_dex
actor.agi += ex_class_bonus_agi
actor.int -= ex_class_bonus_int
end#of "if"
return
when 2#Class ID #2 Default database:Lancer
ex_class_bonus_hp = ((actor.base_maxhp * 1.0) * 0.16) #16% penalty
ex_class_bonus_sp = ((actor.base_maxsp * 1.0) * 0.33) #33% bonus
ex_class_bonus_str = ((actor.base_str * 1.0) * 0.3) #30% penalty
ex_class_bonus_dex = ((actor.base_dex * 1.0) * 0.19) #19% bonus
ex_class_bonus_agi = ((actor.base_agi * 1.0) * 0.3) #30% bonus
ex_class_bonus_int = ((actor.base_int * 1.0) * 0.16) #16% bonus
if bonus
actor.maxhp -= ex_class_bonus_hp
actor.maxsp += ex_class_bonus_sp
actor.str -= ex_class_bonus_str
actor.dex += ex_class_bonus_dex
actor.agi += ex_class_bonus_agi
actor.int += ex_class_bonus_int
elsif bonus == false
actor.maxhp += ex_class_bonus_hp
actor.maxsp -= ex_class_bonus_sp
actor.str += ex_class_bonus_str
actor.dex -= ex_class_bonus_dex
actor.agi -= ex_class_bonus_agi
actor.int -= ex_class_bonus_int
end#of "if"
return
end#of "case class_id"
end#of "ex_class_bonus"
end#of class
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
#Class name: Interpreter
#Class version 1.0.0
#Last updated: 3-18-2008
#Causes the actor's stats to be changed to the scripted settings.
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
class Interpreter
#--------------------------------------------------------------------------
# * Change Actor Class
#--------------------------------------------------------------------------
def command_321
# Get actor
actor = $game_actors[@parameters[0]]
# Change class
if actor != nil
$game_ex.ex_class_bonus(actor.class_id,actor.id,false)
actor.class_id = @parameters[1]
$game_ex.ex_class_bonus(actor.class_id,actor.id,true)
end#of "if actor != nil"
# Continue
return true
end#of "def command_321"
end#of class
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
#Class name: Scene_Title
#Class version 1.0.0
#Last updated: 4-22-2007
#When starting a new game, the Game_Ex class is initialized.
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
class Scene_Title
alias command_new_game_with_ex command_new_game
def command_new_game
command_new_game_with_ex
$game_ex = Game_Ex.new
end#of command_new_game
end#of class
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
#Class name: Scene_Load
#Class version 1.0.0
#Last updated: 4-22-2007
#When loading the game, the Game_Ex class data is also loaded from inside the save file.
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
class Scene_Load
alias read_ex_save_data read_save_data
def read_save_data(file)
read_ex_save_data(file)
$game_ex = Marshal.load(file)
end#of read_save_data
end#of class
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
#Class name: Scene_Save
#Class version 1.0.0
#Last updated: 4-22-2007
#When saving the game, the Game_Ex class data is also stored inside the save file.
#===========================================================
#----------------------------------------------------------------------------------------------------------------------
#===========================================================
class Scene_Save
alias write_ex_save_data write_save_data
def write_save_data(file)
write_ex_save_data(file)
Marshal.dump($game_ex, file)
end#of write_save_data
end#of class