Hey, just about done setting up my class change script, but I need one more thing to make it as smooth as butter. When swapping classes I remove all equipped items, save these to a variable, and then re-equip the same items if the actor's class can equip the matching eType. This all works fine and dandy. However, for the slots that are unable to be filled due to eType differences between classes, the slot will obviously be empty after the class change. So I figure the best way to handle this is to optimize the empty gear slots.
The code I am thinking of is something like this:
However this will optimize all equipment slots. I didn't find any matches for 'optimize' in the MV script call section, so I was wondering what the correct syntax is to optimize the slot in question. For this example case I will be using slot [0].
I am guessing the proper code is something close to:
Is this correct?
I wasn't sure if this was supposed to go in another section since it involves javascript, but I think this is the right place as this is a default function in RMMV afaik. If I am mistaken I apologize in advance.
Come to think of it, I could probably just run the optimize call first, and then run the code that equips the previously worn gear afterwards. Still, if this can be done with proper formatting rather than a "shotgun" approach, I think it would be best.
Thank you.
The code I am thinking of is something like this:
Code:
if (!this.equips()[0])
{
this.optimizeEquipments()
};
However this will optimize all equipment slots. I didn't find any matches for 'optimize' in the MV script call section, so I was wondering what the correct syntax is to optimize the slot in question. For this example case I will be using slot [0].
I am guessing the proper code is something close to:
Code:
this.optimizeEquipments()[0],
Is this correct?
I wasn't sure if this was supposed to go in another section since it involves javascript, but I think this is the right place as this is a default function in RMMV afaik. If I am mistaken I apologize in advance.
Come to think of it, I could probably just run the optimize call first, and then run the code that equips the previously worn gear afterwards. Still, if this can be done with proper formatting rather than a "shotgun" approach, I think it would be best.
Thank you.