How to handle actors with two classes

Hello everyone,


These days I'm planning to create a game based in the idea that each player as two classes (physical and magical one) and I'm try to write the necessary plugins to adapt the game for it. My idea is that the two classes are costumed separately and each one has its own equip, modifying the equip window and status window in the menu according to this. Also, would like to be able to change of class in the middle of the battle with a command and of course I would change how the lvl_up is managed. 

I think I would be capable to modify the windows and add the respective battle command, however I have a problem handling the two classes on the same actor since I would like to have different stats in each one and the game would have to alternate or have access to two groups of stats. For now, my ideas to handle this are:

  • Modifying the function / creating a variation of Game_Actor.prototype.changeClass to not only change the stats but also mantain the hp and mp rate. Nevertheless, to handle the two equips I maybe would have to change of class several times in the equip window to see the stats and I also don't know how to handle the status window since I would like it to show both classes' stats and equips at the same time.
  • Adding a whole new group of proprieties to Game_BattlerBase.prototype as hp2, mp2, tp2, etc. Nevertheless, I'm not quite sure of how equipping things changes the stats and how to let know the system which group of proprieties has to use/focus in each moment.



I'm not searching for someone to do this for me, I would like to do it by myself but at the same time I lack of knowledge so I'm asking. Thus, I would like recommendations of which option is better and advises or suggestions to take in account while doing the good one.



Sorry for bothering and expecting your answers!  🙂
I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.
I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.


My apoligies! Won't happen again!!!
Yanfly has subclassing plugin. You may want to look at that, or even build a modification of it that locks the functionality.
Yanfly has subclassing plugin. You may want to look at that, or even build a modification of it that locks the functionality.



Yeah, it sounds like you're asking for Yanfly's plugins. 


http://yanfly.moe/yep/


Class Change and Subclass plugins should be a good start. Hope that helps!
Each class has their own set of equippable items (via traits) as well as parameters (via class parameter curves)


So you don't really need to do anything in terms of plugins since those are already supported.


If you wanted to have custom equip slots, then you would need to write a plugin to assign equip slots to each class.


When you switch from one class to another, the only thing that changes is the level, unless you choose to "keep EXP" via script call.


HP and MP should remain the same UNLESS the max HP and max MP goes down, which forces those numbers down.


I'm not sure what the purpose of having a second set of HP would be, unless by "maintain HP/MP" you actually mean if class 1 had 500 HP and you switched to class 2 with 250 HP, switching back to class 1 would go restore your HP back to 500 again because that's what it was before you left it.
@ロリ先輩 and @baxterzeppo thanks for the suggestion!


However, Yanfly script is more focused on handling several classes, in my case it would be only two so I would like to create my own script but I never thought of consulting Yanfly's code and I'll give a try. Hope I get how it works  🙂
Each class has their own set of equippable items (via traits) as well as parameters (via class parameter curves)


So you don't really need to do anything in terms of plugins since those are already supported.


If you wanted to have custom equip slots, then you would need to write a plugin to assign equip slots to each class.


When you switch from one class to another, the only thing that changes is the level, unless you choose to "keep EXP" via script call.


HP and MP should remain the same UNLESS the max HP and max MP goes down, which forces those numbers down.


I'm not sure what the purpose of having a second set of HP would be, unless by "maintain HP/MP" you actually mean if class 1 had 500 HP and you switched to class 2 with 250 HP, switching back to class 1 would go restore your HP back to 500 again because that's what it was before you left it.



Yeah, for the equip slots I saw your script to customize them and maybe I'll use if I can adapt it correctly to the rest.


And about the class switching, is exactly as you described: I would like that if the actor has the 55% of its HP in one class, switching to the other class conserve that rate but with the maxHP of that class, and of course conserve level and EXP so the two classes grow simustaneously/together making the actor to learn the skills of the two classes when it lvls up.


Which I maybe explained weakly is the equips: I would like a save of each class equip so when you change class, the last equip used in the class is automatically equip to the actor. There's my problem: how to handle two equips and two sets of different parameters( hp, mp, atk, def...) at the same time. 

Original thread: https://forums.rpgmakerweb.com/threads/how-to-handle-actors-with-two-classes.57117/