Battle Results - Item Quantities

● ARCHIVED · READ-ONLY
Started by TheCosmicSlug 4 posts View original ↗
  1. I've been editing BattleResultsPopup.js from https://forums.rpgmakerweb.com/inde...-things-to-battle-result-pop-up-plugin.48502/ but I'm not sure how to modify the part of code that prints out the reward items.
    Code:
            x = 0;
            y += lineHeight;
    
            items.forEach(function(item) {
                this.drawItemName(item, x, y, width);
                y += lineHeight;
            }, this);

    As it is right now it just lists the items, and if there is more than one of an item it appears twice in the list.
    what I would like is for it to say Item x 2 instead, and obviously only appearing once in the list.

    I'm still learning javascript and dont know how to check through the list like that, I tried reading through yanflys victory aftermath plugin but couldn't understand what it was doing.

    can anyone help?
  2. I've moved this thread to Plugin Support. Thank you.

  3. there's two parts to it: one, you'll have to modify the items array so that it holds sets of individual items, and two, you have to modify the drawItemName method so that it'll print out the number.

    and, modifying the items array would involve modifying the drop calculation but I don't know about that, it'll depend on the plugin.

    either way...... items array.
    it has to be an array containing the item, and the quantity.
  4. thankyou, I got it working in the end after more reading through yanflys code.
    Made a second array with only one of each item name... looped through that, each time counting the occurances that match in the first array.
    I see someone on the thread I linked was asking the same question so once ive cleaned up the code abit I will share with the community.