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.

Stats

It's er... me again, the dumb noob at RGSS...

I just need to know a few quick things:

How do I put these in a window?

Actor 1 class
Actor 1 combat level

I have this window:

Code:
#-------------
# Info Window
#-------------
class Window_HudInfo < Window_Base
  def initialize
    super(522, 116, 107, 59)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.windowskin = RPG::Cache.windowskin("ws2.png")
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = 12
    clas = #Actor 1 class
    name = $data_actors[1].name
    lvl = #Actor 1 level
    self.contents.draw_text(0, 0, 100, 14, "#{name}")
    self.contents.draw_text(0, 14, 100, 14, "Level")
    self.contents.draw_text(38, 14, 100, 14, "#{lvl}")
    self.contents.draw_text(55, 14, 100, 14, "#{clas}")
  end
end

Thank you for your help,
~Wyatt
 

Ter13

Member

Look into the Window_Base script.

There are commands in there to draw each individual statistic.

the commands you are looking for are called:
draw_actor_name(actor,x,y)
draw_actor_class(actor,x,y)
draw_actor_level(actor,x,y)

Though for level, you seem to be using a normal text value followed by level...

So, to do that, you want to do something called string concatenation. It's uber simple, though the name makes it seem otherwise.

First, take your text string, then put a simple period, and then follow it with another value, such as actor level.

"Level: ".$actors[1].level

For a level 10 character, this will output "Level: 10"

Simple enough for you?
 

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