Thefirelion

TheFireLion Game Studio
Veteran
Joined
Mar 25, 2017
Messages
150
Reaction score
47
First Language
Spanish
Primarily Uses
RMVXA
I'm having trouble and need help with the yanfly class and subclass system.
https://yanflychannel.wordpress.com/rmvxa/core-scripts/class-system/
https://yanflychannel.wordpress.com/rmvxa/core-scripts/class-system/class-specifics/

It happens that by default of the editor when you change classes and exceed a level where you learn a skill, it will not appear in the list:
example:
-You are in class # 1 at level 4
you learn "fireball" at level 2 of class # 2
-you change to class # 2 at that level the skill "fire ball" will not appear.

I please, need an add-on or a snippet that can correct that problem

Thank you very much.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,365
Reaction score
799
First Language
English
Primarily Uses
RMVXA
I please, need an add-on or a snippet that can correct that problem
You need to use Estriole's subclass addon v3.07
Ruby:
#==============================================================================
#
# ▼ Yanfly Engine Ace - Class v1.06 Addon for subclass - skillswap
# -- Last Updated: 2020.09.15
# -- Requires: Yanfly Class System 
#              Yanfly Class Specifics <- Optional
#              Estriole Subclass Addon
# -- addon created by: Roninator2
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2020.09.14 - Started Script
# 2020.09.15 - Added forget skills option
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Allow Subclass to gain levels & skills and allows the option to
# have the actor forget skills from the class they were previously
# when changing classes.
#==============================================================================
module R2_yanfly_skills
  Forget_skills = true
end

class Game_Interpreter
  def command_316
   value = operate_value(@params[2], @params[3], @params[4])
   iterate_actor_var(@params[0], @params[1]) do |actor|
     actor.sublevelup = true
     actor.sublevelcnt = value
     actor.change_level(actor.level + value, @params[5])
   end
  end
end

class Game_Actor < Game_Battler
 
  attr_accessor   :sublevelup
  attr_accessor   :sublevelcnt
  attr_accessor   :subclass_id
  
  alias r2_game_actor_level_up level_up
  def level_up
    r2_game_actor_level_up
    return if @subclass_id == 0
    return if !@subclass_id
    if @sublevelup
      @exp[@subclass_id] = exp_for_level(class_level(@subclass_id).to_i + @sublevelcnt)
    elsif @exp[@subclass_id] == exp_for_level(class_level(@subclass_id).to_i + 1)
      @sublevelup = true
      class_level(@subclass_id).to_i + 1
      @sublevelcnt += 1
    end
    subclass_add_exp(@subclass_id,0)
    if @sublevelup
      @sublevelup = false
      @sublevelcnt = 0
    end
  end

  def forget_class_skills(class_id)
    return if class_id <= 0
    return if $data_classes[class_id].nil?
    $data_classes[class_id].learnings.each do |learning|
      forget_skill(learning.skill_id)
    end
  end
  
  def forget_subclass_skills(class_id)
    return if class_id <= 0
    return if $data_classes[class_id].nil?
    $data_classes[class_id].learnings.each do |learning|
      forget_skill(learning.skill_id)
    end
  end

  def learn_class_skills(class_id)
    return if class_id <= 0
    return if $data_classes[class_id].nil?
    $data_classes[class_id].learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level <= class_level(class_id)
    end
  end

  def subclass_add_exp(class_id,value)
    return if !@subclass_id
    return if @subclass_id == 0
    last_level = class_level(class_id).to_i
    last_skills = skills
    exprate = sub_exp_rate(class_id)
    expvalue = (value * exprate).to_i
    expvalue = [expvalue,1].max if ESTRIOLE::SUBCLASS_MIN_1_EXP && value != 0
    if !YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
      @exp[class_id] = @exp[class_id] + expvalue
      @exp[class_id] = [@exp[class_id],subclass.exp_for_level(subclass_max_level)].min
    end
    self.subclass.learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level <= class_level(class_id).to_i
      if @extra_features && class_level(class_id).to_i > last_level && learning.note =~ /<extratrait (.*)>/i
        @extra_features.features += $data_weapons[$1.to_i].features if EXTRA_FEATURES_SOURCE == 0
        @extra_features.features += $data_armors[$1.to_i].features if EXTRA_FEATURES_SOURCE == 1
        @extra_features.features += $data_states[$1.to_i].features if EXTRA_FEATURES_SOURCE == 2
      end
    end
    display_level_up_sub(skills - last_skills) if class_level(class_id).to_i > last_level
  end
end # Game_Actor
class Window_Base < Window
 
  if $imported["YEA-AceMenuEngine"]
    def draw_actor_simple_status(actor, dx, dy)
      dy -= line_height / 2
      draw_actor_name(actor, dx, dy)
      draw_actor_level(actor, dx, dy + line_height * 1)
      draw_actor_icons(actor, dx, dy + line_height * 2)
      dx = dx + 25
      dw = contents.width - dx - 124
      draw_actor_class(actor, dx + 120, dy, dw)
      draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
      if YEA::MENU::DRAW_TP_GAUGE && actor.draw_tp? && !actor.draw_mp?
        draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw)
      elsif YEA::MENU::DRAW_TP_GAUGE && actor.draw_tp? && actor.draw_mp?
        if $imported["YEA-BattleEngine"]
          draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw/2 - 1)
          draw_actor_mp(actor, dx + 120 + dw/2, dy + (line_height * 2), dw/2 + 1)
        else
          draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw/2 - 1)
          draw_actor_tp(actor, dx + 120 + dw/2, dy + line_height * 2, dw/2 + 1)
        end
      elsif YEA::MENU::DRAW_TP_GAUGE && actor.draw_mp?
        draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
      end
    end
  end

  alias r2_draw_actor_class_924v  draw_actor_simple_status
  def draw_actor_simple_status(actor, dx, dy)
    r2_draw_actor_class_924v(actor, dx, dy)
    @class_id = actor.class_id
    @sublass_id = actor.subclass.nil? ? nil : actor.subclass.id
  end

end # Window_Base

class Scene_LearnSkill < Scene_Skill
  def on_cost_ok
    Sound.play_use_skill
    skill = @item_window.item
    @actor.learn_skill(skill.id)
    cost = skill.learn_cost[0]
    case skill.learn_cost[1]
    when :exp
      @actor.lose_exp_class(cost, @cost_front.skill_class)
    when :gold
      $game_party.lose_gold(cost)
    end
    on_cost_cancel
    refresh_windows
  end
end

class Scene_Class < Scene_MenuBase
  def on_class_ok
    Sound.play_equip
    class_old = @actor.class_id
    subclass_old = @actor.subclass_id
    class_id = @item_window.item.id
    maintain = YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
    hp = @actor.hp * 1.0 / @actor.mhp
    mp = @actor.mp * 1.0 / [@actor.mmp, 1].max
    case @command_window.current_symbol
    when :primary
      @actor.forget_class_skills(class_old) if R2_yanfly_skills::Forget_skills
      @actor.change_class(class_id, maintain)
      if @actor.subclass_id == 0
        @actor.forget_subclass_skills(subclass_old) if R2_yanfly_skills::Forget_skills
      end
    when :subclass
      @actor.forget_subclass_skills(subclass_old) if R2_yanfly_skills::Forget_skills
      @actor.change_subclass(class_id)
    else
      @item_window.activate
      return
    end
    @actor.hp = (@actor.mhp * hp).to_i
    @actor.mp = (@actor.mmp * mp).to_i
    @status_window.refresh
    @item_window.update_class
  end  
end

Fixed code for error with maintain levels
 
Last edited:

Thefirelion

TheFireLion Game Studio
Veteran
Joined
Mar 25, 2017
Messages
150
Reaction score
47
First Language
Spanish
Primarily Uses
RMVXA
OMG!, It worked! You are a life saver!!:thumbsup-left:

Thanks!, again!
 

Latest Threads

Latest Posts

Latest Profile Posts

There are so many coding terms that are complete gibberish to me. Like what the heck is "Return" or "Array"??
Sometimes I forget how tiny and fun working in 16x16 is (or with 18x18 if ya counting the white outline LOL) and before you ask Yes. Yes this is an appropriate ratio of drinks to all the other stuff. :popcorn:
f37ac128dedc8a53af7deb2b12e8ea81becf6e46.png
Phew, sleep all day, awake all night. I don't know what to draw tonight!

Does that count as poetry? ..Is there a super fast way to test my creations in RPG Maker? Has anyone played the new Pokémon games? I'm itching to buy it but I don't think my husband will want me to after he finds out how much I spent on Christmas!
When can we get this?
RPG Maker MZ Saturn.png
Saturn port when?
I'm new to rpgmaker mv, link me some good stuff to learn.

Forum statistics

Threads
117,071
Messages
1,104,310
Members
153,052
Latest member
HaxDotCombo
Top