Remove all previous skills known when changing class

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
167
Reaction score
64
First Language
French
Primarily Uses
RMMV
Hi there!

Right now, when I do a class change, the actor seem to keep access to skills of previous class. I do not wan that. Instead, I want them to forget the skills they had.

In my game, mages can follow ONE of the five magic schools (for simplicity's sake, let's say fire, water, earth, etc.)
Is there a way, plugin or otherwise, to easily do this:

1- Actor change class from Fire Mage to Water Mage
2- Unlock skills for Water Mage
3- Forget all skills for Fire Mage
 

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
167
Reaction score
64
First Language
French
Primarily Uses
RMMV
$gameActors.actor(id).forgetSkill(skillId) is what you need
Thank you! It's not going to be super fun to implement but I think I can manage.

Cheers!
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
535
First Language
English
Primarily Uses
N/A
What if the player decides "I don't like how water plays, i'm switching back to fire." and when they do that, all the fire skills they learned leveling up were gone?
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
839
Reaction score
467
First Language
Poland
Primarily Uses
RMMV
@Oddball - then we can use opposite method:

$gameActors.actor(id).learnSkill(skillId)
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
535
First Language
English
Primarily Uses
N/A
@Oddball - then we can use opposite method:

$gameActors.actor(id).learnSkill(skillId)
Wouldn't that just teach the actor all the skills from the fire branch? How do you account for level?
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
839
Reaction score
467
First Language
Poland
Primarily Uses
RMMV
With conditional branches or write whole method as JS code.

if (class==a && level > b){
$gameActors.actor(id).learnSkill(skillId);
}else{//Requirements are not met;}
 

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
167
Reaction score
64
First Language
French
Primarily Uses
RMMV
So this is what I did:

Common Event: Forget All Skills
JavaScript:
for (var i = 44; i < 60; ++i) {
    $gameActors.actor(5).forgetSkill(i)
};
And then, one common event for each Magic School, when changing class:

Event: School Fire
Code:
for (var i = 44; i < 51; ++i) {
    $gameActors.actor(5).learnSkill(i)
};
Event: School Water
Code:
for (var i = 52; i < 60; ++i) {
    $gameActors.actor(5).learnSkill(i)
};

Not ideal, but seems to work just fine for now. I'll have to account for level when I get there.

Thanks for the help!
 
Last edited:

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
89
Reaction score
11
First Language
Swedish
Primarily Uses
N/A
So this is what I did:

Common Event: Forget All Skills
JavaScript:
for (var i = 44; i < 51; ++i) {
    $gameActors.actor(5).forgetSkill(i)
};
And then, one common event for each Magic School, when changing class:

Event: School Fire
Code:
for (var i = 44; i < 51; ++i) {
    $gameActors.actor(5).forgetSkill(i)
};
Event: School Water
Code:
for (var i = 52; i < 60; ++i) {
    $gameActors.actor(5).forgetSkill(i)
};

Not ideal, but seems to work just fine for now. I'll have to account for level when I get there.

Thanks for the help!
I am unsure if this will work for you but this is what I use for something similar-ish.
I believe if you first change the class and then run this it should initialize the character.
1596495078792.png
1596495049357.png
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
As part of a Plugin I wrote for my project, I've got something like the following to handle transformation abilities that switch out skill sets while transformed:

Code:
Game_Actor.prototype.transformSkills = function(methodType) {
    $dataClasses[this._classId].learnings.forEach(learning => {
        if (this._level < learning.level) { return; }
        this[`${methodType}Skill`](learning.skillId);
    });
}

Game_Actor.prototype.completeTransform = function(classId) {
    this.transformSkills('forget');
    this.changeClass(classId);
    this.transformSkills('learn');
};
Loops through all the Skills for the actor's given class and, if they're high enough level to know them, forgets them. Then it changes their class. Then loops through all the Skills for the actor's given class (now that it's changed) and, if they're high enough level to know them, learns them.

So if you wanted to change from whatever their current class is to a class with Id 2, you could just have a Script call of:
Code:
$gameActors.actor(5).completeTransform(2);
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,088
Members
137,585
Latest member
Reversinator
Top