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.

Stat changing colors when equipped with a different weapon or armor

I know this is possible, is there a script somewhere around here that alters the color of the number for stats that are about to change when a weapon with different power is equipped.

I mean something like this

ATK 120
DEF 100
MDF 100

When I am about to equip the character with something else, I want the stat goes like this

ATK 120 > 135
DEF 100 > 75
MDF 100 > 100

When theres a stat change occurs, I want the new stat to have some notification color instead of the plain white system color.

Gotta admit that I'm suck at explaining but please help 8-)
 

khmp

Sponsor

Didn't know whether it existed or not but it seemed very simple to make. To install simply insert a new section above main in the script editor script listings and paste in the code below.

Good luck with it Kinnison! :thumb:

Code:
#==============================================================================
# ** Window_EquipLeft
#------------------------------------------------------------------------------
#  This window displays actor parameter changes on the equipment screen.
#==============================================================================

class Window_EquipLeft < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh                 *!OVERRIDE!*
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 4, 32)
    draw_actor_parameter(@actor, 4, 64, 0)
    draw_actor_parameter(@actor, 4, 96, 1)
    draw_actor_parameter(@actor, 4, 128, 2)
    if @new_atk != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 64, 40, 32, "->", 1)
      
      if @new_atk > @old_atk
        # Green for raised attack value.
        self.contents.font.color = Color.new(0,255,0,255)
      elsif @new_atk < @old_atk
        # Red for lowered attack value.
        self.contents.font.color = Color.new(255,0,0,255)
      else
        # Normal for no change in attack value.
        self.contents.font.color = normal_color
      end
      
      self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
    end
    if @new_pdef != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 96, 40, 32, "->", 1)
      
      if @new_pdef > @old_pdef
        # Green for raised physical defense value.
        self.contents.font.color = Color.new(0,255,0,255)
      elsif @new_pdef < @old_pdef
        # Red for lowered physical defense value.
        self.contents.font.color = Color.new(255,0,0,255)
      else
        # Normal for no change in physical defense value.
        self.contents.font.color = normal_color
      end
      
      self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
    end
    if @new_mdef != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 128, 40, 32, "->", 1)
      
      if @new_mdef > @old_mdef
        # Green for raised magical defense value.
        self.contents.font.color = Color.new(0,255,0,255)
      elsif @new_mdef < @old_mdef
        # Red for lowered magical defense value.
        self.contents.font.color = Color.new(255,0,0,255)
      else
        # Normal for no change in magical defense value.
        self.contents.font.color = normal_color
      end
      
      self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Set parameters after changing equipment   *!OVERRIDE!*
  #     new_atk  : attack power after changing equipment
  #     new_pdef : physical defense after changing equipment
  #     new_mdef : magic defense after changing equipment
  #--------------------------------------------------------------------------
  def set_new_parameters(new_atk, new_pdef, new_mdef)
    if @actor != nil
      # Save the old stats for comparison during refreshing.
      @old_atk = @actor.atk
      @old_pdef = @actor.pdef
      @old_mdef = @actor.mdef      
    end
    if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
      @new_atk = new_atk
      @new_pdef = new_pdef
      @new_mdef = new_mdef
      refresh
    end
  end
end
 

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