MV - YEP Shop Menu Core - Show Equip Status?

● ARCHIVED · READ-ONLY
Started by LunarMelodia 50 posts Page 1 of 3 View original ↗
  1. Hello everyone!

    I'm currently in a bit of a pickle trying to find a way to modify one tiny window of the YEP Shop Menu Core scene.
    Currently, when purchasing Items the menu looks like this...

    Item Shop.PNG

    It shows the amount party has in their current Inventory on the right hand-side. Perfect!
    Except when it comes to shopping for Weapons & Armor the scene is different.

    Gear Shop (Current).PNG
    (Im using a plugin to change the Parameters like ATK, DEF etc to Icons that's why it's showing there btw)

    Now see, on the right hand-side here Ilia actually does have this weapon equipped already, but the plugin isn't doing a very good job of showing that, which isn't great UX for the player.
    Due to the nature of my game, I don't need to show a stat comparison when shopping for Weapons & Armor, so I would instead much rather show something like the Equip Status of the selected Weapon / Armor.

    What im after would be something more along the lines of this...

    Gear Shop (Example).PNG
    (This example was mocked up in GIMP)

    Since all of the important information regarding the piece of Weapon or Armor will be displayed in the top message box in my game (cut out of these images but ya'll have seen it before), I want to use this space to instead display the Equip Status of these selected weapon or armor.
    This way the player knows instantly when they hover over it in the shop...
    • Which characters can equip it
    • Which characters can't equip it
    • Which characters already have it currently equipped
    • And how many of it including equipped does the party have
    One final thing to note...
    'Equipment' in my game (both weapons & armor) is called 'Gear'.
    So I wouldn't want this screen to say "In Inventory" like the Item Shop, because it would need to say "Gear" instead since this is the Gear (Weapons & Armor) Shop.

    I have zero knowledge of JS (I've only ever worked in C#) so I don't have a realistic idea of how big of a task this is to accomplish.
    If anybody has any advice or can help me out at all please let me know!
    Thank you ^_^
  2. I think I have something that would work.

    JavaScript:
     if (actor.isEquipped(this._item)) {
            text = 'Equipped';
        }

    If you add this conditional branch between lines 1044 and 1045, it will change the text from '0' to 'Equipped' if the current item is equipped. The only problem I see with an edit like this comes with independent items.

    While I don't remember specifically if items purchased from shops can have variable stats, if the stat comparison between the currently equipped item and the one to purchase is anything other than zero, that information will no longer be displayed to the player.

    So I guess its a trade off in this situation. I suppose if you're not utilizing independent weapons and armors, this might not be an issue, as the stat comparison will always be the same.
  3. Hi @ThreeSixNine thank you for your response.
    Unfortunately this isn't really the solution I'm looking for...

    By default, RPGMaker only checks to compare the ATK stat of weapons, and the DEF stat of armor when showing a comparison of +x or -x to the player on this menu.
    There are several weapons & armor in my game where the ATK or DEF stats are the same, but M-DEF or M-ATK or even AGI & LUK are different.

    If i were to use your suggestion, it would mean that any weapon with the same ATK stat as the currently equipped one (which RPG Maker would show as a +0 Change) would be displayed as "Equipped" when it actually isn't equipped.

    It also doesn't really fix any of the other problems I want to address with this menu...
    LunaFamiliar said:
    • Which characters can equip it
    • Which characters can't equip it
    • Which characters already have it currently equipped
    • And how many of it including equipped does the party have

    I appreciate your response and help, but I don't think that will really work to achieve the outcome I want <3
  4. I believe you've misunderstood me. The solution I provided, doesn't use the stat comparison as a basis to show 'Equipped', it simply utilizes the same portion of the window that would normally show the stat difference vs what that actor currently has equipped. Since that is of no concern to you, try this:

    Code
    JavaScript:
    Window_ShopStatus.prototype.drawActorParamChange =
    function(x, y, actor, item1) {
        var width = this.contents.width - this.textPadding() - x;
        var paramId = this.paramId();
        var change = this._item.params[paramId]
        change -= (item1 ? item1.params[paramId] : 0);
        this.changeTextColor(this.paramchangeTextColor(change));
        var text = (change > 0 ? '+' : '') + Yanfly.Util.toGroup(change);
        if (actor.isEquipped(this._item)) {
          text = 'Equipped';
        } else if (!actor.isEquipped(this._item) && actor.canEquip(this._item)) {
          text = 'Can Equip';
        } else {
          text = 'Unequippable';
        }
        this.drawText(text, x, y, width, 'right');
    };

    I have tested this in a nearly new project with very few plugins, so I don't think there's any issues there. I believe this does almost exactly what you are looking for. As an added bonus, this code will show the 'Can Equip' text as green if the item is better than what that actor has equipped, ,so you really aren't losing the stat comparison completely.

    If you try this and it works for you, I'll look into showing the amount equipped in the possession field.
  5. @ThreeSixNine Ohhh thank you for clarifying!
    I understand what you were saying now, my bad ><

    So I replaced the section Window_ShopStatus.prototype.drawActorParamChange section with the new code that you gave me, and this was the result...

    Capture 1.PNG

    In this example, Ilia already has a set of Pugilist Gloves equipped, but the text is still saying 'Can Equip'.

    Capture 2.PNG

    And here both Ilia & Leo have Sturdy Helmets equipped, but they both say 'Can Equip' instead of 'Equipped'.
    No idea why this is happening :/

    Things also get messy when I add augments to my party's weapons using YEP Attach Augments.
    The white 'Can Equip' text changes to Red but it never says 'Equipped'.
    Also I'd like to remove the ATK & DEF icons at the top since they're not useful information given what this menu is becoming.

    I know this is a lot and it's all really complicated, so thank you so much for trying to help me out ^_^
  6. Do you utilize Independent Items? Meaning, do you have independent versions of your weapons and armors that don't stack and can have variable stats across the different instances of the base version?
  7. No i'm not using Independent Items :)

    I've got the starting ID for them set to like 3000 so definitely not using them.
    Unless when you Attach and Augment to a weapon or armor using YEP_X_AttachAugments, it treats it as independent?
    I'm not sure how it works to be honest.
  8. Yeah, to be able to use the attachments and augments you have to have the independent items activated.

    The problems with the text are definitely due to independent items. I'll take a look tomorrow.

    I also have an idea for the max jp per battle, if it's not already solved by the time I get back on tomorrow.
  9. @ThreeSixNine I don't suppose you made any further progress with looking into this?
    I really appreciate your help with my Job Points request btw! :D
  10. LunaFamiliar said:
    @ThreeSixNine I don't suppose you made any further progress with looking into this?
    I really appreciate your help with my Job Points request btw! :D
    I have not yet been able to continue looking at this, but I have been thinking about it. I've taken a short break from game dev, but, this is definitely still on my mind and on my to do list when I come back. I'm hoping I'll be ready to come back in about a week.
  11. ThreeSixNine said:
    I have not yet been able to continue looking at this, but I have been thinking about it. I've taken a short break from game dev, but, this is definitely still on my mind and on my to do list when I come back. I'm hoping I'll be ready to come back in about a week.
    Hiya @ThreeSixNine
    I don't mean to bother you, but it's been a lil bit and I thought I'd just check in to see where you were at since nobody else has chimed in on this, and I haven't had luck making any progress myself :)
    Hope you're well! ^_^
  12. LunaFamiliar said:
    Hiya @ThreeSixNine
    I don't mean to bother you, but it's been a lil bit and I thought I'd just check in to see where you were at since nobody else has chimed in on this, and I haven't had luck making any progress myself :)
    Hope you're well! ^_^
    Hi @LunaFamiliar So I started looking at this again and I have abetter understanding than I did last time I looked at it.

    Since the shop window already uses the base items to check stat increases or decreases, I'll have to find a way to check the actors current equipped item's base item id against the selected item.

    I have some ideas on how I could make that work but I'd need to test them before I say anything definitively.

    But I will definitely keep trying and I'll let you know if I make any progress. Don't feel bad about checking in on it either, I don't mind.
  13. Bumping this cause unfortunately I still haven't figured a solution for it :/
    This is a real tricky problem it seems
  14. @ThreeSixNine I won't tag you again cause I feel bad for bothering you, but wanted to ask if you'd made any progress?
    If not I'm probably going to have to bite the bullet on this one, nobody else seems to have any solutions, and I know basically nothing about JS UI Code xD
  15. ThreeSixNine said:
    Since the shop window already uses the base items to check stat increases or decreases, I'll have to find a way to check the actors current equipped item's base item id against the selected item.

    Open your equipment sceen on an actor and type this in the console: $gameParty.menuActor().equips()[0]
    1636603124694.png
    Since we're using independent items, the independent item will have something called "baseItemId". That is what we need to check against in @ThreeSixNine's code.
  16. Hi @Frostorm ! Thanks for your response ^_^
    I've not used the developer console at all really until now (and had to look up how to even open it lol), but when I go to the Equip scene as you have, and enter the code provided into the console, it gives me this error instead of the big list of information it gave you :/

    Am I doing something wrong here?

    Screenshot.PNG


    EDIT: Nevermind!! I noticed that the G in GameParty in the code you provided was capitalized when in your screenshot it wasn't, so I replicated that and it worked fine.
    Here's the number...

    Console Screenshot.PNG

    There's way way more info than that listed that the screenshot doesn't show, but yeah there's the number you asked for, it's currently '3'
  17. LunaFamiliar said:
    EDIT: Nevermind!! I noticed that the G in GameParty in the code you provided was capitalized when in your screenshot it wasn't, so I replicated that and it worked fine.
    Omg, my apologies! That's what I get for not copy-pasting... >.>
    I've edited my post to correct that.

    As for what to do w/ the "baseItemId", I was hoping @ThreeSixNine would use it for whatever he was planning since that was the one component he mentioned was missing. But maybe you can try editing his code. Try replacing all instances of "._item" w/ "._item.baseItemId" instead.

    Btw, the "3" you got in the screenshot corresponds w/ the 3rd weapon in your database. And that's what we need to check for in the shop.
  18. @Frostorm I've replaced all instances of "._item" in ThreeSixNine's code with "._item.baseItemId"
    and it gave me this crash upon opening the Shop Scene.

    Capture.PNG

    Hopefully @ThreeSixNine has a free moment sometime soon to check up on all this, but hey thanks for trying! Really appreciate it <3
  19. Yea, I had a feeling it wouldn't work lol. Guess there's no choice but to rewrite a bit of the code... I'll figure it out in a bit tho.

    @LunaFamiliar Ok, try this: Though I'm not too confident about it cuz I'm not able to test it on my end since my shop is set up differently.
    JavaScript:
    Window_ShopStatus.prototype.drawActorParamChange =
    function(x, y, actor, item1) {
        var width = this.contents.width - this.textPadding() - x;
        var paramId = this.paramId();
        var change = this._item.params[paramId]
        change -= (item1 ? item1.params[paramId] : 0);
        this.changeTextColor(this.paramchangeTextColor(change));
        var text = (change > 0 ? '+' : '') + Yanfly.Util.toGroup(change);
        actor.equips().some(function(stuff) {
        if (stuff.baseItemId = this._item.id))}{
          text = 'Equipped';
        } else if (!actor.isEquipped(this._item) && actor.canEquip(this._item)) {
          text = 'Can Equip';
        } else {
          text = 'Unequippable';
        }
        this.drawText(text, x, y, width, 'right');
    };
  20. Hi guys, I think the above code will probably work as intended. I had isolated the issue to the base item Id but the problem I ran into then was figuring out which equip to check against.

    Equips.some() seems to be the way to go.

    @LunaFamiliar Let me know if this does or doesn't work.

    @Frostorm Thank you for looking into this as well.