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.

Command window items

I post here too often; whatever.

I'm doing a command window that starts off with just 1, 2, 3  as the commands. It's answers to a puzzle, basically. The answers won't always be 1,2,3, but it will still be the same scene. So I need to change what the commands in the window are half way through a scene, if that makes sense.

What I've tried is this:

Code:
@puzzle_command_window = Window_Command.new(160, ["1", "2", "3"])

...

@puzzle_command_window.commands = ["13","14","15"] if @puzzle == 0
@puzzle_command_window.commands = ["6","7","8"] if @puzzle == 1
@puzzle_command_window.commands = ["1","2","3"] if @puzzle == 2
@puzzle_command_window.commands = ["1","2","3"] if @puzzle == 3
@puzzle_command_window.commands = ["1","2","3"] if @puzzle == 4

This brought up a no method error, so I added:

attr_accessor :commands

To Window_Command, which got rid of the error but still didn't change what the command window showed.

Wondering if this is even possible, and if so, how do I do this?
 
I believe you have to refresh the window after changing its items. Not sure if this will work, but you can try this
Code:
class Window_Command
  def commands=(commands)
    @commands = commands
     refresh
  end
end
 

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