JP Skill Engine Problem with Subclass

Hey guys, I am having a problem with some specific scripts. https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/jp-manager/, and https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/learn-skill-engine/. The problem I am having is that my subclasses are not getting any JP when I level up from battles or when I kill enemies. How would i go about fixing this? Any help is appreciated.
Are there any notetags you can put on enemies to have actors earn JP from defeating them?

Edit: Yup. there are. sounds like you think its a plug and play

JP.png
Are there any notetags you can put on enemies to have actors earn JP from defeating them?

Edit: Yup. there are. sounds like you think its a plug and play

View attachment 124933
do not that i have enemies with that note tag:
Rby4rYc
sounds like you think its a plug and play
Sounds like you think it is plug and play.

i have enemies with that note tag
Your setup is good, but the JP manager script is not inclusive with subclasses.
Also the learn skills script is not inclusive with subclasses. unless you have addons to allow the skills an actor learns from the subclass.

Without testing I would say that the problem is with the sub class script working with the learn skills script.
The JP script is applied to the actor not a class. $game_actors[x].earn_jp(y)
Sounds like you think it is plug and play.


Your setup is good, but the JP manager script is not inclusive with subclasses.
Also the learn skills script is not inclusive with subclasses. unless you have addons to allow the skills an actor learns from the subclass.

Without testing I would say that the problem is with the sub class script working with the learn skills script.
The JP script is applied to the actor not a class. $game_actors[x].earn_jp(y)
is there a way i can make it to where i can have subclasses get JP?
You still don't understand what I said. The JP is not applied to the class, it is applied to the actor.
In my testing with this
https://www.rpgmakercentral.com/top...ddon-subclass-gain-exp-learn-skill-trait-etc/
I was not able to learn subclass skills even though they showed up in the learn skill window. The Learn Skill script does not work with subclasses. It needs an addon. I don't know if one exists.
You still don't understand what I said. The JP is not applied to the class, it is applied to the actor.
In my testing with this
https://www.rpgmakercentral.com/top...ddon-subclass-gain-exp-learn-skill-trait-etc/
I was not able to learn subclass skills even though they showed up in the learn skill window. The Learn Skill script does not work with subclasses. It needs an addon. I don't know if one exists.
do note the jp goes for primary classes not actors, if you change the primary class of an actor with 200JP the JP will go down to 0 for the class you pick unless that class has some JP.
primary class of an actor with 200JP
So you're displaying the jp on the screen. What script do you have to show this?

Can you learn skills that don't require JP? OK, it works without needing JP.
So you're displaying the jp on the screen. What script do you have to show this?

Can you learn skills that don't require JP? OK, it works without needing JP.
The JP showing on the menu screen is just a change in the JP manager script, if you want to display it go to yanflys website and Ctrl+F and search display JP.
OK, after looking into the script more I saw that it says gainjp(class_id)
so it does go to the class, you're right.
Add this on, it will duplicate any gain jp for the subclass.
Code:
class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # new method: init_jp
  #--------------------------------------------------------------------------
  def init_jp
    @jp = {}
    @jp[@class_id] = 0
    @jp[@subclass_id] = 0
  end
 
  #--------------------------------------------------------------------------
  # new method: earn_jp
  #--------------------------------------------------------------------------
  def earn_jp(jp, class_id = nil)
    gain_jp(jp * jpr, class_id)
    class_id = @subclass_id
    gain_jp(jp * jpr, class_id)
  end
 
  #--------------------------------------------------------------------------
  # new method: gain_jp
  #--------------------------------------------------------------------------
  def gain_jp(jp, class_id = nil)
    init_jp if @jp.nil?
    class_id = @class_id if class_id.nil?
    class_id_sub = @subclass_id if class_id.nil?
    @jp[class_id] = 0 if @jp[class_id].nil?
    @jp[class_id] += jp.to_i
    @jp[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max
    @jp[class_id_sub] = 0 if @jp[class_id_sub].nil?
    @jp[class_id_sub] += jp.to_i
    @jp[class_id_sub] = [[@jp[class_id_sub], YEA::JP::MAX_JP].min, 0].max
    @battle_jp_earned = 0 if @battle_jp_earned.nil? && $game_party.in_battle
    @battle_jp_earned += jp.to_i if $game_party.in_battle
  end
 
end # Game_Actor
There is however one issue with the jp script/default system. If you have separate levels for the subclasses, then when you switch your class you will gain jp for the difference in levels.
OK, after looking into the script more I saw that it says gainjp(class_id)
so it does go to the class, you're right.
Add this on, it will duplicate any gain jp for the subclass.
Code:
class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # new method: init_jp
  #--------------------------------------------------------------------------
  def init_jp
    @jp = {}
    @jp[@class_id] = 0
    @jp[@subclass_id] = 0
  end
 
  #--------------------------------------------------------------------------
  # new method: earn_jp
  #--------------------------------------------------------------------------
  def earn_jp(jp, class_id = nil)
    gain_jp(jp * jpr, class_id)
    class_id = @subclass_id
    gain_jp(jp * jpr, class_id)
  end
 
  #--------------------------------------------------------------------------
  # new method: gain_jp
  #--------------------------------------------------------------------------
  def gain_jp(jp, class_id = nil)
    init_jp if @jp.nil?
    class_id = @class_id if class_id.nil?
    class_id_sub = @subclass_id if class_id.nil?
    @jp[class_id] = 0 if @jp[class_id].nil?
    @jp[class_id] += jp.to_i
    @jp[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max
    @jp[class_id_sub] = 0 if @jp[class_id_sub].nil?
    @jp[class_id_sub] += jp.to_i
    @jp[class_id_sub] = [[@jp[class_id_sub], YEA::JP::MAX_JP].min, 0].max
    @battle_jp_earned = 0 if @battle_jp_earned.nil? && $game_party.in_battle
    @battle_jp_earned += jp.to_i if $game_party.in_battle
  end
 
end # Game_Actor
There is however one issue with the jp script/default system. If you have separate levels for the subclasses, then when you switch your class you will gain jp for the difference in levels.
Where do i put the new part?
in a new script slot...below the jp manager script.
in a new script slot...below the jp manager script.
is there a way to fix it to where it doesn't give you more JP even if the subclass has different levels and is there a way to show the subclass JP in difference to the primary class JP?
This fixes the display.
Code:
class Window_Base < Window
 
  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
    draw_actor_jp_class(actor, @class_id, dx, dy + line_height * 2)
    if !actor.subclass.nil?
    draw_actor_jp_subclass(actor, @subclass_id, dx, dy + line_height * 3)
    end
  end

  def draw_actor_jp_subclass(actor, subclass_id, dx, dy, dw = 112)
    draw_icon(Icon.jp, dx + dw - 24, dy) if Icon.jp > 0
    dw -= 24 if Icon.jp > 0
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, Vocab::jp, 2)
    draw_text(dx, dy, dw, line_height, actor.subclass.name, 3)
    dw -= text_size(Vocab::jp).width
    change_color(normal_color)
    draw_text(dx, dy, dw, line_height, actor.jp(actor.subclass.id).group, 2)
  end

end # Window_Base
fixed the gain jp
JP manager script line 519 under level_up
Code:
    earn_jp(YEA::JP::LEVEL_UP) unless SceneManager.scene_is?(Scene_Class)
One more minor bug. the subclass gain jp when the main class gains a level.
This fixes the display.
Code:
class Window_Base < Window
 
  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
    draw_actor_jp_class(actor, @class_id, dx, dy + line_height * 2)
    if !actor.subclass.nil?
    draw_actor_jp_subclass(actor, @subclass_id, dx, dy + line_height * 3)
    end
  end

  def draw_actor_jp_subclass(actor, subclass_id, dx, dy, dw = 112)
    draw_icon(Icon.jp, dx + dw - 24, dy) if Icon.jp > 0
    dw -= 24 if Icon.jp > 0
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, Vocab::jp, 2)
    draw_text(dx, dy, dw, line_height, actor.subclass.name, 3)
    dw -= text_size(Vocab::jp).width
    change_color(normal_color)
    draw_text(dx, dy, dw, line_height, actor.jp(actor.subclass.id).group, 2)
  end

end # Window_Base
fixed the gain jp
JP manager script line 519 under level_up
Code:
    earn_jp(YEA::JP::LEVEL_UP) unless SceneManager.scene_is?(Scene_Class)
One more minor bug. the subclass gain jp when the main class gains a level.
Where do i put the display fix? Is there a way to fix the bug with primary class level up?
Where do i put the display fix?
really, now I feel like I'm spoon feeding you.
Add onto the previous script I posted above or in a new script entry.
Is there a way to fix the bug with primary class level up?
I have no idea, but I'm trying. Perhaps you can let me work on it, or maybe someone else has some insight to this issue.
really, now I feel like I'm spoon feeding you.
Add onto the previous script I posted above or in a new script entry.

I have no idea, but I'm trying. Perhaps you can let me work on it, or maybe someone else has some insight to this issue.
Ok, so the display works, but this is what is looks like for the subclass JP:
BTW, I am still kinda new to the rpg maker with the places to put scripts. Sorry for my stupidity.
Moved to: Script Support
what is looks like for the subclass JP:
I had that issue a little bit myself and just adjusted the dy value.
But why your main class does not show up I do not know.
upload_2019-10-5_9-43-34.png
upload_2019-10-5_9-44-7.png
Yanfly never intended for subclasses to gain JP, so all of their scripts are set up around that idea. I once found a script that gives the subclass JP too written as an Yanfly add-on, but I didn't save it so I have no idea where it is anymore. But it was written as an add-on so might work with all Yanfly scripts appropriately?

Original thread: https://forums.rpgmakerweb.com/threads/jp-skill-engine-problem-with-subclass.113925/