[Resolved] Dragon Quest VII Class Changer help

I've been editing the "TDS Class Changer System" (DQVII) and I need help with one thing:

Every time I win a battle, the whole party's HP & MP is restored. Whether a party member is killed, damaged, or used skills several times, every time a battle is over all the points are restored. Is there anyway I can fix this?

Here's the edited script if this helps. Thanks.

  1.  
  2. #==============================================================================
  3. # ** TDS Class Change System
  4. # Version: 1.7
  5. # Request: xXDarkDragonXx
  6. # Special thanks: ASHTON MCNALLY class guide, xXDarkDragonXx(Testing, Ideas).
  7. #------------------------------------------------------------------------------
  8. #  Well this script is a system for class changing that also incluides ranks
  9. #  for each class.
  10. #
  11. #  With each new rank is possible to learn more skills from that class and master
  12. #  it to unluck other more advance classes.
  13. #==============================================================================
  14.  
  15. #--------------------------------------------------------------------------
  16. # * Ranks for each class
  17. #     Hash Input:
  18. #
  19. #    "Class Name" => ["Ranks 1", "Ranks 2", "Rank 3"]
  20. #--------------------------------------------------------------------------
  21.  
  22. RANKS = {
  23. #--------------------------------------------------------------------------
  24. # * BASIC CLASSES
  25. #--------------------------------------------------------------------------
  26.  
  27. # Warrior Class and Ranks
  28. "Warrior" => ["Beginner", "Novice", "Soldier", "Guardsman", "Veteran",
  29. "Warmonger", "Elite", "General"],
  30.  
  31. # Fighter Class and ranks
  32. "Fighter" => ["Beginner", "Novice", "Grappler", "BlackBelt", "Assassin",
  33. "Ninja", "Sensei", "Master"],
  34.  
  35. # Mage Class and Ranks
  36. "Mage" => ["Beginner", "Novice", "Dabbler", "Magician", "Sorcerer", "Wizard",
  37. "Warlock", "Archmage"],
  38.  
  39. # Cleric Class and Ranks
  40. "Cleric" => ["Beginner", "Novice", "Acolyte", "Prelate", "Clergyman", "Priest",
  41. "Bishop", "HiPriest"],
  42.  
  43. # Dancer Class and Ranks
  44. "Dancer" => ["Beginner", "Apprentice", "ToeTapper", "Dervish", "Amateur",
  45. "Prancer", "Bouncer", "TruTalent"],
  46.  
  47. # Bard Class and Ranks
  48. "Bard" => ["Beginner", "Novice", "Poet", "Lyricist", "Warbler", "Crooner",
  49. "Songster", "Minstrel"],
  50.  
  51. # Jester Class and Ranks
  52. "Jester" => ["Beginner", "Novice", "GoofOff", "Buffoon", "StandUp", "Comedian",
  53. "Joker", "Fool"],
  54.  
  55. # Mariner Class and Ranks
  56. "Mariner" => ["Beginner", "Novice", "DeckHand", "Seafarer", "Navigator",
  57. "Helmsman", "Captain", "Admiral"],
  58.  
  59. # Thief Class and Ranks
  60. "Thief" => ["Beginner", "Novice", "CutPurse", "Pilferer", "Brigand", "Rogue",
  61. "Scoundrel", "Big Boss"],
  62.  
  63. # Shepard Class and Ranks
  64. "Shepard" => ["Beginner", "Novice", "FarmHand", "SlopFeed", "Swain", "Fleecer",
  65. "Herder", "SheepLord"],
  66.  
  67. #--------------------------------------------------------------------------
  68. # * INTERMEDIATE CLASSES
  69. #--------------------------------------------------------------------------
  70.  
  71. # Dragoons Class and Ranks
  72. "Dragoon" => ["Gladiator", "Fencer", "Swordsman", "Ronin", "Mercenary", "Duelist",
  73. "Champion", "Avenger"],
  74.  
  75. # Ranger Class and Ranks
  76. "Ranger" => ["Bouncer", "Wanderer", "Scout", "Battler", "Enchanter", "Blade Mage",
  77. "Conqueror", "Faust"],
  78.  
  79. # Paladin Class and Ranks
  80. "Paladin" => ["Page", "Squire", "Knight", "Zealot", "Crusader", "Templar",
  81. "Holy Knight", "Martyr"],
  82.  
  83. # Sage Class and Ranks
  84. "Sage" => ["Student", "Counsel", "Arbiter", "Seer", "Oracle", "Wise One", "Elder",
  85. "Prophet"],
  86.  
  87. # TeenIdol Class and Ranks
  88. "TeenIdol" => ["Fan", "Groupie", "Rebel", "Performer", "Star", "Artist", "Sellout",
  89. "Icon"],
  90.  
  91. # Pirate Class and Ranks
  92. "Pirate" => ["ShipWreck", "Barnacle", "Swab", "Cutthroat", "Buccaneer", "Smuggler",
  93. "Marauder", "Sea Dog"],
  94.  
  95. # Tamer Class and Ranks
  96. "Tamer" => ["Pet Owner", "Groomer", "Ranch Hand", "Tracker", "Hunter", "Handler",
  97. "Trainer", "Beast Lord"],
  98.  
  99. #--------------------------------------------------------------------------
  100. # * EXPERT CLASSES
  101. #--------------------------------------------------------------------------
  102.  
  103. # GodHand Class and Ranks
  104. "GodHand" => ["Saint", "Angel", "Archangel", "Throne", "Cherubim", "Seraphim",
  105. "Celestial", "Demigod"],
  106.  
  107. # Summoner Class and Ranks
  108. "Summoner" => ["Theurgist", "Conjuror", "Geomancer", "Elemental", "Maelstrom",
  109. "Tempest", "Fury", "Ragnarok"],
  110.  
  111. # Hero Class and Ranks
  112. "Hero" => ["Archetype", "Defender", "Paragon", "Savior", "Guardian", "Avatar",
  113. "Legend", "ChosenOne"],
  114.  
  115. "None" => ["No Rank"],
  116.  
  117. "Magister" => ["Beginner", "Novice", "Average", "Intermediate", "Experienced",
  118. "Advance", "Expert", "MASTERED!"]
  119.  
  120. }
  121.  
  122. #--------------------------------------------------------------------------
  123. # * Advance Requirements
  124. #     Hash Input:
  125. #
  126. #     "Class Name" => [[skill ID, Rank Required], [skill ID, Rank Required]]
  127. #--------------------------------------------------------------------------
  128.  
  129. ADVANCE_REQUIREMENTS = {
  130.  
  131. #--------------------------------------------------------------------------
  132. # * INTERMEDIATE CLASSES
  133. #--------------------------------------------------------------------------
  134.  
  135. # Dragoons Requirements
  136. "Dragoon" => ["Warrior", "Fighter"],
  137.  
  138. # Ranger Requirements
  139. "Ranger" => ["Warrior", "Mage"],
  140.  
  141. # Paladin Requirements
  142. "Paladin" => ["Fighter", "Cleric"],
  143.  
  144. # Sage Bonuses
  145. "Sage" => ["Fighter", "Mage", "Cleric"],
  146.  
  147. # TeenIdol Requirements
  148. "TeenIdol" => ["Dancer", "Bard", "Jester"],
  149.  
  150. # Pirate Requirements
  151. "Pirate" => ["Mariner", "Thief"],
  152.  
  153. # Tamer Requirements
  154. "Tamer" => ["Thief", "Shepard"],
  155.  
  156. #--------------------------------------------------------------------------
  157. # * EXPERT CLASSES
  158. #--------------------------------------------------------------------------
  159.  
  160. # GodHand Requirements
  161. "GodHand" => ["Dragoon", "Paladin"],
  162.  
  163. # Summoner Requirements
  164. "Summoner" => ["Sage", "TeenIdol"],
  165.  
  166. # Hero Requirements
  167. "Hero" => ["Dragoon", "Ranger", "Paladin", "Sage", "TeenIdol", "Pirate", "Tamer"]
  168.  
  169. }
  170.  
  171. #--------------------------------------------------------------------------
  172. # * Ranks Skills
  173. #     Hash Input:
  174. #
  175. #     "Class Name" => [[skill ID, Rank Required], [skill ID, Rank Required]]
  176. #--------------------------------------------------------------------------
  177.  
  178. RANK_SKILLS = {
  179. # Warrior skills
  180. "Warrior" => [[57, "Novice"], [58, "Guardsman"], [59, "Warmonger"],
  181. [60, "General"]],
  182.  
  183. "Fighter" => [[57, "Beginner"], [58, "Beginner"]],
  184.  
  185. "None" => []
  186.  
  187. }
  188.  
  189.  
  190. #--------------------------------------------------------------------------
  191. # * Ranks Exp limit
  192. #     Hash Input:
  193. #
  194. #     Troop ID => [Exp Given, Level limit]
  195. #--------------------------------------------------------------------------
  196.  
  197. #EXP_LIMIT = { 1 => [1, 10]
  198. EXP_LIMIT = { 1 => [255, 100]
  199.  
  200.  
  201. }
  202.  
  203. #--------------------------------------------------------------------------
  204. # * Rank Status Bonus
  205. #     Hash Input:
  206. #
  207. #     "Class Name" =>  [HP, SP, STR, DEX, AGI, INT, ATK, PDEF, MDEF]
  208. #      ** - used for negative values and normal numbers as positive.
  209. #--------------------------------------------------------------------------
  210.  
  211. CLASS_STATUS_BONUS = {
  212. #--------------------------------------------------------------------------
  213. # * BASIC CLASSES
  214. #--------------------------------------------------------------------------
  215.  
  216. # Warrior Bonuses
  217. "Warrior" => [10, -60, 10, 0, -35, -30, 30, 30, 0],
  218.  
  219. # Fighter Bonuses
  220. "Fighter" => [ 0 ,-50, 0, 5, 15, -15, -30, 10, -10, -5],
  221.  
  222. # Mage Bonuses
  223. "Mage" => [-40, 10, -40, 3, -5, 20, -20, -40, 40],
  224.  
  225. # Cleric Bonuses
  226. "Cleric" => [-20, 0, -20, 5, -10, 10, -10, -30, 20],
  227.  
  228. # Dancer Bonuses
  229. "Dancer" => [-30, -20, -30, 30, 30, 0, 10, -40, 0],
  230.  
  231. # Bard Bonuses
  232. "Bard" => [-20, 0, -25, -10, -5, 20, 0, -15, 10],
  233.  
  234. # Jester Bonuses
  235. "Jester" => [-30, -40, -30, -20, -30, -20, -30, -40, -40],
  236.  
  237. # Mariner Bonuses
  238. "Mariner" => [15, -20, 0, 10, 5, -10, 10, 10, -5],
  239.  
  240. # Thief Class and Exp
  241. "Thief" => [-10, -40, -10, 25, 20, -10, -5, -30, -15],
  242.  
  243. # Shepard Bonuses
  244. "Shepard" => [-20, -30, -15, 0, 0, 0, -10, -20, -10 ],
  245.  
  246. #--------------------------------------------------------------------------
  247. # * INTERMEDIATE CLASSES
  248. #--------------------------------------------------------------------------
  249.  
  250. # Dragoons Bonuses
  251. "Dragoon" => [20, -40, 15, 5, 10, -20, 20, 10, 5],
  252.  
  253. # Ranger Bonuses
  254. "Ranger" => [-10, 10, 5, 5, 10, 0, 10, -15, 15],
  255.  
  256. # Paladin Bonuses
  257. "Paladin" => [0, 0, 15, 10, 15, 15, 0, 10, 10],
  258.  
  259. # Sage Bonuses
  260. "Sage" => [-20, 20, -30, 5, 5, 20, -10, -20, 20],
  261.  
  262. # TeenIdol Bonuses
  263. "TeenIdol" => [-20, 10, -20, -5, -10, 0, -10, -10, -5],
  264.  
  265. # Pirate Bonuses
  266. "Pirate" => [5, -10, 10, 10, 10, -10, 10, 20, -10],
  267.  
  268. # Tamer Bonuses
  269. "Tamer" => [-5, -5, 0, 10, 10, 20, -5, 0, 5],
  270.  
  271.  
  272. #--------------------------------------------------------------------------
  273. # * EXPERT CLASSES
  274. #--------------------------------------------------------------------------
  275.  
  276. # GodHand Bonuses
  277. "GodHand" => [10, -10, 25, 15, 10, 0, 25, 5, 0],
  278.  
  279. # Summoner Requirements
  280. "Summoner" => [-10, 20, -10, 10, 15, 20, -10, -10, 20],
  281.  
  282. # Hero Requirements
  283. "Hero" => [10, 10, 10, 10, 10, 15, 15, 10, 10],
  284.  
  285. "None" => [0, 0, 0, 0, 0, 0, 0, 0, 0],
  286.  
  287. "Magister" => [0, 0, 0, 0, 0, 0, 0, 0, 0]
  288.  
  289. }
  290.  
  291.  
  292. #--------------------------------------------------------------------------
  293. # * Ranks Level Up Points Table
  294. #     Hash Input:
  295. #
  296. #     "Class Name" => [[(Exp for rank start..Exp for rank end).to_a]]
  297. #--------------------------------------------------------------------------
  298.  
  299. RANK_LV_UP_POINTS = {
  300. #--------------------------------------------------------------------------
  301. # * BASIC CLASSES
  302. #--------------------------------------------------------------------------
  303.  
  304. # Warrior Class and Exp
  305. "Warrior" => [[(0..9).to_a, (10..30).to_a, (31..55).to_a, (56..90).to_a,
  306. (91..130).to_a, (131..155).to_a, (156..180).to_a, (180..201).to_a]],
  307.  
  308. # Fighter Class and Exp
  309. "Fighter" => [[(0..9).to_a, (10..30).to_a, (31..55).to_a, (56..90).to_a,
  310. (91..130).to_a, (131..155).to_a, (156..180).to_a, (180..201).to_a]],
  311.  
  312. # Mage Class and Exp
  313. "Mage" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  314. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  315.  
  316. # Cleric Class and Exp
  317. "Cleric" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  318. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  319.  
  320. # Dancer Class and Exp
  321. "Dancer" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  322. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  323.  
  324. # Bard Class and Exp
  325. "Bard" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  326. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  327.  
  328. # Jester Class and Exp
  329. "Jester" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  330. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  331.  
  332. # Mariner Class and Exp
  333. "Mariner" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  334. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  335.  
  336. # Thief Class and Exp
  337. "Thief" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  338. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  339.  
  340. # Shepard Class and Exp
  341. "Shepard" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  342. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  343.  
  344. #--------------------------------------------------------------------------
  345. # * INTERMEDIATE CLASSES
  346. #--------------------------------------------------------------------------
  347.  
  348. # Dragoons Class and Exp
  349. "Dragoon" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  350. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  351.  
  352.  
  353. "Jerry" => [[(0..3).to_a, (4..10).to_a]],
  354.  
  355. # Ranger Class and Exp
  356. "Ranger" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  357. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  358.  
  359. # Paladin Class and Exp
  360. "Paladin" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  361. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  362.  
  363. # Sage Class and Exp
  364. "Sage" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  365. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  366.  
  367. # TeenIdol Class and Exp
  368. "TeenIdol" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  369. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  370.  
  371. # Pirate Class and Exp
  372. "Pirate" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  373. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  374.  
  375. # Tamer Class and Exp
  376. "Tamer" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  377. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  378.  
  379. #--------------------------------------------------------------------------
  380. # * EXPERT CLASSES
  381. #--------------------------------------------------------------------------
  382.  
  383. # GodHand Class and Exp
  384. "GodHand" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  385. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  386.  
  387. # Summoner Class and Exp
  388. "Summoner" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  389. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  390.  
  391. # Hero Class and Exp
  392. "Hero" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  393. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],
  394.  
  395. "None" => [[(0).to_a]],
  396.  
  397. "Magister" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a,
  398. (40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]]
  399.  
  400. }
  401.  
  402. #==============================================================================
  403. # ** Game_Battler (part 1)
  404. #------------------------------------------------------------------------------
  405. #  This class deals with battlers. It's used as a superclass for the Game_Actor
  406. #  and Game_Enemy classes.
  407. #==============================================================================
  408.  
  409. class Game_Battler
  410.   #--------------------------------------------------------------------------
  411.   # * Get Attack Power
  412.   #--------------------------------------------------------------------------
  413.   def atk    
  414.     # If self is an actor use bonus
  415.     if self.is_a?(Game_Actor)    
  416.       n = base_atk + class_status_bonus(self.class_name, 6)
  417.     else
  418.       n = base_atk    
  419.     end
  420.  
  421.     for i in @states
  422.       n *= $data_states[i].atk_rate / 100.0
  423.     end
  424.     return Integer(n)
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # * Get Physical Defense Power
  428.   #--------------------------------------------------------------------------
  429.   def pdef
  430.     # If self is an actor use bonus    
  431.     if self.is_a?(Game_Actor)
  432.       n = base_pdef + class_status_bonus(self.class_name, 7)
  433.     else
  434.       n = base_pdef
  435.     end
  436.    
  437.     for i in @states
  438.       n *= $data_states[i].pdef_rate / 100.0
  439.     end
  440.     return Integer(n)
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # * Get Magic Defense Power
  444.   #--------------------------------------------------------------------------
  445.   def mdef
  446.     # If self is an actor use bonus    
  447.     if self.is_a?(Game_Actor)        
  448.       n = base_mdef + class_status_bonus(self.class_name, 8)
  449.     else
  450.       n = base_mdef    
  451.     end
  452.  
  453.     for i in @states
  454.       n *= $data_states[i].mdef_rate / 100.0
  455.     end
  456.     return Integer(n)
  457.   end
  458. end
  459.  
  460. #==============================================================================
  461. # ** Scene_Battle (part 2)
  462. #------------------------------------------------------------------------------
  463. #  This class performs battle screen processing.
  464. #==============================================================================
  465.  
  466. class Scene_Battle
  467.   #--------------------------------------------------------------------------
  468.   # * Start After Battle Phase
  469.   #--------------------------------------------------------------------------
  470.   def start_phase5
  471.     # Shift to phase 5
  472.     @phase = 5
  473.     # Play battle end ME
  474.     $game_system.me_play($game_system.battle_end_me)
  475.     # Return to BGM before battle started
  476.     $game_system.bgm_play($game_temp.map_bgm)
  477.     # Initialize EXP, amount of gold, and treasure
  478.     exp = 0
  479.     gold = 0
  480.     treasures = []
  481.     # Loop
  482.     for enemy in $game_troop.enemies
  483.       # If enemy is not hidden
  484.       unless enemy.hidden
  485.         # Add EXP and amount of gold obtained
  486.         exp += enemy.exp
  487.         gold += enemy.gold
  488.         # Determine if treasure appears
  489.         if rand(100) < enemy.treasure_prob
  490.           if enemy.item_id > 0
  491.             treasures.push($data_items[enemy.item_id])
  492.           end
  493.           if enemy.weapon_id > 0
  494.             treasures.push($data_weapons[enemy.weapon_id])
  495.           end
  496.           if enemy.armor_id > 0
  497.             treasures.push($data_armors[enemy.armor_id])
  498.           end
  499.         end
  500.       end
  501.     end
  502.     # Treasure is limited to a maximum of 6 items
  503.     treasures = treasures[0..5]
  504.     # Obtaining EXP
  505.     for i in 0...$game_party.actors.size
  506.       actor = $game_party.actors[i]
  507.       if actor.cant_get_exp? == false
  508.         last_level = actor.level
  509.         actor.exp += exp
  510.         if actor.level > last_level
  511.           @status_window.level_up(i)
  512.         end
  513.       end
  514.     end
  515.     # Obtaining gold
  516.     $game_party.gain_gold(gold)
  517.     # Obtaining treasure
  518.     for item in treasures
  519.       case item
  520.       when RPG::Item
  521.         $game_party.gain_item(item.id, 1)
  522.       when RPG::Weapon
  523.         $game_party.gain_weapon(item.id, 1)
  524.       when RPG::Armor
  525.         $game_party.gain_armor(item.id, 1)
  526.       end
  527.     end
  528.    
  529.     # Makes Rank exp
  530.     rank_exp = EXP_LIMIT[$game_temp.battle_troop_id][0]    
  531.    
  532.     # Gives i the value of the party size
  533.     for i in 0...$game_party.actors.size
  534.       # If class name is not None and actor is not nil
  535.       if $game_party.actors[i].class_name != "None" and $game_party.actors[i] != nil
  536.        # If game actor level is less than the exp level limit
  537.        if $game_party.actors[i].level < EXP_LIMIT[$game_temp.battle_troop_id][1]
  538.          # Give actors rank exp
  539.          $game_party.actors[i].rank_exp(rank_exp)
  540.          end
  541.        end
  542.     end
  543.  
  544.     # Make battle result window
  545.     @result_window = Window_BattleResult.new(exp, gold, treasures, rank_exp)
  546.     # Set wait count
  547.     @phase5_wait_count = 100
  548.   end
  549. end
  550.  
  551.  
  552. #==============================================================================
  553. # ** Window_BattleResult
  554. #------------------------------------------------------------------------------
  555. #  This window displays amount of gold and EXP acquired at the end of a battle.
  556. #==============================================================================
  557.  
  558. class Window_BattleResult < Window_Base
  559.   #--------------------------------------------------------------------------
  560.   # * Object Initialization
  561.   #     exp       : EXP
  562.   #     gold      : amount of gold
  563.   #     treasures : treasures
  564.   #--------------------------------------------------------------------------
  565.   def initialize(exp, gold, treasures, rank_exp = 0)
  566.     @exp = exp
  567.     @gold = gold
  568.     @treasures = treasures
  569.     @rank_exp = rank_exp
  570.     super(160, 0, 320, @treasures.size * 64 + 64)
  571.     self.contents = Bitmap.new(width - 32, height - 32)
  572.     self.y = 160 - height / 2
  573.     self.back_opacity = 160
  574.     self.visible = false
  575.     refresh
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # * Refresh
  579.   #--------------------------------------------------------------------------
  580.   def refresh
  581.     self.contents.clear
  582.     self.contents.font.color = system_color
  583.     self.contents.draw_text(4, 32, 200, 32, "Rank Exp Gained:")    
  584.     self.contents.font.color = normal_color
  585.     self.contents.draw_text(170, 32, 200, 32, @rank_exp.to_s)    
  586.    
  587.     x = 4
  588.     self.contents.font.color = normal_color
  589.     cx = contents.text_size(@exp.to_s).width
  590.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  591.     x += cx + 4
  592.     self.contents.font.color = system_color
  593.     cx = contents.text_size("EXP").width
  594.     self.contents.draw_text(x, 0, 64, 32, "EXP")
  595.     x += cx + 16
  596.     self.contents.font.color = normal_color
  597.     cx = contents.text_size(@gold.to_s).width
  598.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  599.     x += cx + 4
  600.     self.contents.font.color = system_color
  601.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  602.     y = 64 #32
  603.     for item in @treasures
  604.       draw_item_name(item, 4, y)
  605.       y += 32
  606.     end
  607.   end
  608. end
  609.  
  610.  
  611. #==============================================================================
  612. # ** Game_Actor
  613. #------------------------------------------------------------------------------
  614. #  This class handles the actor. It's used within the Game_Actors class
  615. #  ($game_actors) and refers to the Game_Party class ($game_party).
  616. #==============================================================================
  617.  
  618. class Game_Actor < Game_Battler
  619.   #--------------------------------------------------------------------------
  620.   # * Public Instance Variables
  621.   #--------------------------------------------------------------------------
  622.   attr_accessor   :class_exp                     # EXP for classes
  623.   attr_accessor   :class_rank                    # Rank of the class
  624.   attr_accessor   :master_classes                # Used to store info on class
  625.   #--------------------------------------------------------------------------
  626.   # * Setup
  627.   #     actor_id : actor ID
  628.   #--------------------------------------------------------------------------
  629.   alias tds_transform_skills_setup setup
  630.    def setup(actor_id)
  631.     tds_transform_skills_setup(actor_id)
  632.     actor = $data_actors[actor_id]    
  633.     @class_exp = {}
  634.     @class_rank = {}
  635.     @master_classes = {}
  636.     ranking
  637.   end  
  638.   #--------------------------------------------------------------------------
  639.   # * Set rankings
  640.   #--------------------------------------------------------------------------
  641.   def ranking        
  642.     # Set values for class and exp if they are Nil
  643.     for i in RANKS.keys
  644.       # If Exp is Nil set the exp to the starting value
  645.       if @class_exp[i] == nil
  646.          @class_exp[i] = 0
  647.        end
  648.       # If Rank is nil set the first ranking for the class
  649.       if @class_rank[i] == nil        
  650.         @class_rank[i] = RANKS[i][0]
  651.       end            
  652.     end
  653.    
  654.     # If Ranks Mastered is nil
  655.     if @ranks_mastered == nil
  656.       # Gives values for mastering classes
  657.       for i in RANKS.keys
  658.         # Rank Mastered method
  659.         rank_mastered(i)
  660.       end
  661.     end
  662.  
  663.     # Sets the class bonuses
  664.     set_class_bonus(self.class_name, remove_class_bonus = nil)      
  665.     # Recover all
  666.     recover_all    
  667.     return
  668.   end
  669.  
  670.   #--------------------------------------------------------------------------
  671.   # * Class Status Bonus
  672.   #     class_name : Class to return value
  673.   #     stat       : Stat to return the value of bonus percent  
  674.   #--------------------------------------------------------------------------    
  675.   def class_status_bonus(class_name = nil, stat = 0)
  676.     # Array for status bonuses
  677.     bonus_array = [self.base_maxhp, self.base_maxsp, self.base_str, self.base_dex,
  678.     self.base_agi, self.base_int, self.base_atk, self.base_pdef, base_mdef]
  679.     # Status that will be used
  680.     @status_used = bonus_array[stat]
  681.     # Bonus percent used to get the total bonus
  682.     @bonus_percent = CLASS_STATUS_BONUS[class_name][stat]
  683.     # Makes total Bonus
  684.     @total_bonus = @status_used * @bonus_percent / 100
  685.     # Returns the bonus for the stat
  686.     return @total_bonus
  687.   end  
  688.  
  689.   #--------------------------------------------------------------------------
  690.   # * Class ID
  691.   #     return_class_name : Named used to return class ID  
  692.   #--------------------------------------------------------------------------    
  693.   def class_return_id(return_class_name = self.class_name)
  694.     # Gives i the value of the data classes size
  695.     for i in 1...$data_classes.size
  696.       # If any of the classes name is the same as the return name
  697.       if $data_classes[i].name == return_class_name
  698.         # Return ID is the same as the class ID
  699.         return_id = $data_classes[i].id
  700.       end        
  701.     end
  702.     # Returns ID value of the class name
  703.     return return_id
  704.   end  
  705.    
  706.   #--------------------------------------------------------------------------
  707.   # * master?
  708.   #     mster_class_name : Class to verify if it has been mastered
  709.   #--------------------------------------------------------------------------    
  710.   def master?(master_class_name = self.class_name)      
  711.    # If mastered class hash key is not nil
  712.    if @master_classes[master_class_name] != nil
  713.     # If the last value of the array is Mastered
  714.     if @master_classes[master_class_name].last == "Mastered"
  715.         # Mastered is set to true
  716.         mastered = true
  717.       else
  718.         # Mastered is set to false        
  719.         mastered = false        
  720.       end
  721.     end
  722.    
  723.      # Return Mastered value
  724.     return mastered
  725.   end
  726.  
  727.   #--------------------------------------------------------------------------
  728.   # * Can Use Class?
  729.   #     use_class_name : Class to verify if it can be used  
  730.   #--------------------------------------------------------------------------    
  731.   def can_use_class?(use_class_name = self.class_name)    
  732.     # If the requirements hash key is not nil
  733.     if ADVANCE_REQUIREMENTS[use_class_name] != nil
  734.      # Gives x the value of the requirements array size
  735.      for x in 0...ADVANCE_REQUIREMENTS[use_class_name].size
  736.       # If the classes inside the array of requirements have not been mastered
  737.       if master?(ADVANCE_REQUIREMENTS[use_class_name][x]) == false
  738.         # Use is set to false
  739.         use = false
  740.         # Breaks loop
  741.         break
  742.       # If class has mastered the requirements
  743.       else
  744.         # Use is set to true
  745.         use = true      
  746.       end  
  747.      end
  748.    end
  749.  
  750.    # Returns the value of wheter or not the class can be used
  751.    return use
  752.   end  
  753.  
  754.   #--------------------------------------------------------------------------
  755.   # * Exp For Level
  756.   #     exp_class_name : Class to return value of needed exp
  757.   #--------------------------------------------------------------------------    
  758.   def exp_for_lv(exp_class_name = self.class_name)
  759.     # If the class in the constant is not nil
  760.     if RANK_LV_UP_POINTS[exp_class_name] != nil
  761.      # Gives i the size value size for checking exp
  762.      for i in 0...RANK_LV_UP_POINTS[exp_class_name][0].size
  763.       # If if's not nil continue
  764.       if RANK_LV_UP_POINTS[exp_class_name][0][i].size != nil
  765.        # Gives x the value size of the exp
  766.        for x in 0...RANK_LV_UP_POINTS[exp_class_name][0][i].size  
  767.         # If class exp is equal to the exp in the rank level exp array
  768.         if @class_exp[exp_class_name] == RANK_LV_UP_POINTS[exp_class_name][0][i][x]            
  769.          # If the next level of the arrays is not nil
  770.          if RANK_LV_UP_POINTS[exp_class_name][0][i  + 1] != nil
  771.           # next exp is equal to the first number of the next exp array
  772.           next_exp = RANK_LV_UP_POINTS[exp_class_name][0][i + 1].first
  773.         else
  774.           # Next exp is equal to the last number of all exp arrays
  775.           next_exp = RANK_LV_UP_POINTS[exp_class_name][0][i].last        
  776.         end        
  777.        end
  778.       end
  779.     end
  780.    end
  781.     end
  782.     # Returns the value of the exp for the next level
  783.     return next_exp
  784.   end  
  785.  
  786.   #--------------------------------------------------------------------------
  787.   # * Rank Lv
  788.   #     master_class_name : Class used to verify info  
  789.   #--------------------------------------------------------------------------    
  790.   def rank_mastered(master_class_name = self.class_name)
  791.    
  792.   # Ranks mastered array
  793.   @ranks_mastered = []
  794.   # Size of the RANK constant ranks
  795.   for i in 0...RANKS[master_class_name].size
  796.    # Break if the Rank on the constant is the same as the current rank
  797.    break if RANKS[master_class_name][i] == @class_rank[master_class_name]
  798.     # If the rank is not the same as the current rank add it to the mastered array
  799.     if RANKS[master_class_name][i] != @class_rank[master_class_name]
  800.      # Add to the mastered array
  801.      @ranks_mastered << RANKS[master_class_name][i]  
  802.     end
  803.   end
  804.  
  805.   # Gives the value of the current mastered classes
  806.   @ranks_mastered = @ranks_mastered
  807.   # If class exp is the same as the last exp on the array master the class
  808.   if @class_exp[master_class_name] == RANK_LV_UP_POINTS[master_class_name][0].last.last
  809.     @ranks_mastered << RANKS[master_class_name].last
  810.     @ranks_mastered << "Mastered"
  811.   end
  812.  
  813.     # Gives the value of the mastered classes to the master hast
  814.     @master_classes[master_class_name] = @ranks_mastered
  815.     # Retunr the value of the variable in an array
  816.     return @master_classes[master_class_name]
  817.   end
  818.  
  819.   #--------------------------------------------------------------------------
  820.   # * Set Class Bonus
  821.   #     bonus_class_name : The class used to set the bonus
  822.   #     remove_class_bonus: Removes Bonus
  823.   #--------------------------------------------------------------------------  
  824.    def set_class_bonus(bonus_class_name, remove_class_bonus = nil)    
  825.     # If remove bonus is not nil return all stats to normal
  826.     if remove_class_bonus != nil
  827.       self.maxhp = self.base_maxhp    
  828.       self.maxsp = self.base_maxsp        
  829.       self.str   = self.base_str
  830.       self.dex   = self.base_dex    
  831.       self.agi   = self.base_agi
  832.       self.int   = self.base_int      
  833.     end    
  834.     # If remove bonus is nil add all the class bonuses
  835.     if remove_class_bonus == nil
  836.       self.maxhp = self.base_maxhp + self.class_status_bonus(bonus_class_name, 0)  
  837.       self.maxsp = self.base_maxsp + self.class_status_bonus(bonus_class_name, 1)        
  838.       self.str   = self.base_str + self.class_status_bonus(bonus_class_name, 2)
  839.       self.dex   = self.base_dex + self.class_status_bonus(bonus_class_name, 3)    
  840.       self.agi   = self.base_agi + self.class_status_bonus(bonus_class_name, 4)
  841.       self.int   = self.base_int +  self.class_status_bonus(bonus_class_name, 5)    
  842.     end  
  843.    return
  844.   end
  845.  
  846.   #--------------------------------------------------------------------------
  847.   # * learn_class_skills
  848.   #     learning_class : Class used for learning  
  849.   #--------------------------------------------------------------------------  
  850.    def learn_class_skills(learning_class = self.class_name)      
  851.     # If the Rank Skils Hash key is not nil
  852.     if RANK_SKILLS[learning_class] != nil
  853.      # Gives i the value of class key hash values
  854.      for i in 0...RANK_SKILLS[learning_class].size
  855.       # If a class has been mastered and it's one required to learn a skill
  856.       if @master_classes[learning_class].include?(RANK_SKILLS[learning_class][i][1])          
  857.         # Lean skill
  858.         learn_skill(RANK_SKILLS[learning_class][i][0])          
  859.        end  
  860.       end        
  861.     end    
  862.      return
  863.    end
  864.  
  865.   #--------------------------------------------------------------------------
  866.   # * Rank Exp
  867.   #     amount : Amount of Rank Exp to add to the character  
  868.   #--------------------------------------------------------------------------  
  869.    def rank_exp(amount)    
  870.      # Adds exp to the rank exp
  871.      for i in 0..amount
  872.        # Break loop if exp has reached the desired amount
  873.        break if i >= amount
  874.        # Keep adding exp until you reach the desired amount
  875.        @class_exp[self.class_name] += 1  
  876.        # Update Ranking
  877.        ranking      
  878.      end
  879.      
  880.    # if class exp is equal or more to the last rank limit exp give a max value
  881.    if @class_exp[self.class_name] >= RANK_LV_UP_POINTS[self.class_name][0].last.max
  882.       @class_exp[self.class_name] = RANK_LV_UP_POINTS[self.class_name][0].last.max
  883.    end
  884.  
  885.    # If exp is less than the minimun of the first rank give it a start value
  886.    if @class_exp[self.class_name] <= RANK_LV_UP_POINTS[self.class_name][0].first.min
  887.       @class_exp = RANK_LV_UP_POINTS[self.class_name][0].first.min
  888.     end      
  889.      
  890.    for i in 0...RANK_LV_UP_POINTS[self.class_name][0].size  
  891.     for x in 0...RANK_LV_UP_POINTS[self.class_name][0][i].size      
  892.      # If class exp for the actor is equal to the exp in one of the exp arrays
  893.      if @class_exp[self.class_name] == RANK_LV_UP_POINTS[self.class_name][0][i][x]
  894.        # Assigns rank to the actor
  895.        @class_rank[self.class_name] = RANKS[self.class_name][i]      
  896.        break
  897.      end
  898.     end
  899.    end
  900.    
  901.    # Update Ranking
  902.    ranking
  903.    # Update Mastered Ranks
  904.    rank_mastered  
  905.    # Updates Learn Skills
  906.    learn_class_skills
  907.    # Return the current class exp
  908.     return @class_exp[self.class_name]
  909.    end  
  910.  end
  911.  
  912.      
  913. #==============================================================================
  914. # ** Dragon Quest VII Class Change System
  915. #------------------------------------------------------------------------------
  916. #  Scene used to choose the character that will change it's class.
  917. #==============================================================================
  918.  
  919. class Scene_Class_Change_System
  920.   #--------------------------------------------------------------------------
  921.   # * Main Processing
  922.   #--------------------------------------------------------------------------
  923.   def main
  924.     # Make Spriteset Background
  925.     spriteset = Spriteset_Map.new
  926.   # Introduction message
  927.   intro_message = "Whose Class do you wish to change?"  
  928.   # Creates text window for messages in the class  
  929.   @text_window = Window_Base.new(80, 373, 480, 107)  
  930.   @text_window.contents = Bitmap.new(@text_window.width-32, @text_window.height-32)
  931.   # Introduction text message
  932.   @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)
  933.   # Text window back opacity
  934.   @text_window.back_opacity = 120
  935.   # Make array for Character command window
  936.   @command_characters = []
  937.   # Make array for Classes command window
  938.   @classes_commands = []
  939.   # Make who to choose title window
  940.   @who_windows = Window_Base.new(346, 165, 140, 46)        
  941.   # Who Window back opacity
  942.   @who_windows.back_opacity = 120
  943.   # Who window contents bitmap
  944.   @who_windows.contents = Bitmap.new(100, 14)
  945.   @who_windows.contents.draw_text(25 , 0-4, 70, 20, "Who?")
  946.   # Make status choose title window
  947.   @status_choose_windows = Window_Base.new(487, 165, 152, 46)      
  948.   # Status choose back opacity
  949.   @status_choose_windows.back_opacity = 120
  950.   # Status choose contents bitmap
  951.   @status_choose_windows.contents = Bitmap.new(120, 14)
  952.   # Makes the window for showing basic status of a player
  953.   @choosing_status_windows = Window_Base.new(487, 212, 152, 125)    
  954.   # Choosing window back opacity
  955.   @choosing_status_windows.back_opacity = 120
  956.   # Choosing window contents bitmap
  957.   @choosing_status_windows.contents = Bitmap.new(120, 87)  
  958.   @choosing_status_windows.contents.draw_text( 0, 64, 120, 25, "Level:")      
  959.   # Checks current party members
  960.   for i in 0...$game_party.actors.size
  961.     # Makes the names of the party members the commands for the window
  962.     @command_characters << $game_party.actors[i].name
  963.   end  
  964.  
  965.     # Make Character command window  
  966.   @character_command_window = Window_Command.new(140, @command_characters)
  967.   @character_command_window.x = 346
  968.   @character_command_window.y = 212
  969.   # Assigns primary name to the windows
  970.   actor = $game_party.actors[@character_command_window.index]
  971.   @status_choose_windows.contents.draw_text(0 , 0-4, 120, 20, actor.name.to_s, 1)      
  972.   @choosing_status_windows.contents.draw_text( 0, 0, 120, 25, actor.class_name.to_s, 1)    
  973.   @choosing_status_windows.contents.draw_text( 0, 64, 120, 25, "Level:")        
  974.   @choosing_status_windows.contents.draw_text( 77, 64, 120, 25, actor.level.to_s )        
  975.   @choosing_status_windows.contents.draw_text( 0, 32, 120, 25,
  976.   actor.class_rank[actor.class_name].to_s, 1)
  977.   # Character window back opacity
  978.   @character_command_window.back_opacity = 120
  979.     # Execute transition
  980.     Graphics.transition
  981.     # Main loop
  982.     loop do
  983.       # Update game screen
  984.       Graphics.update
  985.       # Update input information
  986.       Input.update
  987.       # Frame update
  988.       update
  989.       # Abort loop if screen is changed
  990.       if $scene != self
  991.         break
  992.       end
  993.     end
  994.     # Prepare for transition
  995.     Graphics.freeze
  996.     # Dispose of windows
  997.     @character_command_window.dispose
  998.   @text_window.dispose
  999.   @who_windows.dispose
  1000.   @status_choose_windows.dispose
  1001.   @choosing_status_windows.dispose  
  1002.   end
  1003.   #--------------------------------------------------------------------------
  1004.   # * Frame Update
  1005.   #--------------------------------------------------------------------------
  1006.   def update
  1007.     # Update windows
  1008.     @character_command_window.update  
  1009.   # Clears the contents of windows
  1010.   @status_choose_windows.contents.clear
  1011.   @choosing_status_windows.contents.clear
  1012.   # Update the choosing status window information
  1013.   update_choosing_status  
  1014.  
  1015.     # If C button was pressed
  1016.     if Input.trigger?(Input::C)
  1017.        # Play decision SE
  1018.        $game_system.se_play($data_system.decision_se)                
  1019.        # Change to class changing scene
  1020.        $scene = Scene_Class_Change_Menu.new(@character_command_window.index)        
  1021.       return
  1022.     end
  1023.  
  1024.    if Input.trigger?(Input::B)
  1025.       # Play cancel SE
  1026.       $game_system.se_play($data_system.cancel_se)
  1027.       # Switch to map screen
  1028.       $scene = Scene_Map.new
  1029.       return
  1030.     end 
  1031.   end
  1032.   #--------------------------------------------------------------------------
  1033.   # * Update the choosing status window
  1034.   #--------------------------------------------------------------------------
  1035.   def update_choosing_status
  1036.     # Draws content for windows
  1037.     actor = $game_party.actors[@character_command_window.index]
  1038.     @status_choose_windows.contents.draw_text(0 , 0-4, 120, 20, actor.name.to_s, 1)      
  1039.     @choosing_status_windows.contents.draw_text( 0, 0, 120, 25, actor.class_name.to_s, 1)    
  1040.     @choosing_status_windows.contents.draw_text( 0, 64, 120, 25, "Level:")        
  1041.     @choosing_status_windows.contents.draw_text( 77, 64, 120, 25, actor.level.to_s )        
  1042.     @choosing_status_windows.contents.draw_text( 0, 32, 120, 25,
  1043.     actor.class_rank[actor.class_name].to_s, 1)
  1044.   end
  1045. end
  1046.  
  1047.  
  1048. #==============================================================================
  1049. # ** Dragon Quest VII Class Change System Changing Menu
  1050. #------------------------------------------------------------------------------
  1051. #  Scene where actual class change happens.
  1052. #==============================================================================
  1053.  class Scene_Class_Change_Menu
  1054.   #--------------------------------------------------------------------------
  1055.   # * Object Initialization
  1056.   #     actor : Actor for class change
  1057.   #--------------------------------------------------------------------------
  1058.   def initialize(actor_id = 0)
  1059.     # Actor for use in the scene
  1060.     @actor_id = actor_id
  1061.   end  
  1062.      
  1063.   #--------------------------------------------------------------------------
  1064.   # * Main Processing
  1065.   #--------------------------------------------------------------------------
  1066.   def main
  1067.     # Make Spriteset Background
  1068.     spriteset = Spriteset_Map.new
  1069.   # Introduction message
  1070.   intro_message = "Which Class do you wish to take on?"  
  1071.   # Class changing steps
  1072.   @class_steps = 0
  1073.   # X axis value for text
  1074.   @x = 0
  1075.   # Title text to be used
  1076.   @title_text = "None"    
  1077.   # Creates text window for messages in the class  
  1078.   @text_window = Window_Base.new(201, 373, 440, 107)  
  1079.   @text_window.contents = Bitmap.new(@text_window.width-32, @text_window.height-32)
  1080.   # Introduction text message
  1081.   @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)
  1082.   # Text window back opacity
  1083.   @text_window.back_opacity = 120
  1084.   # Make array for Classes command window
  1085.   @classes_commands = []
  1086.   # Make status for jobs window
  1087.   @title_windows = Window_Base.new(0, 0, 200, 56)      
  1088.   # Status back opacity
  1089.   @title_windows.back_opacity = 120
  1090.   # Status contents bitmap
  1091.   @title_windows.contents = Bitmap.new(160, 20)
  1092.  
  1093.   # Commands for basic classes
  1094.   @classes_commands = ["Warrior", "Fighter", "Mage", "Cleric", "Dancer",
  1095.   "Bard", "Jester", "Mariner", "Thief", "Shepard", "Dragoon", "Ranger",
  1096.   "Paladin", "Sage", "TeenIdol", "Pirate", "Tamer", "GodHand", "Summoner",
  1097.   "Hero", "None"]
  1098.  
  1099.   # Array Index used to change title
  1100.   @basic_index = ["Warrior", "Fighter", "Mage", "Cleric", "Dancer",
  1101.   "Bard", "Jester", "Mariner", "Thief", "Shepard",  "None" ]
  1102.   # Array Index used to change title  
  1103.   @intermediate_index = ["Dragoon", "Ranger", "Paladin", "Sage", "TeenIdol",
  1104.   "Pirate", "Tamer"]  
  1105.   # Array Index used to change title    
  1106.   @expert_index = ["GodHand", "Summoner", "Hero"]    
  1107.    
  1108.   # Delete from commands array
  1109.   delete_from_commands = []
  1110.   for i in 0...@classes_commands.size
  1111.    if $game_party.actors[@actor_id].can_use_class?(@classes_commands[i]) == false    
  1112.      # Add to the delete from commands array    
  1113.      delete_from_commands << @classes_commands[i]    
  1114.     end  
  1115.   end
  1116.  
  1117.   # Gives i the value for deleting commands
  1118.   for i in 0...delete_from_commands.size
  1119.     # Deletes from the command array the clases that cannot be accessed yet
  1120.     @classes_commands.delete(delete_from_commands[i].to_s)
  1121.   end
  1122.  
  1123.  
  1124.     # Make Character command window    
  1125.   @class_command_window = Window_Command.new(200, @classes_commands)
  1126.   # Gives i the value of the command classes
  1127.   for i in 0...@classes_commands.size
  1128.    # If the current command is the same as the class of the actor
  1129.    if @classes_commands[i] == $game_party.actors[@actor_id].class_name
  1130.     # Make the index be the class of the actor
  1131.     @class_command_window.index = i
  1132.     end
  1133.   end
  1134.  
  1135.   # Gives i the value of the commands size
  1136.   for i in 0...@classes_commands.size
  1137.    # If actor has mastered a skill
  1138.    if $game_party.actors[@actor_id].master?(@classes_commands[i])
  1139.     # Change the color of the command
  1140.     @class_command_window.draw_item(i, Color.new(255, 255, 128, 255))
  1141.   end
  1142.  
  1143.   # If class is None draw it in normal color
  1144.   if @classes_commands[i] == "None"
  1145.     # Draw command
  1146.     @class_command_window.draw_item(i, Color.new(255, 255, 255, 255))    
  1147.    end  
  1148.   end
  1149.  
  1150.    # If currently the index is over a basic class
  1151.    for i in 0...@basic_index.size  
  1152.     # If the current command is the same as one in the basic index
  1153.     if @classes_commands[@class_command_window.index] == @basic_index[i]
  1154.        # Draw title in title window
  1155.        @title_windows.contents.draw_text(57 , 0, 200, 20, "Basic")
  1156.        # X axis value for text
  1157.        @x = 57
  1158.        # Title text to be used
  1159.        @title_text = "Basic"      
  1160.        # Breaks loop
  1161.        break
  1162.      end
  1163.    end
  1164.  
  1165.    # If currently the index is over a intermediate class  
  1166.    for i in 0...  @intermediate_index.size  
  1167.     # If the current command is the same as one in the intermediate index    
  1168.     if @classes_commands[@class_command_window.index] ==   @intermediate_index[i]
  1169.        # Draw title in title window      
  1170.        @title_windows.contents.draw_text(28 , 0, 200, 20, "Intermediate")
  1171.        # X axis value for text
  1172.        @x = 28
  1173.        # Title text to be used
  1174.        @title_text = "Intermediate"                  
  1175.        # Breaks loop      
  1176.        break
  1177.      end
  1178.    end
  1179.    
  1180.   # If currently the index is over a expert class  
  1181.    for i in 0...@expert_index.size  
  1182.     # If the current command is the same as one in the expert index          
  1183.     if @classes_commands[@class_command_window.index] == @expert_index[i]
  1184.        # Draw title in title window      
  1185.        @title_windows.contents.draw_text(57 , 0, 200, 20, "Expert")
  1186.        # X axis value for text
  1187.        @x = 57
  1188.        # Title text to be used
  1189.        @title_text = "Expert"      
  1190.        # Breaks loop            
  1191.        break
  1192.      end
  1193.    end
  1194.  
  1195.   # Gives a color to identify the actors current class
  1196.   @class_command_window.draw_item(@class_command_window.index, Color.new(128, 255, 128, 255))  
  1197.   @class_command_window.x = 0
  1198.   @class_command_window.y = 56
  1199.   @class_command_window.height = 424
  1200.   @class_command_window.back_opacity = 120  
  1201.   # Creates class status window  
  1202.   @class_status_window = Class_Status_Window.new(@actor_id)
  1203.   # Creates the prompt window for class changing
  1204.   @prompt_command_window = Window_Command.new(100, %w(Yes No))  
  1205.   @prompt_command_window.x = 539
  1206.   @prompt_command_window.y = 276
  1207.   @prompt_command_window.back_opacity = 130
  1208.   @prompt_command_window.visible = false
  1209.   @prompt_command_window.active = false  
  1210.  
  1211.     # Execute transition
  1212.     Graphics.transition
  1213.     # Main loop
  1214.     loop do
  1215.       # Update game screen
  1216.       Graphics.update
  1217.       # Update input information
  1218.       Input.update
  1219.       # Frame update
  1220.       update
  1221.       # Abort loop if screen is changed
  1222.       if $scene != self
  1223.         break
  1224.       end
  1225.     end
  1226.     # Prepare for transition
  1227.     Graphics.freeze
  1228.     # Dispose of windows
  1229.   @text_window.dispose
  1230.     @class_command_window.dispose
  1231.   @title_windows.dispose
  1232.   @class_status_window.dispose
  1233.   end
  1234.   #--------------------------------------------------------------------------
  1235.   # * Frame Update
  1236.   #--------------------------------------------------------------------------
  1237.   def update
  1238.     # Update windows
  1239.     @class_command_window.update
  1240.   @prompt_command_window.update  
  1241.   # Clears title text
  1242.   @title_windows.contents.clear          
  1243.   # Draw title in title window
  1244.   @title_windows.contents.draw_text(@x , 0, 200, 20, @title_text.to_s)      
  1245.  
  1246.   # If current index is not equal to the index variable update
  1247.   # (Used to lower refres lag)
  1248.   if @class_command_window.index != @index and @class_command_window.active
  1249.     # Refreshes status window with the current class in the command window index
  1250.     @class_status_window.refresh(@classes_commands[@class_command_window.index])
  1251.     # index is given the value of the current class command window index
  1252.     @index = @class_command_window.index
  1253.     # Updates title text
  1254.     update_title_text
  1255.   end
  1256.  
  1257.   # If prompt window is active and class steops is 0  
  1258.   if @prompt_command_window.active and @class_steps == 0
  1259.     # Update the first phase of class change    
  1260.     class_change_update_step_one
  1261.    return  
  1262.   end
  1263.    
  1264.   # If prompt window is active and class steops is 1
  1265.   if @class_steps >= 1
  1266.     # Update the second phase of class change
  1267.      class_changing
  1268.    return  
  1269.   end
  1270.  
  1271.    # If C button was pressed and prompt window is not active yet
  1272.    if Input.trigger?(Input::C) and @prompt_command_window.active == false
  1273.      if @classes_commands[@class_command_window.index] == $game_party.actors[@actor_id].class_name
  1274.         # Play buzzer SE
  1275.         $game_system.se_play($data_system.buzzer_se)      
  1276.         return
  1277.        end
  1278.       # Play decision SE
  1279.       $game_system.se_play($data_system.decision_se)                    
  1280.       # Class command window is inactive
  1281.       @class_command_window.active = false
  1282.       # Prompt command window is visible      
  1283.       @prompt_command_window.visible = true
  1284.       # Prompt command window is activated
  1285.       @prompt_command_window.active = true
  1286.       # Class steps is set to pre starting point
  1287.       @class_steps = 0
  1288.     return
  1289.   end  
  1290.      
  1291.  
  1292.   # If B button was pressed
  1293.     if Input.trigger?(Input::B)
  1294.       # Play cancel SE
  1295.       $game_system.se_play($data_system.cancel_se)
  1296.       # Return back to the class changing scene
  1297.     $scene = Scene_Map.new
  1298.       return
  1299.     end 
  1300.   end
  1301.  
  1302.   #--------------------------------------------------------------------------
  1303.   # * Frame Update(Updates Title Text)
  1304.   #--------------------------------------------------------------------------  
  1305.   def update_title_text  
  1306.    # If currently the index is over a basic class
  1307.    for i in 0...@basic_index.size  
  1308.     # If the current command is the same as one in the basic index
  1309.     if @classes_commands[@class_command_window.index] == @basic_index[i]
  1310.        # X axis value for text
  1311.        @x = 57
  1312.        # Title text to be used
  1313.        @title_text = "Basic"
  1314.        # Breaks loop
  1315.        break
  1316.      end
  1317.    end
  1318.  
  1319.    # If currently the index is over a intermediate class  
  1320.    for i in 0...  @intermediate_index.size  
  1321.     # If the current command is the same as one in the intermediate index    
  1322.     if @classes_commands[@class_command_window.index] ==   @intermediate_index[i]
  1323.        # X axis value for text
  1324.        @x = 28
  1325.        # Title text to be used
  1326.        @title_text = "Intermediate"            
  1327.        # Breaks loop      
  1328.        break
  1329.      end
  1330.    end
  1331.    
  1332.   # If currently the index is over a expert class  
  1333.    for i in 0...@expert_index.size  
  1334.     # If the current command is the same as one in the expert index          
  1335.     if @classes_commands[@class_command_window.index] == @expert_index[i]
  1336.        # X axis value for text
  1337.        @x = 57
  1338.        # Title text to be used
  1339.        @title_text = "Expert"
  1340.        # Breaks loop            
  1341.        break
  1342.      end
  1343.    end
  1344.   return
  1345.  end
  1346.  
  1347.   #--------------------------------------------------------------------------
  1348.   # * Frame Update
  1349.   #--------------------------------------------------------------------------  
  1350.   def class_changing
  1351.        # Clears message window contents
  1352.        @text_window.contents.clear        
  1353.        # Name of the class in the current index
  1354.        name = @classes_commands[@class_command_window.index]      
  1355.        # ID for class Changing      
  1356.        id = $game_party.actors[@actor_id].class_return_id(name.to_s)        
  1357.  
  1358.        case @class_steps
  1359.         when 1
  1360.           # First line of the class changing message
  1361.           line_one = "Hold the image of the " +
  1362.           @classes_commands[@class_command_window.index].to_s +
  1363.           " In your heart"
  1364.           # Second line of the class changing message      
  1365.           line_two = "and pray."      
  1366.         when 2    
  1367.           # First line of the class changing message
  1368.            line_one = "Oh God, let " + $game_party.actors[@actor_id].name.to_s +
  1369.            " walk a new path in life."
  1370.         when 3                
  1371.          if @once_check == nil
  1372.            Audio.se_play("Audio/SE/112-Heal08", 80, 0)  
  1373.            @once_check = true
  1374.          end
  1375.           # First line of the class changing message
  1376.            line_one = $game_party.actors[@actor_id].name.to_s +
  1377.            ", You will now go forth as a " +
  1378.            @classes_commands[@class_command_window.index].to_s + "."                              
  1379.            # Change actors class ID to the new class ID
  1380.            $game_party.actors[@actor_id].class_id = id        
  1381.            # Refresh status windows content
  1382.            @class_status_window.refresh(@classes_commands[@class_command_window.index])          
  1383.          when 4
  1384.           # Return back to the class changing scene
  1385.           $scene = Scene_Class_Change_Menu.new                  
  1386.           return
  1387.          end                
  1388.          
  1389.           # Write message in the message window        
  1390.           @text_window.contents.draw_text( 0, 0, 500, 25, line_one.to_s)                
  1391.           @text_window.contents.draw_text( 0, 32, 420, 25, line_two.to_s)                    
  1392.        
  1393.         # If C button was pressed
  1394.         if Input.trigger?(Input::C)        
  1395.            # Play decision SE
  1396.            $game_system.se_play($data_system.decision_se)          
  1397.            @class_steps += 1          
  1398.           return
  1399.         end
  1400.         return
  1401.       end
  1402.  
  1403.   #--------------------------------------------------------------------------
  1404.   # * Frame Update
  1405.   #--------------------------------------------------------------------------  
  1406.   def class_change_update_step_one      
  1407.     # Clears message window contents
  1408.     @text_window.contents.clear
  1409.     # New message to be written
  1410.     message = "So, " + $game_party.actors[@actor_id].name.to_s +
  1411.     ", Do you wish to become a " +
  1412.     @classes_commands[@class_command_window.index].to_s + "?"  
  1413.     # Write message in the message window
  1414.     @text_window.contents.draw_text( 0, 0, 420, 25, message.to_s)    
  1415.  
  1416.     # If C button was pressed
  1417.     if Input.trigger?(Input::C) and @class_steps = 0
  1418.       # Use the prompt command window index to determine action
  1419.       case @prompt_command_window.index
  1420.        when 0 # When Yes
  1421.         # Play decision SE
  1422.         $game_system.se_play($data_system.decision_se)        
  1423.         # Prompt command window is not visible
  1424.         @prompt_command_window.visible = false
  1425.         # Prompt command window is not active
  1426.         @prompt_command_window.active = false        
  1427.         # Class steps is set to it's second point
  1428.         @class_steps = 1        
  1429.         return
  1430.        when 1 # When No
  1431.         # Play cancel SE
  1432.         $game_system.se_play($data_system.cancel_se)
  1433.         # Class command window is activated
  1434.         @class_command_window.active = true
  1435.         # Prompt command window is not visible
  1436.         @prompt_command_window.visible = false
  1437.         # Prompt command window is not active
  1438.         @prompt_command_window.active = false
  1439.         # Clears message window contents
  1440.         @text_window.contents.clear    
  1441.         # New message to be written
  1442.         intro_message = "Which Class do you wish to take on?"  
  1443.         # Write message in the message window        
  1444.         @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)            
  1445.         return
  1446.       end
  1447.      return
  1448.    end
  1449.    
  1450.     if Input.trigger?(Input::B)
  1451.       # Play cancel SE
  1452.       $game_system.se_play($data_system.cancel_se)
  1453.       @class_command_window.active = true
  1454.       @prompt_command_window.visible = false
  1455.       @prompt_command_window.active = false
  1456.       @class_steps = 0
  1457.       @text_window.contents.clear                
  1458.       intro_message = "Which Class do you wish to take on?"  
  1459.       @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)            
  1460.        return
  1461.     end 
  1462.   end
  1463.  end    
  1464.  
  1465.  
  1466.  
  1467.  
  1468. #==============================================================================
  1469. # ** Class Status Window
  1470. #------------------------------------------------------------------------------
  1471. #  This window displays class content.
  1472. #==============================================================================
  1473.  
  1474. class Class_Status_Window < Window_Base
  1475.   #--------------------------------------------------------------------------
  1476.   # * Object Initialization
  1477.   #--------------------------------------------------------------------------
  1478.   def initialize(actor_id = 0)
  1479.     # Actor info used in window
  1480.     @actor_id = actor_id
  1481.     super(201, 0, 439, 372)
  1482.     self.contents = Bitmap.new(width - 32, height - 32)
  1483.     # windows back opacity
  1484.     self.back_opacity = 120
  1485.     # Current actor used for info
  1486.     @actor = $game_party.actors[@actor_id]
  1487.     # Status class name variable
  1488.     @status_class = @actor.class_name
  1489.     refresh(@status_class)
  1490.   end
  1491.   #--------------------------------------------------------------------------
  1492.   # * Refresh
  1493.   #--------------------------------------------------------------------------
  1494.   def refresh(class_name)
  1495.     self.contents.clear
  1496.     # Current class name
  1497.     @status_class = class_name
  1498.    
  1499.     self.contents.font.color = system_color    
  1500.     self.contents.draw_text(0, -135, 300, 300, "Name:")        
  1501.     self.contents.draw_text(190, -135, 300, 300, "Class:")            
  1502.     self.contents.draw_text(190, -76, 300, 300, "Rank Exp:")                
  1503.     self.contents.draw_text(0, -105, 300, 300, "Rank:")                    
  1504.     self.contents.draw_text(190, -105, 300, 300, "Master:")                        
  1505.  
  1506.     # Draws all basic status Names
  1507.     self.contents.draw_text(0, -62 -14, 300, 300, "HP:")                
  1508.     self.contents.draw_text(0, -32 -14, 300, 300, "SP:")        
  1509.     self.contents.draw_text(0, 0 -14, 300, 300, "ATK:")        
  1510.     self.contents.draw_text(0, 32 -14, 300, 300, "PDF:")            
  1511.     self.contents.draw_text(0, 64 -14, 300, 300, "MDF:")    
  1512.     self.contents.draw_text(0, 100 -14, 300, 300, "STR:")                    
  1513.     self.contents.draw_text(0, 132 -14, 300, 300, "DEX:")                        
  1514.     self.contents.draw_text(0, 164 -14, 300, 300, "AGI:")                        
  1515.     self.contents.draw_text(0, 196 -14, 300, 300, "INT:")                            
  1516.     self.contents.font.color = normal_color
  1517.     # Markers
  1518.     self.contents.draw_text(84, 0 -76, 300, 300, "  »»")        
  1519.     self.contents.draw_text(84, 0 -46, 300, 300, "  »»")          
  1520.     self.contents.draw_text(50, 0 -14, 300, 300, "  »»              »»")        
  1521.     self.contents.draw_text(50, 32 -14, 300, 300, "  »»              »»")            
  1522.     self.contents.draw_text(50, 64 -14, 300, 300, "  »»              »»")    
  1523.     self.contents.draw_text(50, 100 -14, 300, 300, "  »»              »»")                    
  1524.     self.contents.draw_text(50, 132 -14, 300, 300, "  »»              »»")                        
  1525.     self.contents.draw_text(50, 164 -14, 300, 300, "  »»              »»")                        
  1526.     self.contents.draw_text(50, 196 -14, 300, 300, "  »»              »»")                                    
  1527.  
  1528.     # Status variables
  1529.     hp = @actor.base_maxhp + @actor.class_status_bonus(@status_class, 0)
  1530.     sp = @actor.base_maxsp +  @actor.class_status_bonus(@status_class, 1)
  1531.     str = @actor.base_str + @actor.class_status_bonus(@status_class, 2)
  1532.     dex = @actor.base_dex + @actor.class_status_bonus(@status_class, 3)    
  1533.     agi = @actor.base_agi + @actor.class_status_bonus(@status_class, 4)
  1534.     int = @actor.base_int +  @actor.class_status_bonus(@status_class, 5)    
  1535.     atk = @actor.base_atk + @actor.class_status_bonus(@status_class, 6)
  1536.     pdef = @actor.base_pdef + @actor.class_status_bonus(@status_class, 7)
  1537.     mdef = @actor.base_mdef + @actor.class_status_bonus(@status_class, 8)
  1538.    
  1539.     # Status with bonuses    
  1540.     self.contents.draw_text(127, 0 -76, 300, 300, hp.to_s)        
  1541.     self.contents.draw_text(127, 0 -46, 300, 300, sp.to_s)    
  1542.     self.contents.draw_text(193, 0 -14, 300, 300, atk.to_s)        
  1543.     self.contents.draw_text(193, 32 -14, 300, 300, pdef.to_s)            
  1544.     self.contents.draw_text(193, 64 -14, 300, 300, mdef.to_s)    
  1545.     self.contents.draw_text(193, 100 -14, 300, 300, str.to_s)                    
  1546.     self.contents.draw_text(193, 132 -14, 300, 300, dex.to_s)                        
  1547.     self.contents.draw_text(193, 164 -14, 300, 300, agi.to_s)                        
  1548.     self.contents.draw_text(193, 196 -14, 300, 300, int.to_s)                            
  1549.    
  1550.     # Status variables without bonuses
  1551.     hp = @actor.maxhp
  1552.     sp = @actor.maxsp
  1553.     str = @actor.str
  1554.     dex = @actor.dex    
  1555.     agi = @actor.agi
  1556.     int = @actor.int    
  1557.     atk = @actor.atk
  1558.     pdef = @actor.pdef
  1559.     mdef = @actor.mdef
  1560.     # Status without bonuses    
  1561.     self.contents.draw_text(40, 0 -76, 300, 300, hp.to_s)        
  1562.     self.contents.draw_text(40, 0 -46, 300, 300, sp.to_s)          
  1563.     self.contents.draw_text(100, 0 -14, 300, 300, atk.to_s)        
  1564.     self.contents.draw_text(100, 32 -14, 300, 300, pdef.to_s)            
  1565.     self.contents.draw_text(100, 64 -14, 300, 300, mdef.to_s)    
  1566.     self.contents.draw_text(100, 100 -14, 300, 300, str.to_s)                    
  1567.     self.contents.draw_text(100, 132 -14, 300, 300, dex.to_s)                        
  1568.     self.contents.draw_text(100, 164 -14, 300, 300, agi.to_s)                        
  1569.     self.contents.draw_text(100, 196 -14, 300, 300, int.to_s)                            
  1570.  
  1571.     # Master Icons Array
  1572.     @master_icons = []
  1573.     # If status is other than None
  1574.     if @status_class != "None"
  1575.     # Gives i the size value of the ranks in the selected class
  1576.     for i in 0...RANKS[@status_class].size
  1577.       # Adds icons to the master_icon array
  1578.       @master_icons << bitmap = RPG::Cache.icon("Master_Icon")      
  1579.       # If i is less or equal to the mastered ranks
  1580.       if i <= @actor.rank_mastered(@status_class).size - 1
  1581.        # Draw mastered icons with full opacity
  1582.        self.contents.blt(260 + i * 17, 35, @master_icons[i], Rect.new(0, 0, 24, 24), 255)                  
  1583.       else
  1584.        # Draw icons unmastered icons with less opacity
  1585.        self.contents.blt(260 + i * 17, 35, @master_icons[i], Rect.new(0, 0, 24, 24), 80)                        
  1586.       end
  1587.      end
  1588.     end
  1589.  
  1590.     # Draw actors class rank
  1591.     self.contents.draw_text(55, 30, 300, 32, @actor.class_rank[@status_class].to_s)    
  1592.     exp_string =  @actor.class_exp[@status_class].to_s + " / " + @actor.exp_for_lv(@status_class).to_s
  1593.     # If current status is not None
  1594.     if @status_class != "None"    
  1595.       # Draws the exp of the rank      
  1596.       self.contents.draw_text(290, 59, 300, 32, exp_string.to_s)            
  1597.     # Else if clas is equal to None  
  1598.     elsif @status_class == "None"
  1599.       self.contents.draw_text(290, 59, 300, 32, "-------")                        
  1600.       self.contents.draw_text(264, 30, 300, 32, "-------")                              
  1601.     else
  1602.       self.contents.draw_text(290, 59, 300, 32, "-------")            
  1603.     end  
  1604.     # Draws currently selected class
  1605.     self.contents.draw_text(250, 0, 300, 32, @actor.class_name)
  1606.     # Draws actors name
  1607.     draw_actor_name(@actor, 60, 0)    
  1608.   end
  1609. end
  1610.  
Expand to see the code.


Edit: I found the solution, I had to go to line 665 or so to comment out the line that contains recover_all. I now have the edited script working in my favor, and I can now have a class changing system for my RPG adventures. Thanks so much, and if any moderator finds this topic, they have my preemptive permission to close this board. Thanks.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=71284