Class Change: Check if (sub)class is already unlocked

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Hi guys, I hope you are all enjoying your summer.

I am using Yanflys Class Change Core to have my lead actor have multiple classes to choosefrom. Every class has its own level.

If I set the variable to Script: $gameParty.leader().level, I get the level of the class which is currently activated.

However, is there a way to save the current level of an inactive class of the same actor into a variable?
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Oh, nevermind. It seems it was $gameParty.leader().classLevel(id).
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
You can use
Code:
$gameActors.actor(ID).classLevel(CLASS_ID)
EDIT: Oh, you figured it out yourself already.
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Thank you anyways!

Now I'm stuck with another thing: I would like to check with a "Conditional Branch" Event whether actor 1 has already unlocked subclass x.
How can I do that?
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
Try
PHP:
$gameActors.actor(ID)._unlockedClasses.contains(CLASS_ID)
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Thank you so much!

And one final issue:
How can I use a script to change a certain subclasses' level?
 
Last edited:

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
@jjleroy
To get the name you have to use $dataClasses.
So to get the name of class 16, you do
Code:
$dataClasses[16].name
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
@jjleroy
To get the name you have to use $dataClasses.
So to get the name of class 16, you do
Code:
$dataClasses[16].name
Thank you so much.
Is there also a way to show the class' icon in the text?
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
To get the icon you use
Code:
$dataClasses[ID].iconIndex
You would have to store that into a variable and then you use
Code:
\i[\v[VARIABLE_ID]]
inside the text box.
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
It works!!!! Great!!! Thank you 1000000000000000000 times!!!!

So now the very last thing I need, would be a script to uplevel a subclass.

I was trying to set class ID 16, to level 14, by using a script call:

$gameVariables.setValue($gameActors.actor(1).classLevel(16), 14);

But nothing happened....
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
To level up an actor, you can use
Code:
actor.levelUp(); // actor refers to an actual actor object, so $gameActors.actor(ID) e. g.
That would raise his level for that class, I think.
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
But is there a way to level up a subclass that's not currently activated? I would like to set an initial level whenever a new class is unlocked.

Could it have something to do with this?

Yanfly.Subclass.Game_Actor_gainExp = Game_Actor.prototype.gainExp;
Game_Actor.prototype.gainExp = function(exp) {
this.gainExpSubclass(exp);
Yanfly.Subclass.Game_Actor_gainExp.call(this, exp);
};

Game_Actor.prototype.gainExpSubclass = function(exp) {
if (!this.subclass()) return;
exp *= Yanfly.Param.SubclassExp;
var curExp = this._exp[this._subclassId] || 0;
var newExp = curExp + Math.round(exp * this.finalExpRate());
this._exp[this._subclassId] = Math.max(newExp, 0);
};
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
So it seems the experience is saved in $gameActors.actor(1)._exp[1]. This is the experience for class 1.

But how can I set this value = a number, like 10?
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
Try $gameActors.actor(1)._exp[1] = 10;
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
YES!!!!!!!!! It works!!!!!!!! Awesome. Amazing!

Is there also a way to do the same just with the class' level?
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Maybe something in here?


Game_Actor.prototype.subclassParamBase = function(paramId) {
if (!this.subclass()) return 0;
var rate = Yanfly.Subclass.Param[paramId];
if (!rate) return 0;
if (this.subclass().baseParamFormula) {
var formula = this.subclass().baseParamFormula[paramId];
if (formula !== '') {
return this.classBaseParamFormula(formula, paramId) * rate;
}
}
var level = this.classLevel(this._subclassId);
if (level > 99) {
var i = this.subclass().params[paramId][99];
var j = this.subclass().params[paramId][98];
i += (i - j) * (level - 99);
var value = i;
} else {
var value = this.subclass().params[paramId][level];
}
return value * rate;
};
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
Nah, that's just for the base parameters.

Does this not work?
$gameActors.actor(ACTOR_ID)._exp[CLASS_ID] = 10;
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Yes that one works!!! However I would need another one so I can set the level directly instead of the exp...
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
$gameActors.actor(ACTOR_ID).changeLevel(x);
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
It works, but not for the subclasses unfortunately, but I will find a way around it using the experience.
Thank you so much for your help!!! How can I ever thank you for this!
 

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

Latest Threads

Latest Profile Posts

2 huge market drops in 2 days. So glad I sold my non-dividend stocks about 2 weeks ago. And if the dividend ones drop heavily, hey more cheap stocks for me!
My tutorial is live! It covers using Yanfly's weapon unleash to replace the basic attack skill with a more dynamic version depending on which weapon type the actor has equipped. It also includes how to import a custom function used to generate a random number within supplied minimum and maximum values, used in the replaced skills, to give weapons a set damage range.
What can I sing for my sisters birthday...?

>.<'
Well, I'll have you know that I'm still around, looking for opportunity to resurface with some stuffs.
I like to think of Profile Posts as tiny homes, full of all kinds of unsuspecting suckers "future" friends.... Many of which are of course only going to be excited when a strange man in black suddenly shows up to say hi. :LZSexcite:

Forum statistics

Threads
94,510
Messages
921,513
Members
124,366
Latest member
Kantain1292
Top