Hello! First time posting, sorry if I'm doing this in the wrong category. RPG maker in use is MV. My final objective is to change the subclass of my actor when equipping/unequipping an item (And to learn! I'm a teacher, and will start an RPG maker project with my students so I have to be prepared for anything).
For this reason I'm trying to modify Ellye's Class-Changing Equipment to work on Yanfly's subclasses. I got it down to:
but main issue is "This.changeSubClass(blablabla). It says it's not a function.
For reference, the function from Yanfly's I'm trying to use:
Edit: 8 hours working on this gave me a solution:
BUT this seems like a ticking bomb that will end up exploding. Even tho it works, I'd like for my first question to be answered if possible; would like to know how that could be done 😀
For this reason I'm trying to modify Ellye's Class-Changing Equipment to work on Yanfly's subclasses. I got it down to:
Game_Actor.prototype.checkForClassChangeFromEquips = function(old_equip, new_equip)
{
if (old_equip !== null && typeof old_equip === 'object' && typeof old_equip.meta.change_subclass !== 'undefined')
{
this.actor().changeSubClass(0);
}
if (new_equip !== null && typeof new_equip === 'object' && typeof new_equip.meta.change_subclass !== 'undefined' && this._classId !== new_equip.meta.change_subclass)
{
this.changeSubClass(new_equip.meta.change_subclass);
}
this.releaseUnequippableItems(false);
};
but main issue is "This.changeSubClass(blablabla). It says it's not a function.
For reference, the function from Yanfly's I'm trying to use:
Game_Actor.prototype.setSubclass = function(classId) {
if (this._classId === classId) return;
this.unlockClass(classId);
this._subclassId = classId;
this.refresh();
};
Game_Actor.prototype.changeSubclass = function(classId) {
if (this._classId === classId) return;
this.unlockClass(classId);
if (this._subclassId === classId) classId = 0;
this.setSubclass(classId);
};
Edit: 8 hours working on this gave me a solution:
this._subclassId = new_equip.meta.change_subclass;
BUT this seems like a ticking bomb that will end up exploding. Even tho it works, I'd like for my first question to be answered if possible; would like to know how that could be done 😀