Optimize Equipment on Class Change

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
Good day.


I'm trying to make a little script snippet to force an actor to optimize their equipment when they change classes. I am using Yanfly's class change core plugin.


I found a script call that will optimize equipment on the actor it is called by ($gameActors.actor(id).optimizeEquiments()), but any attempt I've made to insert it into yanfly's plugin has failed. The most success I've seen actually had it working, but it was re-optimizing equips every time you scrolled through classes on the class change menu, instead of when actually changing classes. This caused a lot of lag as well.


I also tried modifying the Game_Actor.prototype.changeClass function from rpg_objects.js, but had the same issue, in that yanfly's class change plugin was causing it to attempt to optimize by scrolling through the menu of classes, instead of actually when changing them. Additionally, while the optimize seemed like it would happen on job change (the stat preview information on the right side of the screen updated as if it were being optimized), it actually didn't happen, but still caused massive lag afterwards.


So here's what I want:

  • When you change classes using yanfly's class change core, (or optionally when doing it manually as well) the actor who just changed classes gets their equipment optimized.
  • Obviously needs to be compatible with Yanfly's class change core plugin
  • The stat preview window on the right side of the class change menu should update to show what the actors stats will be after the equipment optimize after changing classes (if possible).
  • (Optional) Pops a window up after class change that advises that equips have been optimized
  • (Super Optional) Add-on to the options menu to disable auto-optimizing equipment on class change
  • Should not optimize the equips of any actor unless that actor has just changed classes. (no lag)



Thanks in advance, anyone who takes a look at this.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
I was able to get the optimize to work by adding it to Scene_Class.prototype.onItemOk.


You'll likely wanna move that refresh there around too.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
You're right on there. I also managed to get the popup dialogue to work through Iavra Generic Popup


Now all I have to do is find a way to add that to the options menu.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
You're right on there. I also managed to get the popup dialogue to work through Iavra Generic Popup


Now all I have to do is find a way to add that to the options menu.
Add the popup?


If it's the popup, you'll have to see if someone else can help as I have no knowledge of how that plugin works.


If it's the class change, the plugin already allows use via the menu, no?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
Add the popup?


If it's the popup, you'll have to see if someone else can help as I have no knowledge of how that plugin works.


If it's the class change, the plugin already allows use via the menu, no?
Actually both. The plugin is called from a function call, which I just tacked onto the end of the optimization call, in class change core. I just want the ability for a player to turn that optimization off (and the popup, as it won't be necessary), from the in-game options menu. In the class change it';s a simple matter of checking if the option is on or off before optimizing equips, I'm just not sure how to add an option to the menu, or check whether it's on or off.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
I see.  Adding options to the Options menu is a pain, but not impossible.


I made a plugin a little while ago which lets you change encounter rates via the option menu.


You could look at that to see how I did it.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
I have taken a look and have succeeded in adding it to the options menu, and it seems to work. Thanks to your assistance. :)
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
No problem.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
No problem.
I just noticed an issue with it where the title screen causes it to return to its default state, and it doesn't update when a game is loaded to return to the way it was in the save game. Any ideas how to fix this @Maliki79?


Edit: loading a savegame without hitting the title screen saves the value. Any of the other options on the options menu retain the value, including your own. I'm at a loss here.


edit2: false alarm. typo'd a capital letter so it never applied the change, and always reverted to the default.
 
Last edited by a moderator:

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
No worries. ;-)
 

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

Latest Threads

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,083
Members
137,583
Latest member
write2dgray
Top