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.

Colour change

Well, this doesnt sound too difficult to me, but i have no experience with ruby, so who am i to talk?

Anyways,
You know when you are equipping an item, and it shows your stats with your current weapon, then it shows what your stats will be with the weapon you are about to equip. All i want it to do is, if you stats will be higher after you equip the item, then make the number green, if your stats are lower after you equip the item, make the number red.

Are you following me ok?

Ill greatly appreciate it if someone can do this for me :]
 

Eilei

Sponsor

You're right, it's pretty simple. You want to change the refresh method of Window_EquipLeft, like so:

Code:
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  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)
[COLOR=Green]      if @actor.atk < @new_atk
        self.contents.font.color = text_color( 3 )
      elsif @actor.atk > @new_atk
        self.contents.font.color = text_color( 2 )
      else
        self.contents.font.color = normal_color
      end
[/COLOR]      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)
[COLOR=Green]      if @actor.pdef < @new_pdef
        self.contents.font.color = text_color( 3 )
      elsif @actor.pdef > @new_pdef
        self.contents.font.color = text_color( 2 )
      else
        self.contents.font.color = normal_color
      end
[/COLOR]      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)
[COLOR=Green]      if @actor.mdef < @new_mdef
        self.contents.font.color = text_color( 3 )
      elsif @actor.mdef > @new_mdef
        self.contents.font.color = text_color( 2 )
      else
        self.contents.font.color = normal_color
      end
[/COLOR]      self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
    end
  end

This makes the value shown red if it's lower, green if it's higher, and white if it stays the same.
 

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