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] Window Won't Appear

Ugh... I'm having nothing but problems lately... Probably because I'm trying to program without being good at this language.

Okay... Basically, when I call this from the target window in the menu, it just goes to a black screen:

Code:
 

class Window_Bio < Window_Base

  attr_accessor :name

  attr_accessor :class

  attr_accessor :gender

  attr_accessor :age

  attr_accessor :height

  attr_accessor :weight

  

  def initialize(actor)

    super(0, 0, 640, 480)

    self.contents = Bitmap.new(width - 32, height - 32)

    @actor = $game_party.actors[actor]

    @id = @actor.id

    @name = @actor.name.to_s

    @class = @actor.class_name.to_s

    @gender = ["1", "2", "3", "4"]

    @age = ["1", "2", "3", "4"]

    @height = ["1", "2", "3", "4"]

    @weight = ["1", "2", "3", "4"]

    refresh

    self.visible = true

  end

  

  def refresh

    self.contents.clear

    draw_graphic(@actor)

    draw_name

    draw_class

    draw_gender(@id)

    draw_age(@id)

    draw_height(@id)

    draw_weight(@id)

    self.contents.font.color = system_color

    self.contents.draw_text(100, 50, 100, 32, "Class: ", 2)

    self.contents.draw_text(100, 114, 100, 32, "Gender: ", 2)

    self.contents.draw_text(100, 145, 100, 32, "Age: ", 2)

    self.contents.draw_text(300, 50, 100, 32, "Height: ", 2)

    self.contents.draw_text(300, 82, 100, 32, "Weight: ", 2)

    return

  end

  

  def draw_name

    self.contents.font.size = 48

    self.contents.draw_text(0, 0, 608, 50, @name, 1)

  end

  

  def draw_graphic(actor)

    bitmap = Bitmap.new('Graphics/Pictures/' + actor.name)

    rect = Rect.new(2, 0, 100, 100)

    self.contents.blt(0, 50, bitmap, rect)

  end

    

  def draw_class

    self.contents.draw_text(200, 82, 100, 32, @class)

  end

  

  def draw_gender(actor)

    self.contents.draw_text(200, 114, 100, 32, @gender[actor])

  end

  

  def draw_age(actor)

    self.contents.draw_text(200, 146, 100, 32, age[actor])

  end

  

  def draw_height(actor)

    self.contents.draw_text(400, 50, 100, 32, height[actor])

  end

  

  def draw_weight(actor)

    self.contents.draw_text(400, 82, 100, 32, weight[actor])

  end

end

 

Code:
 

class Scene_Bio

  def initialize(actor)

    @actor = actor

  end

  

  def main

    @bio = Window_Bio.new(@actor)

    @bio.visible = true

    @bio.active = true

    Graphics.transition

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self

        break

      end

    end

    Graphics.freeze

    @bio.dispose

  end

    

  def update

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      $scene = Scene_Menu.new(5)

    end

  end

end

 

There's my window and my scene... I've looked at other scripts and even stuff I've done, and I can't figure this out at all...
 
Can't use RMXP from here but...doing a quick look, I think your "height" attribute has to be renamed, because its caousing troubles between window height and player height, since they have both the same variable name.

Just change wherever it says "height" to "height2" or "c_height" and you should be fne.
Tell me if it works
 

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