MV - YEP Shop Menu Core - Show Equip Status?

● ARCHIVED · READ-ONLY
Started by LunarMelodia 50 posts Page 3 of 3 View original ↗
  1. @ThreeSixNine it seems to have worked! However the 'Can't Equip' text is pushed off the screen now for some reason...
    Capture.PNG

    And there is still the issue of 'Can Equip' sometimes appearing Red.
    2.PNG

    As for the 'Possession' section in the Terms tab of the Database, unfortunately that changes the text for purchasing Items as well.
    At this point I think I'd be happier with keeping it as is, because 'In Inventory:' is a better general term for weapons, items & armor, so long as we can somehow make it also include equipped weapons.
    Either way we're definitely getting there! ^_^
  2. This should fix the "Can't Equip" runoff:
    Code
    JavaScript:
    Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) {
        var enabled = actor.canEquip(this._item);
        this.changePaintOpacity(enabled);
        this.resetTextColor();
        this.resetFontSettings();
        this.drawText(actor.name(), x, y, this.contents.width - x);
        var item1 = this.currentEquippedItem(actor, this._item.etypeId);
        if (enabled) {
          this.contents.fontSize = Yanfly.Param.ShopStatFontSize;
          this.changeTextColor(this.textColor(3));
          this.drawActorParamChange(x, y, actor, item1);
          this.resetTextColor();
        } else {
          this.contents.fontSize = Yanfly.Param.ShopCantSize;
          var ww = this.contents.width - this.textPadding();
          this.changeTextColor(this.textColor(10));
          this.drawText(Yanfly.Param.ShopCantEquip, x, y, ww, 'right');
          this.resetTextColor();
        }
        this.changePaintOpacity(true);
    };

    And this should handle the color consistency:
    Color Consistency
    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);
      var itemId = this._item.id;
      var equips = [];
      for (i = 0; i < actor.equips().length - 1; i++) {
        if (actor.equips()[i] !== null) {
          equips.push(actor.equips()[i].baseItemId);
        }
      }
      if (equips.contains(itemId)) {
        text = 'Equipped';
      } else if (actor.canEquip(this._item)) {
        text = 'Can Equip';
      }
      this.drawText(text, x, y, width, 'right');
      this.resetTextColor();
    };
  3. Fantastic! It works a charm thank you! ^_^
    The only thing is now 'Equipped', which should be either White or Blue or something, is now also showing up Green.
    Capture.PNG



    It doesn't really matter what colour 'Equipped' is, so long as it isn't one of the already used colours (red or green).

    Now it's just getting the inventory display to also include Equipped armor/weapons and we're good to go!
    I really really appreciate all the time and effort you've put into helping me :D
  4. LunaFamiliar said:
    Fantastic! It works a charm thank you! ^_^

    Now it's just getting the inventory display to also include Equipped armor/weapons and we're good to go!
    I really really appreciate all the time and effort you've put into helping me :D
    @LunaFamiliar Okay, try one thing for me. In the code above, for the 'cant equip' runoff, try changing the '3' in textcolor(3) to '1'

    I'm just curious to see if I have something overlapping for the colors. I'll finish taking a look at this tomorrow evening.
  5. Done, the result was that both 'Can Equip' (was green) and 'Equipped' (was also green but I ideally want to be blue) are now Blue.
    Undoing the change (setting it back to '3') sets them both back to green.
  6. LunaFamiliar said:
    Done, the result was that both 'Can Equip' (was green) and 'Equipped' (was also green but I ideally want to be blue) are now Blue.
    Undoing the change (setting it back to '3') sets them both back to green.
    Okay, thought so. I get it straightened out tomorrow and start looking more into the in possession values feature.

    @LunaFamiliar Here's my work from tonight:
    Can't Equip Code
    JavaScript:
    Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) {
      var enabled = actor.canEquip(this._item);
      this.changePaintOpacity(enabled);
      this.resetTextColor();
      this.resetFontSettings();
      this.drawText(actor.name(), x, y, this.contents.width - x);
      var item1 = this.currentEquippedItem(actor, this._item.etypeId);
      if (enabled) {
        this.contents.fontSize = Yanfly.Param.ShopStatFontSize;
        this.drawActorParamChange(x, y, actor, item1);
        this.resetTextColor();
      } else {
        this.contents.fontSize = Yanfly.Param.ShopCantSize;
        var ww = this.contents.width - this.textPadding();
        this.changeTextColor(this.textColor(10));
        this.drawText(Yanfly.Param.ShopCantEquip, x, y, ww, 'right');
        this.resetTextColor();
      }
      this.changePaintOpacity(true);
    };

    For the above code, I simply removed the 10th line:
    this.changeTextColor(this.textColor(3));
    Which is what was causing both to be drawn in the same color.

    Color Consistency
    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);
      var itemId = this._item.id;
      var equips = [];
      for (i = 0; i < actor.equips().length - 1; i++) {
        if (actor.equips()[i] !== null) {
          equips.push(actor.equips()[i].baseItemId);
          equips.push(actor.equips()[i].id);
        }
      }
      if (equips.contains(itemId)) {
        this.changeTextColor(this.textColor(1));
        text = 'Equipped';
      } else if (actor.canEquip(this._item)) {
        this.changeTextColor(this.textColor(3));
        text = 'Can Equip';
      }
      this.drawText(text, x, y, width, 'right');
      this.resetTextColor();
    };

    As for this code, I added a line to change the color of an equipped item.
    I also added a line to add the non-base item id to the equips array, to catch any non-independent items. I actually had to add it to test the "Equipped" color. I was shooting in the dark last night.
    Let me know if this works!

    Work went a lot later than I thought it would tonight, so this is all the progress I have for now. I'll take a look at the "in possession" values tomorrow, since I am off work finally.
  7. Heya @ThreeSixNine !
    I don't spose you've had the free time to make look into this any further for me?
    Let me know if there's anything else I can provide you that might help ^_^
  8. Hi @LunaFamiliar
    I am doing some testing now, I'll let you know how it goes!
  9. @ThreeSixNine Any luck with the testing so far?
    Also hope your holiday season has been merry! ^_^
  10. @LunaFamiliar Hi Luna, sorry it took me so long to get back to this, its been a busy holiday season for me this year. It has been a very merry, very happy holiday season for me, I hope its been well for you as well.

    I ran into a problem while trying to figure this out, which is that when you equip a weapon or armor, the game system removes that item from the player's inventory.

    The method I has thought of was to try adding a property to all weapons and armors that can store the amount equipped, and then add/subtract from that value from the equip/unequip function. I ran into some issues adding properties to items in the same way I have added properties to other objects in the past, like actors.

    There still might be a way, but it's definitely eluding me for the time being.