Change Class when Equipping Armor

bretk0923

Warper
Member
Joined
Nov 1, 2015
Messages
4
Reaction score
0
First Language
English
I have seen this in previous iterations of RPG Maker, but none so far yet in MV.

I would like to have a class change to occur when a character equips a different piece of armor. For example, when a character equips armor ID #1, class changes to ID #1. When the armor is removed, the class changes to a default ID #.

I had a script in VX Ace that achieved this function by using the tag <class change: x> in the notes section, where 'x' was the ID number of the specific class. There was also a condition in the script itself that allowed the class to change to a default ID when the piece of equipment was removed. Sadly, I cannot remember the name of this script, and all of my VX Ace data has been lost.

Since its release, MV seems to have a plugin that allows this to happen based on equipping a certain weapon type. Here's a link to the forum post: http://forums.rpgmakerweb.com/index.php?/topic/48355-class-change-when-you-equip-a-new-weapon-type/.

So, any help would obviously be greatly appreciated, whether it be a slight modification of this poster's script (with the proper permission, of course), a link to an already existing plugin (though I doubt there is one yet), or an original work.
 

Jeremy Cannady

Coldfire
Veteran
Joined
Oct 25, 2015
Messages
449
Reaction score
268
First Language
English
I posted a script that changes your class based on what weapon type you are using.

For example: any sword makes you a swords man and any staff you equip makes you a wizard.

I might be able to remake it to where it does it based on armor type. ie wizard robes turn you into a wizard.

Only problem is you can equip multiple armors but only one weapon which is why the weapon one was easy. Lemme think for a minute.

Edit 1: I suppose if you remove all armor at once then re-equip it might work.

Edit 2: I suppose you can check and see if the armor you are equipping is a different then what you are wearing then you can force the game to un-equip all armors. Then make it change your class.

Edit 3: I think that checking to see if you are equipping a different armor type and forcing you to un-equip all armors (except for the one you are equipping), this will change your class and you will have one armor equipped and then must equip the same armor type or it will change your class again.
 
Last edited by a moderator:

Mellye

Veteran
Veteran
Joined
Oct 24, 2015
Messages
347
Reaction score
279
First Language
Portuguese
I posted a script that changes your class based on what weapon type you are using.

For example: any sword makes you a swords man and any staff you equip makes you a wizard.

I might be able to remake it to where it does it based on armor type. ie wizard robes turn you into a wizard.

Only problem is you can equip multiple armors but only one weapon which is why the weapon one was easy. Lemme think for a minute.

Edit 1: I suppose if you remove all armor at once then re-equip it might work.

Edit 2: I suppose you can check and see if the armor you are equipping is a different then what you are wearing then you can force the game to un-equip all armors. Then make it change your class.

Edit 3: I think that checking to see if you are equipping a different armor type and forcing you to un-equip all armors (except for the one you are equipping), this will change your class and you will have one armor equipped and then must equip the same armor type or it will change your class again.
There's already a Game_Actor.releaseUnequippableItems() method - it unequips anything that can't be equipped by the current class. So you change classes, and then call it.

At least that's how I did it in my above script.
 

Jeremy Cannady

Coldfire
Veteran
Joined
Oct 25, 2015
Messages
449
Reaction score
268
First Language
English
I think the problem occurs when you change classes but can't change back if you cant equip a different armor type. So for example if you are a knight but put on wizard robes and change to a wizard well if the wizard can't wear plate mail then you cant switch back into a knight.
 
Last edited by a moderator:

Mellye

Veteran
Veteran
Joined
Oct 24, 2015
Messages
347
Reaction score
279
First Language
Portuguese
I think the problem occurs when you change classes but can't change back if you cant equip a different armor type. So for example if you are a knight but put on wizard robes and change to a wizard well if the wizard can't wear plate mail then you cant switch bank into a knight.
You can just unequip.
 

Jeremy Cannady

Coldfire
Veteran
Joined
Oct 25, 2015
Messages
449
Reaction score
268
First Language
English
Well if you had it set up so that when you are basically naked then you become a default class that can equip any armor type would work easy.
 
Last edited by a moderator:

bretk0923

Warper
Member
Joined
Nov 1, 2015
Messages
4
Reaction score
0
First Language
English
Mellye. this is exactly what I'm looking for! Thank you so much! I have a slight issue, could be due to compatibility with some other plugins that I also am using (Yanfly engine perhaps....). As I start to playtest my game, I get a Type Error that says "object is not a function". I have this plugin positioned at the bottom of my list currently. Should I have it set above any Yanfly scripts? Or is there a change I should make to help compatibility with Yanfly?
 

Mellye

Veteran
Veteran
Joined
Oct 24, 2015
Messages
347
Reaction score
279
First Language
Portuguese
Mellye. this is exactly what I'm looking for! Thank you so much! I have a slight issue, could be due to compatibility with some other plugins that I also am using (Yanfly engine perhaps....). As I start to playtest my game, I get a Type Error that says "object is not a function". I have this plugin positioned at the bottom of my list currently. Should I have it set above any Yanfly scripts? Or is there a change I should make to help compatibility with Yanfly?
Just to be sure, if you run it without any other plugin, does it work?
 

bretk0923

Warper
Member
Joined
Nov 1, 2015
Messages
4
Reaction score
0
First Language
English
Negative, Ghost Rider. The pattern is full.

Actually, when I use it with Yanfly's stuff, I get the error immediately at startup. If I use it by itself, the error pops up when I select the option to change equipment. Same error message both times, though.
 

Mellye

Veteran
Veteran
Joined
Oct 24, 2015
Messages
347
Reaction score
279
First Language
Portuguese
Negative, Ghost Rider. The pattern is full.

Actually, when I use it with Yanfly's stuff, I get the error immediately at startup. If I use it by itself, the error pops up when I select the option to change equipment. Same error message both times, though.
Weird, when I test here it works normally. I'll send you a PM so we can try to debug what's happening.
 

Jeremy Cannady

Coldfire
Veteran
Joined
Oct 25, 2015
Messages
449
Reaction score
268
First Language
English
Object is not a function means you probably have parenthesis where there shouldn't be any.

Ex. something();  verses something;
 

Mellye

Veteran
Veteran
Joined
Oct 24, 2015
Messages
347
Reaction score
279
First Language
Portuguese
Object is not a function means you probably have parenthesis where there shouldn't be any.

Ex. something();  verses something;
He's getting the error on the ChangeClass function; possibly a wrong parameter is being sent to it for some reason.

Edit: We found out what the bug was - an outdated version of rpg_object.js had a bug in the changeClass method, it seems. It was trying to invoke "_exp()", which doesn't exist; the correct method would be currentExp().
 
Last edited by a moderator:

kranasAngel

Wanderer
Veteran
Joined
May 9, 2014
Messages
128
Reaction score
47
First Language
English
Primarily Uses
RMMV
This is exactly what I was looking for, thanks.
 

Clobiant

Warper
Member
Joined
Apr 10, 2015
Messages
2
Reaction score
0
First Language
english
Primarily Uses
How do you fix or update rpg_object.js?  I can't seem to find a downloadable version anywhere.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,100
Reaction score
13,705
First Language
English
Primarily Uses
RMMV
There is a thread with updates - it's got a link where you can get the latest version, and instructions on what/where to copy.
 

Mellye

Veteran
Veteran
Joined
Oct 24, 2015
Messages
347
Reaction score
279
First Language
Portuguese
How do you fix or update rpg_object.js?  I can't seem to find a downloadable version anywhere.
If you're using RPG Maker MV on steam, you download the update automatically.

If your project already existed before the update, you'll need to copy the files in the  <rpg maker mv folder>/newData/js to <your project folder>/js/.

If you're not using Steam, or for more info in general, see/ask here: http://forums.rpgmakerweb.com/index.php?/topic/47569-rpg-maker-mv-updates/
 

Clobiant

Warper
Member
Joined
Apr 10, 2015
Messages
2
Reaction score
0
First Language
english
Primarily Uses
Thanks for the quick response!  And I'm excited about this plugin - great work!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games? And, if so, would any of you be interested in a short, proof of concept type non-euclidian puzzle game?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top