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.

Dual Class System with FFX2 Style AP System

Hello there I am request a script that allows a few features
The First part of the script is the support for Dual Classes
The Primary class would basically change the characters class
The Secondary Class would allow the character to use set skills that he can bring from a class that he has set as secondary.
When I say mean certain skills that can be carried over as a secondary class
Upon Mastering the Class (By maxing the Level and learning all skills) The character would be aloud to use all the skills of the sub class

For the AP System, It would essentially the same as SephirothSpawns Equipment Skills Script system except only 1 skill can be learned at a time and would be disabled until learned. Also could it be set up so that the skill system would be set up where some skills won't show up until others are learned and some skills are only learned at certain class levels.

As far as Class Bonuses and Changing the characters graphic, SephirothSpawn already made scripts capable of this so unless you want to include them, you can just ignore those
 
Give me a few minutes. I think this should be fairly easy (the dual class part).


For the AP part, I think my equipment skills supports Learn 1 at a time, as well as disabled until learned. The problem is how the skills are learned basically.

Most of my skill system use a special method that gains extra skills, learned from equipments, sphere grid, materia, etc. They don't use the default learn_skill method. This is basically so there is an increase in compatabilty. You basically just need to find the right setup.


Ok. here is what I did.

Code:
class Game_Actor < Game_Battler
  
  Actor_Secondary_Classes = {} # actor_id => class_id
  
  attr_reader   :secondary_class_id
  
  alias seph_secclass_gmactr_setup setup
  alias seph_secclass_gmactr_skill skills
  alias seph_secclass_gmactr_exp=  exp=
  alias seph_secclass_gmactr_sl?   skill_learn?
  
  def setup(actor_id)
    seph_secclass_gmactr_setup(actor_id)
    if Actor_Secondary_Classes.has_key?(actor_id)
      @secondary_class_id = Actor_Secondary_Classes[actor_id]
    else
      @secondary_class_id = 1
    end
    @secondary_class_exp = {}
    @secondary_class_level = {}
  end
  
  def skills
    s = seph_secclass_gmactr_skill.dup
    s << setup_secondary_class_skills
    return s.flatten.uniq.sort
  end
  
  def setup_secondary_class_skills
    skills = []
    
    @secondary_class_level.keys.each do |class_id|
      level = secondary_class_level(class_id)
      learnings = $data_classes[class_id].learnings
      for i in 1..level
        for j in learnings
          skills < j.skill_id
        end
      end
    end
    return skills.uniq.sort
  end
  
  def exp=(exp)
    exp_mod = exp - @exp
    self.seph_secclass_gmactr_exp=(exp)
    self.secondary_class_exp=(exp_mod)
  end
  
  def secondary_class_exp(class_id = @secondary_class_id)
    return @secondary_class_exp.has_key?(@secondary_class_id) ? 
      @secondary_class_exp[@secondary_class_id] : 0
  end
  
  def secondary_class_exp=(exp)
    @secondary_class_exp[@secondary_class_id] = [[exp, 9999999].min, 0].max
  end
  
  def secondary_class_level(class_id = @secondary_class_id)
    lvl = 1
    exp = secondary_class_exp(class_id)
    while exp >= @exp_list[lvl] && @exp_list[lvl] > 0
      lvl += 1
    end
    return lvl
  end
  
  def secondary_class_name
    return $data_classes[@secondary_class_id].name
  end
  
  def secondary_exp_s(class_id = @secondary_class_id)
    return @exp_list[secondary_class_level(class_id) + 1] > 0 ?
      secondary_class_exp(class_id).to_s : '-------'
  end
  
  def next_exp_s(class_id = @secondary_class_id)
    return @exp_list[secondary_class_level(class_id) + 1] > 0 ?
      @exp_list[secondary_class_level(class_id) + 1].to_s : '-------'
  end

  def next_rest_exp_s(class_id = @secondary_class_id)
    return @exp_list[secondary_class_level(class_id) + 1] > 0 ?
      (@exp_list[secondary_class_level(class_id) + 1] - secondary_class_exp(class_id)).to_s : '-------'
  end
    
  def skill_learn?(skill_id)
    return true if self.skills.include?(skill_id)
    return seph_secclass_gmactr_sl?(skill_id)
  end
  
end

No time to go into details. Right now. Just post any questions you have and I will get back to you.

(As with everything, post below everything else but Main)
 

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