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.

[VX} Creating a window in the menu that shows a variable

ikos

Member

Hey guys;

Here's what I mean if you don't get it: I want there to be a window that shows when I open the Menu/Camp Menu/whatever you wanna call it. However; on said window I want a variable to display. I tried something but nothing happened. Nothing. Here's what I have:

Code:
module DarkOdysseyD
  MenuVIcons = [188]
  MenuVTexts = ['time']
end

class Window_DOMenuVar < Window_Base
  def initialize(x, y)
    super(x + 260, y - 260, 160, WLH * DarkOdysseyD::MenuVIcons.size + 32)
    refresh

  end
  
    def time
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    if hour >= 1
      return sprintf("%01d:%02d:%02d", hour, min, sec)
    else
      return sprintf("%01d:%02d", min, sec)
    end
  end
  
    def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.windowskin = Cache.system('window')
    y = 0
    for i in 0...DarkOdysseyD::MenuVIcons.size
      self.contents.draw_text(0, y, 128, WLH, eval(DarkOdysseyD::MenuVTexts[i]), 2)
      draw_icon(DarkOdysseyD::MenuVIcons[i], 0, y)
      y += WLH
    end
  end
  
    def update
    super
    refresh if Graphics.frame_count / Graphics.frame_rate != @total_sec
  end
end

Any suggestions? :\
 
You'd put it in a new window, and then call the window in Scene_Menu. Your best bet is making a copy of Window_Gold and then replacing the gold stuff with that line and resizing it all accordingly. You have to make sure you rename your copy to Window_Blah where it says:
Code:
class Window_Gold < Window_Base
 
Alright, I have a question to kind of add on to this one. I also want to add a variable's amount to a page.... but is it possible to add it to a picture? Such as.... If I did a...

Show Picture 1: (just as a menu screen)
is there any way I could add the variables in a list on this picture at the same time? Is that line of code all I need?

I'm trying to make a custom menu with people's relationship scores in it, such as... if the player met a friend on his journey, their relationship score would be 50 and could go up and down based on your actions. Any way to do this?

And is there any way to show the gold amount on another picture like that one? Or would it work the same way, and I'd just set it to a variable?
 

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