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

Kid : "MOOOMM! My poop is bloody red!" Me, an intellectual : "There's worm parasite inside your body. You gonna die soon."
Caught a guy trying to break into our house today. Appearantly he intended to burgle our neighbor (a 94yo widow) but picked the wrong house. Faced with two angry males he was quick to give up without a fight...
I just joined the club of nerds making their own Excel-Sheets to calculate HP / MP / EXP.. parameter curves
Me: "Finally finished most of my game backlog. Probably time to do some gamedev" | Steam: *offer sales*
If I recorded while I created (what I think is) a small plugin, would you be interested enough in the process to watch it?

Forum statistics

Threads
94,596
Messages
922,205
Members
124,472
Latest member
Lanzy
Top