[VXACE] Talent Menu

Hello!
I was working on a script for my project but my knowledge about rgss3 is kinda approximate.
I tried searching around to find a similar script already working but couldn't find anything in the net.

Here's what I'm trying to do with the script:
"Class & Mark Talents".
- In my game, every character have a Class and a Mark: there are 3 Classes (Attack, Defense, Support) and 3 Marks (Forgotten, Nameless, Eternal)
- The player can increase the Class and Mark Talents by spending items as value. The Talents are basically the same stats used in VXAce (max hp, max mp, attack, etc.), but leveling Class Talents and Mark Talents increasing the stat for all the character of that Class/Mark.
The "Class & Mark Talents" menu should allow the player to choose between Class Talents and Mark Talents and in the same way, the "Class Talents Menu" or "Mark Talents Menu" should allow the player to choose which Class or Mark wants to level up.
- The item used are different for every class and mark (example: Attack Rune, Support Rune, Forgotten Tome, Nameless Tome). Leveling a stat uses an amount equals to the stat level multiplied by 5.

Example:
-> Class Talent (I choose Class Talent Menu)
->-> Attack (I choose Attack Class)

Class Talent: Attack
HP Lv. 2/50 (+100 MAX HP)
MP Lv. 0/50 (+0 MAX MP)
ATK Lv. 5/50 (+5 ATK)
DEF Lv. 2/50 (+2 DEF)
MAT Lv. 1/50 (+1 MAT)
MDF Lv. 0/50 (+0 MDF)
AGI Lv. 1/50 (+1 AGI)
LUK Lv. 0/50 (+0 LUK)

Like I said, I tried to create the script myself but I don't know if it can be used as base.
Spoiler
Ruby:
class Game_Interpreter
  def initialize
    @attack_talents = ClassTalents.new("Attack")
    @defense_talents = ClassTalents.new("Defense")
    @support_talents = ClassTalents.new("Support")
  end
 
  def call_class_talent_menu(class_type)
    case class_type
    when "Attack"
      @attack_talents.display_menu
    when "Defense"
      @defense_talents.display_menu
    when "Support"
      @support_talents.display_menu
    else
      # Handle invalid class type
    end
  end
end

class ClassTalents
  MAX_LEVEL = 50
  POINTS_PER_LEVEL = 10
 
  attr_reader :class_type
 
  def initialize(class_type)
    @class_type = class_type
    @talents = {
      "HP" => { current: 0, max: 100, cost: 5 },
      "MP" => { current: 0, max: 50, cost: 5 },
      "ATK" => { current: 0, max: 50, cost: 5 },
      "DEF" => { current: 0, max: 50, cost: 5 },
      "MAT" => { current: 0, max: 50, cost: 5 },
      "MDF" => { current: 0, max: 50, cost: 5 },
      "AGI" => { current: 0, max: 50, cost: 5 },
      "LUK" => { current: 0, max: 50, cost: 5 }
    }
  end
 
  def display_menu
    puts "Class Talent: #{@class_type}"
    @talents.each do |stat, data|
      puts "#{stat} Lv. #{data[:current]}/#{MAX_LEVEL} (+#{data[:max]} #{stat})"
    end
    puts "Items required"
    # Implement displaying quantity of the item needed in possession
    # Implement user interaction to choose stat to level up and confirm
  end
 
  def level_up(stat)
    return if @talents[stat][:current] >= MAX_LEVEL
    @talents[stat][:current] += 1
    @talents[stat][:max] += 10 if @talents[stat][:current] % POINTS_PER_LEVEL == 0
    # Deduct item from player's possession
    # Update player's stats accordingly
  end
end

Thank you all in advance for reading so far.
I know I'm asking a lot, and I don't pretend anything like a complete solution. Even just some advice is very welcome.
First of all, tell us what makes a class talent any different from a mark talent. If there's no real difference involved, then you'd just be duplicating stuff like crazy. It'd be a mere cosmetic change. Some people hate criticisms on game mechanics, but logic is quite important in programming.

I wonder why you'd ever need to do that. My point is that it's way better to keep it simple than simply repeating the code required there over and over again. Unnecessary duplication of anything you can think off is highly inconvenient.

If you want to keep both class and mark talents, it'd be a good idea to make them work in different ways. Why am I so sure about this? Because you could simply stick to the class talents and make 2 different sets of items to be used / consumed depending on what's the current actor's class or ID. Such a set could also take in consideration the actor's mark, some sort of a subclass, as well.
Well I was trying to being polite by simply explaining my whole idea. Like I said I never pretended anything.
Yes, Class and Mark Talents are pretty much the same but that's not the point of my problem.
The real point is that my script doesn't work because I'm no professional scripter and I was only trying to make one.
The code I posted is just what I thought could be used as a base for the complete script.
I thought I made it clear but apparently not.
It has nothing to do with not being clear on what you already exposed but what you haven't defined so far. Besides I provided you with an idea on how to just use one talent type, and use the other as a subclass or actor/class specific feature. Again, it's a suggestion and nothing else. Now you can think on any changes you might like to make on your talent system. My advice is to keep it as straight forward as possible for you're still a beginner.

BTW, What I have been telling you is that you might want to refine your idea a bit more first. I'm not expecting you to get a grasp of all I've said so far, just keep all of that in mind while planning how you want it to work at the end of the day. The rest comes with LOTS of practice, especially because you'd be learning by trial and error. Don't get discouraged because of that.

One specific advice I can give you right away, no matter how the talent system will look like in the future, would be to call a new scene instead of a class that only keeps 1 out of 3 references to either attack, defense or support talents. (This is NOT as straightforward as you'd like it to be, but it has certain advantages.)

All scene classes need a main method as to let it be executed by the interpreter. So this means that you can create a new class and make it a child class of Scene_Base because Scene_Base already has a main method.

Ruby:
class Scene_Talents < Scene_Base
  @@talents = nil
  def self.setup(new_talents)
    @@talents = new_talents
  end

  def start
    # Place your windows here
  end
end

Then you could modify your call_class_talent_menu method to actually call this new scene.
If you don't create a new scene, the player could still be attacked by monsters lurking around, depending on how you configured your event. Creating the new scene will keep the map intact.
Here's how it could look like.

Ruby:
  def call_class_talent_menu(class_type)
    case class_type
    when "Attack"
      talents = @attack_talents
    when "Defense"
      talents = @defense_talents
    when "Support"
      talents = @support_talents
    end
    Scene_Talents.setup(talents)
    SceneManager.call(Scene_Talents)
  end

Original thread: https://forums.rpgmakerweb.com/threads/vxace-talent-menu.167638/