I detailed how each method works in the notes but I was exceptionally tired last night so I probably didn't make much sense. I'll start off by explaining how the Final Fantasy Tactics system worked.
The way that Final Fantasy Tactics worked what that each class had a bonus or penalty for each characters stat. The Knight had high hp, hitting power etc. due to bonuses but also had lower mp, weaker magic etc. because of penalties.
The method below controls the addition of penalties and bonuses when changing classes. For the proper way to change a character's class in-game,
look here.As you can see below, I have a case set up that works dependent upon the actor's class ID in the database. This means if you want to make a set of bonuses and penalties for the default class Fighter, you setup a "when 1" branch since I used the $data_ variables to pull this thing together. Now continue below and I'll explain more on how this method works.
def add_ex_class_bonus(class_id, actor_id)#(class_id)
actor = $game_actors[actor_id]
p class_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% bonus
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
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
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
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
return
end
end
when 1#Class ID #1 Default database:Fighter
This is the part where you put the actor's class ID from the RMXP database. In the default database, you would put 1 for a Fighter, 2 for a lancer, 3 for a Warrior etc. Those of you who know scripting might be puzzled by this strangeness. This is because in the $data_whatever variables, the start of their arrays is 0. Those of you who don't know scripting, don't worry about the talk of such things. You only need to know how to do addition, subtraction, and how to leave notes behind to setup the database how you want it.
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% bonus
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
Now we are looking at the part where the percentage of the stat you want added or removed is calculated. If you want 50% of a stat to be stored in a variable, change the decimal to 0.5 and there you go. You want 1%? 0.01 is the way to get. Want 255%? 2.55 is what you want. If you don't know how to convert percentage into a decimal, just do percent multiplied by 0.01 in the calculator that came with Windows.
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
return
This is the actual code that handles the stat changing. It should be rather obvious how to decide if something gets a bonus or a penalty. For penalties, just put a subtraction sign for penalty before the equal sign. For bonuses, put an addition sign before the equal sign. Now to explain possibly the most complicated part of the whole thing.
def remove_bonus(class_id, actor_id)
#if the stat is a bonus, then stat -= maxhp - base_maxhp ect
#if the stat is a penalty then stat += base_maxhp - maxhp etc
actor = $game_actors[actor_id]
case class_id
when 1#Class ID #1
remove_bonus_hp = ((actor.base_maxhp * 1.0) * 0.2) #20% bonus
remove_bonus_sp = ((actor.base_maxsp * 1.0) * 0.25) #25% bonus
remove_bonus_str = ((actor.base_str * 1.0) * 0.4)#40% bonus
remove_bonus_dex = ((actor.base_dex * 1.0) * 0.3) #30% penalty
remove_bonus_agi = ((actor.base_agi * 1.0) * 0.3) #30% penalty
remove_bonus_int = ((actor.base_int * 1.0) * 0.16) #16% bonus
actor.maxhp -= remove_bonus_hp
actor.maxsp -= remove_bonus_sp
actor.str -= remove_bonus_str
actor.dex += remove_bonus_dex
actor.agi += remove_bonus_agi
actor.int -= remove_bonus_int
return
when 2#Class ID #2
remove_bonus_hp = ((actor.base_maxhp * 1.0) * 0.2) #16% penalty
remove_bonus_sp = ((actor.base_maxsp * 1.0) * 0.33) #33% bonus
remove_bonus_str = ((actor.base_str * 1.0) * 0.3) #30% penalty
remove_bonus_dex = ((actor.base_dex * 1.0) * 0.19) #19% bonus
remove_bonus_agi = ((actor.base_agi * 1.0) * 0.3) #30% bonus
remove_bonus_int = ((actor.base_int * 1.0) * 0.16) #16% bonus
actor.maxhp += remove_bonus_hp
actor.maxsp -= remove_bonus_sp
actor.str += remove_bonus_str
actor.dex -= remove_bonus_dex
actor.agi -= remove_bonus_agi
actor.int -= remove_bonus_int
return
end
end
Removing the bonus or penalty gets tricky sometimes. I think I may have thought of a way to entirely redo the whole additon/subtration of things so if I get some spare time in the next day or so I'll start on the idea so you might find this method missing in the next version. I was in a bit of a hurry at the time I did this and wasn't at my best.
when 1#Class ID #1
remove_bonus_hp = ((actor.base_maxhp * 1.0) * 0.2) #20% bonus
remove_bonus_sp = ((actor.base_maxsp * 1.0) * 0.25) #25% bonus
remove_bonus_str = ((actor.base_str * 1.0) * 0.4)#40% bonus
remove_bonus_dex = ((actor.base_dex * 1.0) * 0.3) #30% penalty
remove_bonus_agi = ((actor.base_agi * 1.0) * 0.3) #30% penalty
remove_bonus_int = ((actor.base_int * 1.0) * 0.16) #16% bonus
Like before, you calculate the amount that was given in the add_ex_class_bonus.
actor.maxhp -= remove_bonus_hp
actor.maxsp -= remove_bonus_sp
actor.str -= remove_bonus_str
actor.dex += remove_bonus_dex
actor.agi += remove_bonus_agi
actor.int -= remove_bonus_int
return
This is the part thats different. The exact opposite actually. If the stat got a bonus from this class, subtract it. If the stat got a penalty from this class, add it back.
Don't worry if you don't understand how this method is important...I've thought of an idea that'll warrant it's removal and only add_ex_class_bonus will remain. This change'll come in about 1-2 days. Sooner though if I can get more free time.