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.

[FILLED] State as an image

Hello there.

I've been looking for a script that turns the character state (Status) to an image in RMXP's DMS.


I'd really appreciate it if someone could make/help me find this script.

Thanks :]

---Mr. Ishbuu
 
Here's a short script I wrote some time ago:
Code:
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Make State Text String for Drawing
  #     actor       : actor
  #     width       : draw spot width
  #     need_normal : Whether or not [normal] is needed (true / false)
  #--------------------------------------------------------------------------
  def make_battler_state_text(battler, width, need_normal)
    # Make text string for state names
    text = []
    for states in battler.states
      unless $data_states[states].rating == 0
        next if states == nil
        text << $data_states[states].name
      end
    end
    # Return completed text string
    state_text = text.size == 0 ? "" : text
    return state_text
  end
  #--------------------------------------------------------------------------
  # * Draw State
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 120)
    text = make_battler_state_text(actor, width, true)
    for i in text
      self.contents.blt(x + text.index(i) * 32, y, RPG::Cache.icon(i), Rect.new(0, 0, 32, 32))
    end
  end
end

Just put the status icons in your icon folder and name them like you named your states.
 
I get an error:
Can't convert NilClass into bitmap
and it points me to line:
self.contents.blt(x + text.index(i) * 32, y, RPG::Cache.icon(i), Rect.new(0, 0, 32, 32))
Have any idea what might be causing the problem?
 

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