Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[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.

Code:
 

#==============================================================================

# ** TDS Class Change System

# Version: 1.7

# Request: xXDarkDragonXx

# Special thanks: ASHTON MCNALLY class guide, xXDarkDragonXx(Testing, Ideas).

#------------------------------------------------------------------------------

#  Well this script is a system for class changing that also incluides ranks 

#  for each class.

#

#  With each new rank is possible to learn more skills from that class and master

#  it to unluck other more advance classes.

#==============================================================================

 

#--------------------------------------------------------------------------

# * Ranks for each class

#     Hash Input:

#

#    "Class Name" => ["Ranks 1", "Ranks 2", "Rank 3"]

#--------------------------------------------------------------------------

 

RANKS = { 

#--------------------------------------------------------------------------

# * BASIC CLASSES

#--------------------------------------------------------------------------

 

# Warrior Class and Ranks

"Warrior" => ["Beginner", "Novice", "Soldier", "Guardsman", "Veteran",

"Warmonger", "Elite", "General"],

 

# Fighter Class and ranks

"Fighter" => ["Beginner", "Novice", "Grappler", "BlackBelt", "Assassin",

"Ninja", "Sensei", "Master"],

 

# Mage Class and Ranks

"Mage" => ["Beginner", "Novice", "Dabbler", "Magician", "Sorcerer", "Wizard", 

"Warlock", "Archmage"],

 

# Cleric Class and Ranks

"Cleric" => ["Beginner", "Novice", "Acolyte", "Prelate", "Clergyman", "Priest", 

"Bishop", "HiPriest"],

 

# Dancer Class and Ranks

"Dancer" => ["Beginner", "Apprentice", "ToeTapper", "Dervish", "Amateur", 

"Prancer", "Bouncer", "TruTalent"],

 

# Bard Class and Ranks

"Bard" => ["Beginner", "Novice", "Poet", "Lyricist", "Warbler", "Crooner", 

"Songster", "Minstrel"],

 

# Jester Class and Ranks

"Jester" => ["Beginner", "Novice", "GoofOff", "Buffoon", "StandUp", "Comedian", 

"Joker", "Fool"],

 

# Mariner Class and Ranks

"Mariner" => ["Beginner", "Novice", "DeckHand", "Seafarer", "Navigator", 

"Helmsman", "Captain", "Admiral"],

 

# Thief Class and Ranks

"Thief" => ["Beginner", "Novice", "CutPurse", "Pilferer", "Brigand", "Rogue", 

"Scoundrel", "Big Boss"],

 

# Shepard Class and Ranks

"Shepard" => ["Beginner", "Novice", "FarmHand", "SlopFeed", "Swain", "Fleecer", 

"Herder", "SheepLord"],

 

#--------------------------------------------------------------------------

# * INTERMEDIATE CLASSES

#--------------------------------------------------------------------------

 

# Dragoons Class and Ranks

"Dragoon" => ["Gladiator", "Fencer", "Swordsman", "Ronin", "Mercenary", "Duelist", 

"Champion", "Avenger"],

 

# Ranger Class and Ranks

"Ranger" => ["Bouncer", "Wanderer", "Scout", "Battler", "Enchanter", "Blade Mage", 

"Conqueror", "Faust"],

 

# Paladin Class and Ranks

"Paladin" => ["Page", "Squire", "Knight", "Zealot", "Crusader", "Templar", 

"Holy Knight", "Martyr"],

 

# Sage Class and Ranks

"Sage" => ["Student", "Counsel", "Arbiter", "Seer", "Oracle", "Wise One", "Elder",

"Prophet"],

 

# TeenIdol Class and Ranks

"TeenIdol" => ["Fan", "Groupie", "Rebel", "Performer", "Star", "Artist", "Sellout",

"Icon"],

 

# Pirate Class and Ranks

"Pirate" => ["ShipWreck", "Barnacle", "Swab", "Cutthroat", "Buccaneer", "Smuggler", 

"Marauder", "Sea Dog"],

 

# Tamer Class and Ranks

"Tamer" => ["Pet Owner", "Groomer", "Ranch Hand", "Tracker", "Hunter", "Handler", 

"Trainer", "Beast Lord"],

 

#--------------------------------------------------------------------------

# * EXPERT CLASSES

#--------------------------------------------------------------------------

 

# GodHand Class and Ranks

"GodHand" => ["Saint", "Angel", "Archangel", "Throne", "Cherubim", "Seraphim", 

"Celestial", "Demigod"],

 

# Summoner Class and Ranks

"Summoner" => ["Theurgist", "Conjuror", "Geomancer", "Elemental", "Maelstrom", 

"Tempest", "Fury", "Ragnarok"],

 

# Hero Class and Ranks

"Hero" => ["Archetype", "Defender", "Paragon", "Savior", "Guardian", "Avatar", 

"Legend", "ChosenOne"],

 

"None" => ["No Rank"],

 

"Magister" => ["Beginner", "Novice", "Average", "Intermediate", "Experienced",

"Advance", "Expert", "MASTERED!"]

 

}

 

#--------------------------------------------------------------------------

# * Advance Requirements

#     Hash Input:

#

#     "Class Name" => [[skill ID, Rank Required], [skill ID, Rank Required]]

#--------------------------------------------------------------------------

 

ADVANCE_REQUIREMENTS = {

 

#--------------------------------------------------------------------------

# * INTERMEDIATE CLASSES

#--------------------------------------------------------------------------

 

# Dragoons Requirements

"Dragoon" => ["Warrior", "Fighter"],

 

# Ranger Requirements

"Ranger" => ["Warrior", "Mage"],

 

# Paladin Requirements

"Paladin" => ["Fighter", "Cleric"],

 

# Sage Bonuses

"Sage" => ["Fighter", "Mage", "Cleric"],

 

# TeenIdol Requirements

"TeenIdol" => ["Dancer", "Bard", "Jester"],

 

# Pirate Requirements

"Pirate" => ["Mariner", "Thief"],

 

# Tamer Requirements

"Tamer" => ["Thief", "Shepard"],

 

#--------------------------------------------------------------------------

# * EXPERT CLASSES

#--------------------------------------------------------------------------

 

# GodHand Requirements

"GodHand" => ["Dragoon", "Paladin"],

 

# Summoner Requirements

"Summoner" => ["Sage", "TeenIdol"],

 

# Hero Requirements

"Hero" => ["Dragoon", "Ranger", "Paladin", "Sage", "TeenIdol", "Pirate", "Tamer"]

 

}

 

#--------------------------------------------------------------------------

# * Ranks Skills

#     Hash Input:

#

#     "Class Name" => [[skill ID, Rank Required], [skill ID, Rank Required]]

#--------------------------------------------------------------------------

 

RANK_SKILLS = { 

# Warrior skills

"Warrior" => [[57, "Novice"], [58, "Guardsman"], [59, "Warmonger"], 

[60, "General"]],

 

"Fighter" => [[57, "Beginner"], [58, "Beginner"]],

 

"None" => []

 

}

 

 

#--------------------------------------------------------------------------

# * Ranks Exp limit

#     Hash Input:

#

#     Troop ID => [Exp Given, Level limit]

#--------------------------------------------------------------------------

 

#EXP_LIMIT = { 1 => [1, 10]

EXP_LIMIT = { 1 => [255, 100]

 

 

}

 

#--------------------------------------------------------------------------

# * Rank Status Bonus

#     Hash Input:

#

#     "Class Name" =>  [HP, SP, STR, DEX, AGI, INT, ATK, PDEF, MDEF]

#      ** - used for negative values and normal numbers as positive.

#--------------------------------------------------------------------------

 

CLASS_STATUS_BONUS = { 

#--------------------------------------------------------------------------

# * BASIC CLASSES

#--------------------------------------------------------------------------

 

# Warrior Bonuses

"Warrior" => [10, -60, 10, 0, -35, -30, 30, 30, 0], 

 

# Fighter Bonuses

"Fighter" => [ 0 ,-50, 0, 5, 15, -15, -30, 10, -10, -5],

 

# Mage Bonuses

"Mage" => [-40, 10, -40, 3, -5, 20, -20, -40, 40],

 

# Cleric Bonuses

"Cleric" => [-20, 0, -20, 5, -10, 10, -10, -30, 20],

 

# Dancer Bonuses

"Dancer" => [-30, -20, -30, 30, 30, 0, 10, -40, 0],

 

# Bard Bonuses

"Bard" => [-20, 0, -25, -10, -5, 20, 0, -15, 10],

 

# Jester Bonuses

"Jester" => [-30, -40, -30, -20, -30, -20, -30, -40, -40], 

 

# Mariner Bonuses

"Mariner" => [15, -20, 0, 10, 5, -10, 10, 10, -5],

 

# Thief Class and Exp 

"Thief" => [-10, -40, -10, 25, 20, -10, -5, -30, -15],

 

# Shepard Bonuses

"Shepard" => [-20, -30, -15, 0, 0, 0, -10, -20, -10 ],

 

#--------------------------------------------------------------------------

# * INTERMEDIATE CLASSES

#--------------------------------------------------------------------------

 

# Dragoons Bonuses

"Dragoon" => [20, -40, 15, 5, 10, -20, 20, 10, 5],

 

# Ranger Bonuses

"Ranger" => [-10, 10, 5, 5, 10, 0, 10, -15, 15],

 

# Paladin Bonuses

"Paladin" => [0, 0, 15, 10, 15, 15, 0, 10, 10],

 

# Sage Bonuses

"Sage" => [-20, 20, -30, 5, 5, 20, -10, -20, 20],

 

# TeenIdol Bonuses

"TeenIdol" => [-20, 10, -20, -5, -10, 0, -10, -10, -5],

 

# Pirate Bonuses

"Pirate" => [5, -10, 10, 10, 10, -10, 10, 20, -10],

 

# Tamer Bonuses

"Tamer" => [-5, -5, 0, 10, 10, 20, -5, 0, 5],

 

 

#--------------------------------------------------------------------------

# * EXPERT CLASSES

#--------------------------------------------------------------------------

 

# GodHand Bonuses

"GodHand" => [10, -10, 25, 15, 10, 0, 25, 5, 0],

 

# Summoner Requirements

"Summoner" => [-10, 20, -10, 10, 15, 20, -10, -10, 20],

 

# Hero Requirements

"Hero" => [10, 10, 10, 10, 10, 15, 15, 10, 10],

 

"None" => [0, 0, 0, 0, 0, 0, 0, 0, 0],

 

"Magister" => [0, 0, 0, 0, 0, 0, 0, 0, 0]

 

}

 

 

#--------------------------------------------------------------------------

# * Ranks Level Up Points Table

#     Hash Input:

#

#     "Class Name" => [[(Exp for rank start..Exp for rank end).to_a]]

#--------------------------------------------------------------------------

 

RANK_LV_UP_POINTS = { 

#--------------------------------------------------------------------------

# * BASIC CLASSES

#--------------------------------------------------------------------------

 

# Warrior Class and Exp

"Warrior" => [[(0..9).to_a, (10..30).to_a, (31..55).to_a, (56..90).to_a, 

(91..130).to_a, (131..155).to_a, (156..180).to_a, (180..201).to_a]],

 

# Fighter Class and Exp

"Fighter" => [[(0..9).to_a, (10..30).to_a, (31..55).to_a, (56..90).to_a, 

(91..130).to_a, (131..155).to_a, (156..180).to_a, (180..201).to_a]],

 

# Mage Class and Exp

"Mage" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Cleric Class and Exp

"Cleric" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Dancer Class and Exp

"Dancer" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Bard Class and Exp

"Bard" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Jester Class and Exp

"Jester" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Mariner Class and Exp

"Mariner" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Thief Class and Exp 

"Thief" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Shepard Class and Exp

"Shepard" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

#--------------------------------------------------------------------------

# * INTERMEDIATE CLASSES

#--------------------------------------------------------------------------

 

# Dragoons Class and Exp

"Dragoon" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

 

"Jerry" => [[(0..3).to_a, (4..10).to_a]],

 

# Ranger Class and Exp

"Ranger" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Paladin Class and Exp

"Paladin" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Sage Class and Exp

"Sage" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# TeenIdol Class and Exp

"TeenIdol" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Pirate Class and Exp

"Pirate" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Tamer Class and Exp

"Tamer" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

#--------------------------------------------------------------------------

# * EXPERT CLASSES

#--------------------------------------------------------------------------

 

# GodHand Class and Exp

"GodHand" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Summoner Class and Exp

"Summoner" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

# Hero Class and Exp

"Hero" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]],

 

"None" => [[(0).to_a]],

 

"Magister" => [[(0..9).to_a, (10..19).to_a, (20..29).to_a, (30..39).to_a, 

(40..49).to_a, (50..59).to_a, (60..69).to_a, (70..79).to_a]]

 

}

 

#==============================================================================

# ** Game_Battler (part 1)

#------------------------------------------------------------------------------

#  This class deals with battlers. It's used as a superclass for the Game_Actor

#  and Game_Enemy classes.

#==============================================================================

 

class Game_Battler

  #--------------------------------------------------------------------------

  # * Get Attack Power

  #--------------------------------------------------------------------------

  def atk    

    # If self is an actor use bonus

    if self.is_a?(Game_Actor)    

      n = base_atk + class_status_bonus(self.class_name, 6)

    else

      n = base_atk    

    end

  

    for i in @states

      n *= $data_states[i].atk_rate / 100.0

    end

    return Integer(n)

  end

  #--------------------------------------------------------------------------

  # * Get Physical Defense Power

  #--------------------------------------------------------------------------

  def pdef

    # If self is an actor use bonus    

    if self.is_a?(Game_Actor)

      n = base_pdef + class_status_bonus(self.class_name, 7)

    else

      n = base_pdef

    end

    

    for i in @states

      n *= $data_states[i].pdef_rate / 100.0

    end

    return Integer(n)

  end

  #--------------------------------------------------------------------------

  # * Get Magic Defense Power

  #--------------------------------------------------------------------------

  def mdef

    # If self is an actor use bonus    

    if self.is_a?(Game_Actor)        

      n = base_mdef + class_status_bonus(self.class_name, 8)

    else

      n = base_mdef     

    end

  

    for i in @states

      n *= $data_states[i].mdef_rate / 100.0

    end

    return Integer(n)

  end

end

 

#==============================================================================

# ** Scene_Battle (part 2)

#------------------------------------------------------------------------------

#  This class performs battle screen processing.

#==============================================================================

 

class Scene_Battle

  #--------------------------------------------------------------------------

  # * Start After Battle Phase

  #--------------------------------------------------------------------------

  def start_phase5

    # Shift to phase 5

    @phase = 5

    # Play battle end ME

    $game_system.me_play($game_system.battle_end_me)

    # Return to BGM before battle started

    $game_system.bgm_play($game_temp.map_bgm)

    # Initialize EXP, amount of gold, and treasure

    exp = 0

    gold = 0

    treasures = []

    # Loop

    for enemy in $game_troop.enemies

      # If enemy is not hidden

      unless enemy.hidden

        # Add EXP and amount of gold obtained

        exp += enemy.exp

        gold += enemy.gold

        # Determine if treasure appears

        if rand(100) < enemy.treasure_prob

          if enemy.item_id > 0

            treasures.push($data_items[enemy.item_id])

          end

          if enemy.weapon_id > 0

            treasures.push($data_weapons[enemy.weapon_id])

          end

          if enemy.armor_id > 0

            treasures.push($data_armors[enemy.armor_id])

          end

        end

      end

    end

    # Treasure is limited to a maximum of 6 items

    treasures = treasures[0..5]

    # Obtaining EXP

    for i in 0...$game_party.actors.size

      actor = $game_party.actors[i]

      if actor.cant_get_exp? == false

        last_level = actor.level

        actor.exp += exp

        if actor.level > last_level

          @status_window.level_up(i)

        end

      end

    end

    # Obtaining gold

    $game_party.gain_gold(gold)

    # Obtaining treasure

    for item in treasures

      case item

      when RPG::Item

        $game_party.gain_item(item.id, 1)

      when RPG::Weapon

        $game_party.gain_weapon(item.id, 1)

      when RPG::Armor

        $game_party.gain_armor(item.id, 1)

      end

    end

    

    # Makes Rank exp

    rank_exp = EXP_LIMIT[$game_temp.battle_troop_id][0]    

    

    # Gives i the value of the party size

    for i in 0...$game_party.actors.size

      # If class name is not None and actor is not nil

      if $game_party.actors[i].class_name != "None" and $game_party.actors[i] != nil

       # If game actor level is less than the exp level limit

       if $game_party.actors[i].level < EXP_LIMIT[$game_temp.battle_troop_id][1]

         # Give actors rank exp

         $game_party.actors[i].rank_exp(rank_exp)

         end

       end

    end

 

    # Make battle result window

    @result_window = Window_BattleResult.new(exp, gold, treasures, rank_exp)

    # Set wait count

    @phase5_wait_count = 100

  end

end

 

 

#==============================================================================

# ** Window_BattleResult

#------------------------------------------------------------------------------

#  This window displays amount of gold and EXP acquired at the end of a battle.

#==============================================================================

 

class Window_BattleResult < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     exp       : EXP

  #     gold      : amount of gold

  #     treasures : treasures

  #--------------------------------------------------------------------------

  def initialize(exp, gold, treasures, rank_exp = 0)

    @exp = exp

    @gold = gold

    @treasures = treasures

    @rank_exp = rank_exp

    super(160, 0, 320, @treasures.size * 64 + 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.y = 160 - height / 2

    self.back_opacity = 160

    self.visible = false

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    self.contents.font.color = system_color

    self.contents.draw_text(4, 32, 200, 32, "Rank Exp Gained:")    

    self.contents.font.color = normal_color

    self.contents.draw_text(170, 32, 200, 32, @rank_exp.to_s)    

    

    x = 4

    self.contents.font.color = normal_color

    cx = contents.text_size(@exp.to_s).width

    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)

    x += cx + 4

    self.contents.font.color = system_color

    cx = contents.text_size("EXP").width

    self.contents.draw_text(x, 0, 64, 32, "EXP")

    x += cx + 16

    self.contents.font.color = normal_color

    cx = contents.text_size(@gold.to_s).width

    self.contents.draw_text(x, 0, cx, 32, @gold.to_s)

    x += cx + 4

    self.contents.font.color = system_color

    self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)

    y = 64 #32

    for item in @treasures

      draw_item_name(item, 4, y)

      y += 32

    end

  end

end

 

 

#==============================================================================

# ** Game_Actor

#------------------------------------------------------------------------------

#  This class handles the actor. It's used within the Game_Actors class

#  ($game_actors) and refers to the Game_Party class ($game_party).

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor   :class_exp                     # EXP for classes

  attr_accessor   :class_rank                    # Rank of the class

  attr_accessor   :master_classes                # Used to store info on class

  #--------------------------------------------------------------------------

  # * Setup

  #     actor_id : actor ID

  #--------------------------------------------------------------------------

  alias tds_transform_skills_setup setup

   def setup(actor_id)

    tds_transform_skills_setup(actor_id)

    actor = $data_actors[actor_id]    

    @class_exp = {}

    @class_rank = {}

    @master_classes = {}

    ranking

  end  

  #--------------------------------------------------------------------------

  # * Set rankings

  #--------------------------------------------------------------------------

  def ranking         

    # Set values for class and exp if they are Nil

    for i in RANKS.keys

      # If Exp is Nil set the exp to the starting value

      if @class_exp[i] == nil

         @class_exp[i] = 0

       end

      # If Rank is nil set the first ranking for the class

      if @class_rank[i] == nil        

        @class_rank[i] = RANKS[i][0]

      end            

    end

    

    # If Ranks Mastered is nil

    if @ranks_mastered == nil

      # Gives values for mastering classes 

      for i in RANKS.keys

        # Rank Mastered method

        rank_mastered(i)

      end

    end

  

    # Sets the class bonuses

    set_class_bonus(self.class_name, remove_class_bonus = nil)       

    # Recover all

    recover_all    

    return 

  end 

 

  #--------------------------------------------------------------------------

  # * Class Status Bonus

  #     class_name : Class to return value 

  #     stat       : Stat to return the value of bonus percent   

  #--------------------------------------------------------------------------    

  def class_status_bonus(class_name = nil, stat = 0)

    # Array for status bonuses

    bonus_array = [self.base_maxhp, self.base_maxsp, self.base_str, self.base_dex, 

    self.base_agi, self.base_int, self.base_atk, self.base_pdef, base_mdef]

    # Status that will be used

    @status_used = bonus_array[stat]

    # Bonus percent used to get the total bonus

    @bonus_percent = CLASS_STATUS_BONUS[class_name][stat] 

    # Makes total Bonus

    @total_bonus = @status_used * @bonus_percent / 100

    # Returns the bonus for the stat

    return @total_bonus

  end  

 

  #--------------------------------------------------------------------------

  # * Class ID

  #     return_class_name : Named used to return class ID   

  #--------------------------------------------------------------------------    

  def class_return_id(return_class_name = self.class_name)

    # Gives i the value of the data classes size

    for i in 1...$data_classes.size

      # If any of the classes name is the same as the return name

      if $data_classes[i].name == return_class_name

        # Return ID is the same as the class ID

        return_id = $data_classes[i].id

      end        

    end

    # Returns ID value of the class name

    return return_id

  end  

    

  #--------------------------------------------------------------------------

  # * master?

  #     mster_class_name : Class to verify if it has been mastered 

  #--------------------------------------------------------------------------    

  def master?(master_class_name = self.class_name)      

   # If mastered class hash key is not nil 

   if @master_classes[master_class_name] != nil

    # If the last value of the array is Mastered

    if @master_classes[master_class_name].last == "Mastered"

        # Mastered is set to true

        mastered = true

      else

        # Mastered is set to false        

        mastered = false        

      end

    end

    

     # Return Mastered value

    return mastered

  end

  

  #--------------------------------------------------------------------------

  # * Can Use Class?

  #     use_class_name : Class to verify if it can be used   

  #--------------------------------------------------------------------------    

  def can_use_class?(use_class_name = self.class_name)    

    # If the requirements hash key is not nil

    if ADVANCE_REQUIREMENTS[use_class_name] != nil

     # Gives x the value of the requirements array size 

     for x in 0...ADVANCE_REQUIREMENTS[use_class_name].size

      # If the classes inside the array of requirements have not been mastered

      if master?(ADVANCE_REQUIREMENTS[use_class_name][x]) == false

        # Use is set to false

        use = false

        # Breaks loop

        break

      # If class has mastered the requirements

      else

        # Use is set to true

        use = true      

      end   

     end

   end

 

   # Returns the value of wheter or not the class can be used

   return use

  end  

  

  #--------------------------------------------------------------------------

  # * Exp For Level

  #     exp_class_name : Class to return value of needed exp

  #--------------------------------------------------------------------------    

  def exp_for_lv(exp_class_name = self.class_name)

    # If the class in the constant is not nil

    if RANK_LV_UP_POINTS[exp_class_name] != nil

     # Gives i the size value size for checking exp

     for i in 0...RANK_LV_UP_POINTS[exp_class_name][0].size

      # If if's not nil continue

      if RANK_LV_UP_POINTS[exp_class_name][0][i].size != nil

       # Gives x the value size of the exp 

       for x in 0...RANK_LV_UP_POINTS[exp_class_name][0][i].size   

        # If class exp is equal to the exp in the rank level exp array

        if @class_exp[exp_class_name] == RANK_LV_UP_POINTS[exp_class_name][0][i][x]             

         # If the next level of the arrays is not nil

         if RANK_LV_UP_POINTS[exp_class_name][0][i  + 1] != nil

          # next exp is equal to the first number of the next exp array

          next_exp = RANK_LV_UP_POINTS[exp_class_name][0][i + 1].first

        else

          # Next exp is equal to the last number of all exp arrays

          next_exp = RANK_LV_UP_POINTS[exp_class_name][0][i].last        

        end        

       end

      end

    end

   end

    end

    # Returns the value of the exp for the next level

    return next_exp 

  end  

 

  #--------------------------------------------------------------------------

  # * Rank Lv

  #     master_class_name : Class used to verify info   

  #--------------------------------------------------------------------------    

  def rank_mastered(master_class_name = self.class_name)

    

  # Ranks mastered array

  @ranks_mastered = []

  # Size of the RANK constant ranks

  for i in 0...RANKS[master_class_name].size

   # Break if the Rank on the constant is the same as the current rank

   break if RANKS[master_class_name][i] == @class_rank[master_class_name]

    # If the rank is not the same as the current rank add it to the mastered array

    if RANKS[master_class_name][i] != @class_rank[master_class_name]

     # Add to the mastered array

     @ranks_mastered << RANKS[master_class_name][i]   

    end

  end

  

  # Gives the value of the current mastered classes

  @ranks_mastered = @ranks_mastered

  # If class exp is the same as the last exp on the array master the class

  if @class_exp[master_class_name] == RANK_LV_UP_POINTS[master_class_name][0].last.last

    @ranks_mastered << RANKS[master_class_name].last

    @ranks_mastered << "Mastered"

  end

  

    # Gives the value of the mastered classes to the master hast

    @master_classes[master_class_name] = @ranks_mastered

    # Retunr the value of the variable in an array

    return @master_classes[master_class_name]

  end

 

  #--------------------------------------------------------------------------

  # * Set Class Bonus

  #     bonus_class_name : The class used to set the bonus 

  #     remove_class_bonus: Removes Bonus

  #--------------------------------------------------------------------------  

   def set_class_bonus(bonus_class_name, remove_class_bonus = nil)     

    # If remove bonus is not nil return all stats to normal

    if remove_class_bonus != nil

      self.maxhp = self.base_maxhp    

      self.maxsp = self.base_maxsp         

      self.str   = self.base_str 

      self.dex   = self.base_dex    

      self.agi   = self.base_agi

      self.int   = self.base_int       

    end     

    # If remove bonus is nil add all the class bonuses

    if remove_class_bonus == nil

      self.maxhp = self.base_maxhp + self.class_status_bonus(bonus_class_name, 0)   

      self.maxsp = self.base_maxsp + self.class_status_bonus(bonus_class_name, 1)         

      self.str   = self.base_str + self.class_status_bonus(bonus_class_name, 2)

      self.dex   = self.base_dex + self.class_status_bonus(bonus_class_name, 3)    

      self.agi   = self.base_agi + self.class_status_bonus(bonus_class_name, 4)

      self.int   = self.base_int +  self.class_status_bonus(bonus_class_name, 5)    

    end  

   return

  end

 

  #--------------------------------------------------------------------------

  # * learn_class_skills

  #     learning_class : Class used for learning   

  #--------------------------------------------------------------------------  

   def learn_class_skills(learning_class = self.class_name)       

    # If the Rank Skils Hash key is not nil

    if RANK_SKILLS[learning_class] != nil

     # Gives i the value of class key hash values

     for i in 0...RANK_SKILLS[learning_class].size

      # If a class has been mastered and it's one required to learn a skill

      if @master_classes[learning_class].include?(RANK_SKILLS[learning_class][i][1])          

        # Lean skill

        learn_skill(RANK_SKILLS[learning_class][i][0])          

       end  

      end        

    end    

     return

   end

  

  #--------------------------------------------------------------------------

  # * Rank Exp

  #     amount : Amount of Rank Exp to add to the character   

  #--------------------------------------------------------------------------  

   def rank_exp(amount)     

     # Adds exp to the rank exp

     for i in 0..amount

       # Break loop if exp has reached the desired amount

       break if i >= amount

       # Keep adding exp until you reach the desired amount

       @class_exp[self.class_name] += 1   

       # Update Ranking

       ranking       

     end

     

   # if class exp is equal or more to the last rank limit exp give a max value

   if @class_exp[self.class_name] >= RANK_LV_UP_POINTS[self.class_name][0].last.max 

      @class_exp[self.class_name] = RANK_LV_UP_POINTS[self.class_name][0].last.max

   end

 

   # If exp is less than the minimun of the first rank give it a start value

   if @class_exp[self.class_name] <= RANK_LV_UP_POINTS[self.class_name][0].first.min

      @class_exp = RANK_LV_UP_POINTS[self.class_name][0].first.min

    end      

      

   for i in 0...RANK_LV_UP_POINTS[self.class_name][0].size   

    for x in 0...RANK_LV_UP_POINTS[self.class_name][0][i].size       

     # If class exp for the actor is equal to the exp in one of the exp arrays

     if @class_exp[self.class_name] == RANK_LV_UP_POINTS[self.class_name][0][i][x]

       # Assigns rank to the actor

       @class_rank[self.class_name] = RANKS[self.class_name][i]       

       break

     end

    end

   end

    

   # Update Ranking

   ranking

   # Update Mastered Ranks

   rank_mastered   

   # Updates Learn Skills

   learn_class_skills

   # Return the current class exp

    return @class_exp[self.class_name]

   end  

 end

 

      

#==============================================================================

# ** Dragon Quest VII Class Change System

#------------------------------------------------------------------------------

#  Scene used to choose the character that will change it's class.

#==============================================================================

 

class Scene_Class_Change_System

  #--------------------------------------------------------------------------

  # * Main Processing

  #--------------------------------------------------------------------------

  def main

    # Make Spriteset Background

    spriteset = Spriteset_Map.new

  # Introduction message

  intro_message = "Whose Class do you wish to change?"  

  # Creates text window for messages in the class  

  @text_window = Window_Base.new(80, 373, 480, 107)   

  @text_window.contents = Bitmap.new(@text_window.width-32, @text_window.height-32)

  # Introduction text message

  @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)

  # Text window back opacity

  @text_window.back_opacity = 120

  # Make array for Character command window

  @command_characters = []

  # Make array for Classes command window

  @classes_commands = []

  # Make who to choose title window

  @who_windows = Window_Base.new(346, 165, 140, 46)        

  # Who Window back opacity

  @who_windows.back_opacity = 120

  # Who window contents bitmap

  @who_windows.contents = Bitmap.new(100, 14)

  @who_windows.contents.draw_text(25 , 0-4, 70, 20, "Who?")

  # Make status choose title window

  @status_choose_windows = Window_Base.new(487, 165, 152, 46)       

  # Status choose back opacity

  @status_choose_windows.back_opacity = 120

  # Status choose contents bitmap

  @status_choose_windows.contents = Bitmap.new(120, 14)

  # Makes the window for showing basic status of a player

  @choosing_status_windows = Window_Base.new(487, 212, 152, 125)    

  # Choosing window back opacity

  @choosing_status_windows.back_opacity = 120

  # Choosing window contents bitmap

  @choosing_status_windows.contents = Bitmap.new(120, 87)  

  @choosing_status_windows.contents.draw_text( 0, 64, 120, 25, "Level:")      

  # Checks current party members

  for i in 0...$game_party.actors.size

    # Makes the names of the party members the commands for the window

    @command_characters << $game_party.actors[i].name

  end  

 

    # Make Character command window  

  @character_command_window = Window_Command.new(140, @command_characters)

  @character_command_window.x = 346

  @character_command_window.y = 212

  # Assigns primary name to the windows

  actor = $game_party.actors[@character_command_window.index]

  @status_choose_windows.contents.draw_text(0 , 0-4, 120, 20, actor.name.to_s, 1)      

  @choosing_status_windows.contents.draw_text( 0, 0, 120, 25, actor.class_name.to_s, 1)    

  @choosing_status_windows.contents.draw_text( 0, 64, 120, 25, "Level:")        

  @choosing_status_windows.contents.draw_text( 77, 64, 120, 25, actor.level.to_s )        

  @choosing_status_windows.contents.draw_text( 0, 32, 120, 25, 

  actor.class_rank[actor.class_name].to_s, 1) 

  # Character window back opacity

  @character_command_window.back_opacity = 120

    # Execute transition

    Graphics.transition

    # Main loop

    loop do

      # Update game screen

      Graphics.update

      # Update input information

      Input.update

      # Frame update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    # Prepare for transition

    Graphics.freeze

    # Dispose of windows

    @character_command_window.dispose

  @text_window.dispose

  @who_windows.dispose

  @status_choose_windows.dispose

  @choosing_status_windows.dispose  

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Update windows

    @character_command_window.update  

  # Clears the contents of windows

  @status_choose_windows.contents.clear

  @choosing_status_windows.contents.clear

  # Update the choosing status window information

  update_choosing_status  

 

    # If C button was pressed

    if Input.trigger?(Input::C)

       # Play decision SE

       $game_system.se_play($data_system.decision_se)                

       # Change to class changing scene

       $scene = Scene_Class_Change_Menu.new(@character_command_window.index)        

      return

    end

  

   if Input.trigger?(Input::B)

      # Play cancel SE

      $game_system.se_play($data_system.cancel_se)

      # Switch to map screen

      $scene = Scene_Map.new

      return

    end 

  end

  #--------------------------------------------------------------------------

  # * Update the choosing status window

  #--------------------------------------------------------------------------

  def update_choosing_status

    # Draws content for windows

    actor = $game_party.actors[@character_command_window.index]

    @status_choose_windows.contents.draw_text(0 , 0-4, 120, 20, actor.name.to_s, 1)      

    @choosing_status_windows.contents.draw_text( 0, 0, 120, 25, actor.class_name.to_s, 1)    

    @choosing_status_windows.contents.draw_text( 0, 64, 120, 25, "Level:")        

    @choosing_status_windows.contents.draw_text( 77, 64, 120, 25, actor.level.to_s )        

    @choosing_status_windows.contents.draw_text( 0, 32, 120, 25, 

    actor.class_rank[actor.class_name].to_s, 1) 

  end

end

 

 

#==============================================================================

# ** Dragon Quest VII Class Change System Changing Menu

#------------------------------------------------------------------------------

#  Scene where actual class change happens.

#==============================================================================

 class Scene_Class_Change_Menu

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     actor : Actor for class change 

  #--------------------------------------------------------------------------

  def initialize(actor_id = 0)

    # Actor for use in the scene

    @actor_id = actor_id

  end   

      

  #--------------------------------------------------------------------------

  # * Main Processing

  #--------------------------------------------------------------------------

  def main

    # Make Spriteset Background

    spriteset = Spriteset_Map.new

  # Introduction message

  intro_message = "Which Class do you wish to take on?"  

  # Class changing steps

  @class_steps = 0

  # X axis value for text

  @x = 0

  # Title text to be used

  @title_text = "None"     

  # Creates text window for messages in the class  

  @text_window = Window_Base.new(201, 373, 440, 107)   

  @text_window.contents = Bitmap.new(@text_window.width-32, @text_window.height-32)

  # Introduction text message

  @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)

  # Text window back opacity

  @text_window.back_opacity = 120

  # Make array for Classes command window

  @classes_commands = []

  # Make status for jobs window

  @title_windows = Window_Base.new(0, 0, 200, 56)       

  # Status back opacity

  @title_windows.back_opacity = 120

  # Status contents bitmap

  @title_windows.contents = Bitmap.new(160, 20)

 

  # Commands for basic classes

  @classes_commands = ["Warrior", "Fighter", "Mage", "Cleric", "Dancer",

  "Bard", "Jester", "Mariner", "Thief", "Shepard", "Dragoon", "Ranger", 

  "Paladin", "Sage", "TeenIdol", "Pirate", "Tamer", "GodHand", "Summoner", 

  "Hero", "None"] 

 

  # Array Index used to change title

  @basic_index = ["Warrior", "Fighter", "Mage", "Cleric", "Dancer",

  "Bard", "Jester", "Mariner", "Thief", "Shepard",  "None" ]

  # Array Index used to change title  

  @intermediate_index = ["Dragoon", "Ranger", "Paladin", "Sage", "TeenIdol", 

  "Pirate", "Tamer"]   

  # Array Index used to change title    

  @expert_index = ["GodHand", "Summoner", "Hero"]     

    

  # Delete from commands array

  delete_from_commands = []

  for i in 0...@classes_commands.size

   if $game_party.actors[@actor_id].can_use_class?(@classes_commands[i]) == false     

     # Add to the delete from commands array     

     delete_from_commands << @classes_commands[i]     

    end   

  end

 

  # Gives i the value for deleting commands

  for i in 0...delete_from_commands.size

    # Deletes from the command array the clases that cannot be accessed yet

    @classes_commands.delete(delete_from_commands[i].to_s)

  end

  

  

    # Make Character command window    

  @class_command_window = Window_Command.new(200, @classes_commands)

  # Gives i the value of the command classes

  for i in 0...@classes_commands.size

   # If the current command is the same as the class of the actor

   if @classes_commands[i] == $game_party.actors[@actor_id].class_name 

    # Make the index be the class of the actor

    @class_command_window.index = i

    end

  end

 

  # Gives i the value of the commands size

  for i in 0...@classes_commands.size

   # If actor has mastered a skill

   if $game_party.actors[@actor_id].master?(@classes_commands[i])

    # Change the color of the command

    @class_command_window.draw_item(i, Color.new(255, 255, 128, 255))

  end

  

  # If class is None draw it in normal color

  if @classes_commands[i] == "None"

    # Draw command

    @class_command_window.draw_item(i, Color.new(255, 255, 255, 255))    

   end  

  end

 

   # If currently the index is over a basic class

   for i in 0...@basic_index.size  

    # If the current command is the same as one in the basic index

    if @classes_commands[@class_command_window.index] == @basic_index[i]

       # Draw title in title window

       @title_windows.contents.draw_text(57 , 0, 200, 20, "Basic")

       # X axis value for text

       @x = 57

       # Title text to be used

       @title_text = "Basic"       

       # Breaks loop

       break

     end

   end

 

   # If currently the index is over a intermediate class   

   for i in 0...  @intermediate_index.size  

    # If the current command is the same as one in the intermediate index     

    if @classes_commands[@class_command_window.index] ==   @intermediate_index[i]

       # Draw title in title window      

       @title_windows.contents.draw_text(28 , 0, 200, 20, "Intermediate")

       # X axis value for text

       @x = 28

       # Title text to be used

       @title_text = "Intermediate"                   

       # Breaks loop       

       break

     end

   end

   

  # If currently the index is over a expert class   

   for i in 0...@expert_index.size  

    # If the current command is the same as one in the expert index          

    if @classes_commands[@class_command_window.index] == @expert_index[i]

       # Draw title in title window      

       @title_windows.contents.draw_text(57 , 0, 200, 20, "Expert")

       # X axis value for text

       @x = 57

       # Title text to be used

       @title_text = "Expert"       

       # Breaks loop             

       break

     end

   end

  

  # Gives a color to identify the actors current class

  @class_command_window.draw_item(@class_command_window.index, Color.new(128, 255, 128, 255))  

  @class_command_window.x = 0

  @class_command_window.y = 56

  @class_command_window.height = 424 

  @class_command_window.back_opacity = 120  

  # Creates class status window  

  @class_status_window = Class_Status_Window.new(@actor_id)

  # Creates the prompt window for class changing

  @prompt_command_window = Window_Command.new(100, %w(Yes No))  

  @prompt_command_window.x = 539

  @prompt_command_window.y = 276

  @prompt_command_window.back_opacity = 130

  @prompt_command_window.visible = false

  @prompt_command_window.active = false  

  

    # Execute transition

    Graphics.transition

    # Main loop

    loop do

      # Update game screen

      Graphics.update

      # Update input information

      Input.update

      # Frame update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    # Prepare for transition

    Graphics.freeze

    # Dispose of windows

  @text_window.dispose

    @class_command_window.dispose

  @title_windows.dispose

  @class_status_window.dispose

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Update windows

    @class_command_window.update

  @prompt_command_window.update  

  # Clears title text

  @title_windows.contents.clear           

  # Draw title in title window

  @title_windows.contents.draw_text(@x , 0, 200, 20, @title_text.to_s)       

  

  # If current index is not equal to the index variable update

  # (Used to lower refres lag)

  if @class_command_window.index != @index and @class_command_window.active

    # Refreshes status window with the current class in the command window index

    @class_status_window.refresh(@classes_commands[@class_command_window.index])

    # index is given the value of the current class command window index

    @index = @class_command_window.index

    # Updates title text

    update_title_text

  end

 

  # If prompt window is active and class steops is 0  

  if @prompt_command_window.active and @class_steps == 0

    # Update the first phase of class change    

    class_change_update_step_one

   return  

  end

   

  # If prompt window is active and class steops is 1 

  if @class_steps >= 1

    # Update the second phase of class change

     class_changing

   return  

  end

  

   # If C button was pressed and prompt window is not active yet

   if Input.trigger?(Input::C) and @prompt_command_window.active == false

     if @classes_commands[@class_command_window.index] == $game_party.actors[@actor_id].class_name

        # Play buzzer SE

        $game_system.se_play($data_system.buzzer_se)       

        return

       end

      # Play decision SE

      $game_system.se_play($data_system.decision_se)                     

      # Class command window is inactive

      @class_command_window.active = false

      # Prompt command window is visible      

      @prompt_command_window.visible = true

      # Prompt command window is activated

      @prompt_command_window.active = true

      # Class steps is set to pre starting point

      @class_steps = 0

    return

  end  

     

 

  # If B button was pressed

    if Input.trigger?(Input::B)

      # Play cancel SE

      $game_system.se_play($data_system.cancel_se)

      # Return back to the class changing scene

    $scene = Scene_Map.new

      return

    end 

  end

 

  #--------------------------------------------------------------------------

  # * Frame Update(Updates Title Text)

  #--------------------------------------------------------------------------  

  def update_title_text  

   # If currently the index is over a basic class

   for i in 0...@basic_index.size  

    # If the current command is the same as one in the basic index

    if @classes_commands[@class_command_window.index] == @basic_index[i]

       # X axis value for text

       @x = 57

       # Title text to be used

       @title_text = "Basic"

       # Breaks loop

       break

     end

   end

 

   # If currently the index is over a intermediate class   

   for i in 0...  @intermediate_index.size  

    # If the current command is the same as one in the intermediate index     

    if @classes_commands[@class_command_window.index] ==   @intermediate_index[i]

       # X axis value for text

       @x = 28

       # Title text to be used

       @title_text = "Intermediate"            

       # Breaks loop       

       break

     end

   end

   

  # If currently the index is over a expert class   

   for i in 0...@expert_index.size  

    # If the current command is the same as one in the expert index          

    if @classes_commands[@class_command_window.index] == @expert_index[i]

       # X axis value for text

       @x = 57

       # Title text to be used

       @title_text = "Expert"

       # Breaks loop             

       break

     end

   end

  return 

 end

 

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------  

  def class_changing

       # Clears message window contents

       @text_window.contents.clear         

       # Name of the class in the current index

       name = @classes_commands[@class_command_window.index]       

       # ID for class Changing       

       id = $game_party.actors[@actor_id].class_return_id(name.to_s)        

 

       case @class_steps

        when 1

          # First line of the class changing message

          line_one = "Hold the image of the " + 

          @classes_commands[@class_command_window.index].to_s + 

          " In your heart" 

          # Second line of the class changing message       

          line_two = "and pray."      

        when 2     

          # First line of the class changing message

           line_one = "Oh God, let " + $game_party.actors[@actor_id].name.to_s +

           " walk a new path in life."

        when 3                

         if @once_check == nil

           Audio.se_play("Audio/SE/112-Heal08", 80, 0)   

           @once_check = true

         end

          # First line of the class changing message

           line_one = $game_party.actors[@actor_id].name.to_s + 

           ", You will now go forth as a " + 

           @classes_commands[@class_command_window.index].to_s + "."                               

           # Change actors class ID to the new class ID

           $game_party.actors[@actor_id].class_id = id         

           # Refresh status windows content

           @class_status_window.refresh(@classes_commands[@class_command_window.index])           

         when 4

          # Return back to the class changing scene

          $scene = Scene_Class_Change_Menu.new                   

          return

         end                

         

          # Write message in the message window        

          @text_window.contents.draw_text( 0, 0, 500, 25, line_one.to_s)                

          @text_window.contents.draw_text( 0, 32, 420, 25, line_two.to_s)                    

        

        # If C button was pressed

        if Input.trigger?(Input::C)         

           # Play decision SE

           $game_system.se_play($data_system.decision_se)          

           @class_steps += 1          

          return

        end

        return

      end

  

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------  

  def class_change_update_step_one      

    # Clears message window contents

    @text_window.contents.clear

    # New message to be written

    message = "So, " + $game_party.actors[@actor_id].name.to_s + 

    ", Do you wish to become a " + 

    @classes_commands[@class_command_window.index].to_s + "?"  

    # Write message in the message window

    @text_window.contents.draw_text( 0, 0, 420, 25, message.to_s)    

 

    # If C button was pressed

    if Input.trigger?(Input::C) and @class_steps = 0

      # Use the prompt command window index to determine action

      case @prompt_command_window.index

       when 0 # When Yes

        # Play decision SE

        $game_system.se_play($data_system.decision_se)         

        # Prompt command window is not visible

        @prompt_command_window.visible = false

        # Prompt command window is not active

        @prompt_command_window.active = false         

        # Class steps is set to it's second point

        @class_steps = 1         

        return

       when 1 # When No

        # Play cancel SE

        $game_system.se_play($data_system.cancel_se)

        # Class command window is activated

        @class_command_window.active = true

        # Prompt command window is not visible

        @prompt_command_window.visible = false

        # Prompt command window is not active

        @prompt_command_window.active = false

        # Clears message window contents

        @text_window.contents.clear     

        # New message to be written

        intro_message = "Which Class do you wish to take on?"  

        # Write message in the message window        

        @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)            

        return

      end

     return

   end

   

    if Input.trigger?(Input::B)

      # Play cancel SE

      $game_system.se_play($data_system.cancel_se)

      @class_command_window.active = true

      @prompt_command_window.visible = false

      @prompt_command_window.active = false

      @class_steps = 0

      @text_window.contents.clear                

      intro_message = "Which Class do you wish to take on?"  

      @text_window.contents.draw_text( 0, 0, 420, 25, intro_message.to_s)            

       return

    end 

  end

 end     

 

 

 

 

#==============================================================================

# ** Class Status Window

#------------------------------------------------------------------------------

#  This window displays class content.

#==============================================================================

 

class Class_Status_Window < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize(actor_id = 0)

    # Actor info used in window

    @actor_id = actor_id

    super(201, 0, 439, 372)

    self.contents = Bitmap.new(width - 32, height - 32)

    # windows back opacity

    self.back_opacity = 120

    # Current actor used for info

    @actor = $game_party.actors[@actor_id]

    # Status class name variable

    @status_class = @actor.class_name

    refresh(@status_class)

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh(class_name)

    self.contents.clear

    # Current class name

    @status_class = class_name

    

    self.contents.font.color = system_color    

    self.contents.draw_text(0, -135, 300, 300, "Name:")        

    self.contents.draw_text(190, -135, 300, 300, "Class:")            

    self.contents.draw_text(190, -76, 300, 300, "Rank Exp:")                

    self.contents.draw_text(0, -105, 300, 300, "Rank:")                    

    self.contents.draw_text(190, -105, 300, 300, "Master:")                        

 

    # Draws all basic status Names

    self.contents.draw_text(0, -62 -14, 300, 300, "HP:")                

    self.contents.draw_text(0, -32 -14, 300, 300, "SP:")        

    self.contents.draw_text(0, 0 -14, 300, 300, "ATK:")        

    self.contents.draw_text(0, 32 -14, 300, 300, "PDF:")            

    self.contents.draw_text(0, 64 -14, 300, 300, "MDF:")    

    self.contents.draw_text(0, 100 -14, 300, 300, "STR:")                    

    self.contents.draw_text(0, 132 -14, 300, 300, "DEX:")                        

    self.contents.draw_text(0, 164 -14, 300, 300, "AGI:")                        

    self.contents.draw_text(0, 196 -14, 300, 300, "INT:")                            

    self.contents.font.color = normal_color

    # Markers

    self.contents.draw_text(84, 0 -76, 300, 300, "  »»")        

    self.contents.draw_text(84, 0 -46, 300, 300, "  »»")          

    self.contents.draw_text(50, 0 -14, 300, 300, "  »»              »»")        

    self.contents.draw_text(50, 32 -14, 300, 300, "  »»              »»")            

    self.contents.draw_text(50, 64 -14, 300, 300, "  »»              »»")    

    self.contents.draw_text(50, 100 -14, 300, 300, "  »»              »»")                    

    self.contents.draw_text(50, 132 -14, 300, 300, "  »»              »»")                        

    self.contents.draw_text(50, 164 -14, 300, 300, "  »»              »»")                        

    self.contents.draw_text(50, 196 -14, 300, 300, "  »»              »»")                                    

 

    # Status variables 

    hp = @actor.base_maxhp + @actor.class_status_bonus(@status_class, 0)

    sp = @actor.base_maxsp +  @actor.class_status_bonus(@status_class, 1)

    str = @actor.base_str + @actor.class_status_bonus(@status_class, 2)

    dex = @actor.base_dex + @actor.class_status_bonus(@status_class, 3)    

    agi = @actor.base_agi + @actor.class_status_bonus(@status_class, 4)

    int = @actor.base_int +  @actor.class_status_bonus(@status_class, 5)    

    atk = @actor.base_atk + @actor.class_status_bonus(@status_class, 6)

    pdef = @actor.base_pdef + @actor.class_status_bonus(@status_class, 7)

    mdef = @actor.base_mdef + @actor.class_status_bonus(@status_class, 8)

    

    # Status with bonuses    

    self.contents.draw_text(127, 0 -76, 300, 300, hp.to_s)        

    self.contents.draw_text(127, 0 -46, 300, 300, sp.to_s)    

    self.contents.draw_text(193, 0 -14, 300, 300, atk.to_s)        

    self.contents.draw_text(193, 32 -14, 300, 300, pdef.to_s)            

    self.contents.draw_text(193, 64 -14, 300, 300, mdef.to_s)    

    self.contents.draw_text(193, 100 -14, 300, 300, str.to_s)                    

    self.contents.draw_text(193, 132 -14, 300, 300, dex.to_s)                        

    self.contents.draw_text(193, 164 -14, 300, 300, agi.to_s)                        

    self.contents.draw_text(193, 196 -14, 300, 300, int.to_s)                            

    

    # Status variables without bonuses 

    hp = @actor.maxhp

    sp = @actor.maxsp

    str = @actor.str 

    dex = @actor.dex     

    agi = @actor.agi 

    int = @actor.int     

    atk = @actor.atk 

    pdef = @actor.pdef 

    mdef = @actor.mdef 

    # Status without bonuses    

    self.contents.draw_text(40, 0 -76, 300, 300, hp.to_s)        

    self.contents.draw_text(40, 0 -46, 300, 300, sp.to_s)          

    self.contents.draw_text(100, 0 -14, 300, 300, atk.to_s)        

    self.contents.draw_text(100, 32 -14, 300, 300, pdef.to_s)            

    self.contents.draw_text(100, 64 -14, 300, 300, mdef.to_s)    

    self.contents.draw_text(100, 100 -14, 300, 300, str.to_s)                    

    self.contents.draw_text(100, 132 -14, 300, 300, dex.to_s)                        

    self.contents.draw_text(100, 164 -14, 300, 300, agi.to_s)                        

    self.contents.draw_text(100, 196 -14, 300, 300, int.to_s)                            

  

    # Master Icons Array

    @master_icons = []

    # If status is other than None

    if @status_class != "None"

    # Gives i the size value of the ranks in the selected class

    for i in 0...RANKS[@status_class].size

      # Adds icons to the master_icon array

      @master_icons << bitmap = RPG::Cache.icon("Master_Icon")      

      # If i is less or equal to the mastered ranks

      if i <= @actor.rank_mastered(@status_class).size - 1

       # Draw mastered icons with full opacity

       self.contents.blt(260 + i * 17, 35, @master_icons[i], Rect.new(0, 0, 24, 24), 255)                  

      else

       # Draw icons unmastered icons with less opacity

       self.contents.blt(260 + i * 17, 35, @master_icons[i], Rect.new(0, 0, 24, 24), 80)                        

      end

     end

    end

  

    # Draw actors class rank

    self.contents.draw_text(55, 30, 300, 32, @actor.class_rank[@status_class].to_s)    

    exp_string =  @actor.class_exp[@status_class].to_s + " / " + @actor.exp_for_lv(@status_class).to_s

    # If current status is not None

    if @status_class != "None"    

      # Draws the exp of the rank      

      self.contents.draw_text(290, 59, 300, 32, exp_string.to_s)            

    # Else if clas is equal to None  

    elsif @status_class == "None"

      self.contents.draw_text(290, 59, 300, 32, "-------")                        

      self.contents.draw_text(264, 30, 300, 32, "-------")                              

    else

      self.contents.draw_text(290, 59, 300, 32, "-------")            

    end  

    # Draws currently selected class

    self.contents.draw_text(250, 0, 300, 32, @actor.class_name)

    # Draws actors name

    draw_actor_name(@actor, 60, 0)    

  end

end

 

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.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top