Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] help with Shop edit

I'm trying to edit the Shop windows so that it will display ALL attribute changes for weapons and armor, not just ATK, MDEF, and PDEF. Here is the section of code I am having troubles with:

Code:
        # If weapon

        if @item.is_a?(RPG::Weapon)

          atk1 = item1 != nil ? item1.atk : 0

          atk2 = @item != nil ? @item.atk : 0

          change = atk2 - atk1

          atk1 = item1 != nil ? item1.atk : 0

          atk2 = @item != nil ? @item.atk : 0

          atkChange = atk2 - atk1

        end

        

        pdef1 = item1 != nil ? item1.pdef : 0

        mdef1 = item1 != nil ? item1.mdef : 0

        pdef2 = @item != nil ? @item.pdef : 0

        mdef2 = @item != nil ? @item.mdef : 0

        pdefChange = pdef2 - pdef1

        mdefChange = mdef2 - mdef1

        

        dex1 = item1 != nil ? item1.dex : 0

        dex2 = @item != nil ? @item.dex : 0

        dexChange = dex2 - dex1

        

        agi1 = item1 != nil ? item1.agi : 0

        agi2 = @item != nil ? @item.agi : 0

        agiChange = agi2 - agi1

        

        int1 = item1 != nil ? item1.int : 0

        int2 = @item != nil ? @item.int : 0

        intChange = int2 - int1

The problem is that it crashes in the shop scene because it says something about an undefined method for Weapon. It seems that a Weapon does not have a method for dex, agi, or int. But I cannot find where the atk method is for Weapon so that I can add those other methods. Any ideas?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top