Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
TehBoomer

Custom Window Help

Question

Hi. This is my first post on these forums, and hopefully this one is placed in the right section.

 

I've recently started working with RGSS--have read lots of tutorials from lots of different sites (also have a slight background in C++, so that helps) and it's making a lot of sense. For me, however, there seems to be one very large hitch. I'm working on my own CMS (in its very infantile stages) and I cannot get Window_Selectable to allow me to select options. It's driving me insane. The tuts have stated that Window_Selectable should already have the code in place to determine whether up or down is keyed and to adjust accordingly. When I press up or down in the testing phase, however, it simply moves the character up or down.

 

Here is my code:

#==============================================================================
# New Menu Window
#------------------------------------------------------------------------------
# The beginnings of a CMS
#==============================================================================
class Window_NewMenu < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(100, 100, 85, 160)
self.index = 0 # Initial Option
@item_max = 4 # Number of options
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 75, 20, "Items")
self.contents.draw_text(0, 32, 75, 20, "Equip")
self.contents.draw_text(0, 64, 75, 20, "Save")
self.contents.draw_text(0, 96, 75, 20, "Exit")
end
#--------------------------------------------------------------------------
# * Check Input
#--------------------------------------------------------------------------
def check_input
if Input.trigger?(Input::C)
$window.dispose
if self.index == 0
 $scene = Scene_Item.new
elsif self.index == 1
 $scene = Scene_Equip.new
elsif self.index == 2
 $scene = Scene_Save.new
elsif self.index == 3
 $scene = Secene_End.new
$window = Window_Text.new
$window.y = 0
$window.back_opacity = 0
end
end
end
end

 

I'm using the official RMXP version from Enterbrain. If any further information is required, please let me know.

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

I think I know the issue.

 

You are correct, Window_Selectable carries all the code required for Input Handling.

This is the method from `Window_Selectable` that handles input:

Window_Selectable#update

 

  def update
   super
   # If cursor is movable
   if self.active and @item_max > 0 and @index >= 0
     # If pressing down on the directional buttons
     if Input.repeat?(Input::DOWN)
       # If column count is 1 and directional button was pressed down with no
       # repeat, or if cursor position is more to the front than
       # (item count - column count)
       if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
          @index < @item_max - @column_max
         # Move cursor down
         $game_system.se_play($data_system.cursor_se)
         @index = (@index + @column_max) % @item_max
       end
     end
     # If the up directional button was pressed
     if Input.repeat?(Input::UP)
       # If column count is 1 and directional button was pressed up with no
       # repeat, or if cursor position is more to the back than column count
       if (@column_max == 1 and Input.trigger?(Input::UP)) or
          @index >= @column_max
         # Move cursor up
         $game_system.se_play($data_system.cursor_se)
         @index = (@index - @column_max + @item_max) % @item_max
       end
     end
     # If the right directional button was pressed
     if Input.repeat?(Input::RIGHT)
       # If column count is 2 or more, and cursor position is closer to front
       # than (item count -1)
       if @column_max >= 2 and @index < @item_max - 1
         # Move cursor right
         $game_system.se_play($data_system.cursor_se)
         @index += 1
       end
     end
     # If the left directional button was pressed
     if Input.repeat?(Input::LEFT)
       # If column count is 2 or more, and cursor position is more back than 0
       if @column_max >= 2 and @index > 0
         # Move cursor left
         $game_system.se_play($data_system.cursor_se)
         @index -= 1
       end
     end
     # If R button was pressed
     if Input.repeat?(Input::R)
       # If bottom row being displayed is more to front than bottom data row
       if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
         # Move cursor 1 page back
         $game_system.se_play($data_system.cursor_se)
         @index = [@index + self.page_item_max, @item_max - 1].min
         self.top_row += self.page_row_max
       end
     end
     # If L button was pressed
     if Input.repeat?(Input::L)
       # If top row being displayed is more to back than 0
       if self.top_row > 0
         # Move cursor 1 page forward
         $game_system.se_play($data_system.cursor_se)
         @index = [@index - self.page_item_max, 0].max
         self.top_row -= self.page_row_max
       end
     end
   end
   # Update help text (update_help is defined by the subclasses)
   if self.active and @help_window != nil
     update_help
   end
   # Update cursor rectangle
   update_cursor_rect
 end

 

(RPG Maker-wise, the update method handles player input where needed)

 

Here's the deal though: This method IS NOT automatically called within the Window_* Classes. I'm sure you've noticed, but RPG Maker uses a "Scene" concept--every "game screen" is managed with a corresponding Scene_* class (Scene_Map, Scene_Title, Scene_Menu, etc)--and the Scene to which the Window_ object belongs to should be responsible for calling the update method.

 

So, in your Scene_Menu (or whatever you may have named it) you must ensure you are making a call to Window_NewMenu#update. Without this call, the Window WILL NOT respond to input.

Here is a snippet from the default menu:

Scene_Menu

  def main
   # Command window setup code...
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) # menu window instantiated
   # More Setup code...
# Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update # Call Scene_Menu#update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Scene break down code...
 end
 def update
   # Update windows
   @command_window.update
   # More update code...
 end

 

Note that Scene_Menu#update makes a call to Window_Command#update (Window_Command is also a child of Window_Selectable, which provides the user input handling)

 

So, just make sure you are making a call to your Window's update method each frame.

 

Also, RPG Maker tends to put the user confirm/cancelling code in the Scene_* class... However it isn't absolutely necessary. If you leave the confirm/cancelling input in your Window_NewMenu class, make sure you are also either:

A) Making a call to Window_NewMenu#check_input from the Scene_Menu class

or

B) Make a method in Window_NewMenu called update, make update's first statement a call to the super method, and put the code from check_input after the call to super. Then, when you call Window_NewMenu#update from Scene_Menu, it will call the key up/down/etc. code from Window_Selectable as well as the confirm/cancel code from Window_NewMenu#update

 

Hope this helps.

Share this post


Link to post
Share on other sites
  • 0

Thanks for your reply. I see what you're getting at, however, the fix was far more simple than that. When I discovered what it was, it was embarrassing. All that needed to be done was add a snippet of code in the call even which said $window.update and $window.check_input. It has a bit of lag, but at least the selection window works.

 

I'm getting a strange error now though. Google doesn't seem to have much information regarding it either, the one source I did find ended up generating more confusion than answers.

 

I've created the event to call the select windows, which has something similar to the following for the code:

 

@>Script: $window = Window_NewMenu.new
@>Loop
  @>Conditional Branch: Script: $window.is_a?(Window_NewMenu)
  @>Script: $window.update
		    $window.check_input
  @>Wait: 1 frame(s)
  @>
 : Else
  @>Break Loop
  @>
 : Branch End
  @>
 : Repeat Above
@>Wait: 60 frame(s)
@>Script: $window.dispose
@>

 

 

Here is my new section of code for Window_NewMenu, as I've added and removed and altered some things. (It looks prettier now. :D)

 

#==============================================================================
# ** New Menu Window
#------------------------------------------------------------------------------
# The beginnings of a CMS
#==============================================================================

class Window_NewMenu < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
 def initialize
   super(100, 100, 85, 160)
   self.index = 0
   @item_max = 4
   self.contents = Bitmap.new(width - 32, height - 32)
   self.active = true
   refresh
   update_cursor_rect
 end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.draw_text(0, 0, 75, 20, "Items")
   self.contents.draw_text(0, 32, 75, 20, "Equip")
   self.contents.draw_text(0, 64, 75, 20, "Save")
   self.contents.draw_text(0, 96, 75, 20, "Exit")
 end
#--------------------------------------------------------------------------
# * Check Input
#--------------------------------------------------------------------------
 def check_input
   if Input.trigger?(Input::C)
     $window.dispose
     if self.index == 0
       $scene = Scene_Item.new
     elsif self.index == 1
       $scene = Scene_Equip.new
     elsif self.index == 2
       $scene = Scene_Save.new
     elsif self.index == 3
       $scene = Scene_End.new
     end
   refresh
   end
 end
end

 

 

When attempting to run this code the game will start up, the select window will appear, but when an option is chosen the program spits out this error:

 

 

Script 'Window_NewMenu' line 24: RGSSError occurred.

 

disposed window

 

Line 24 happens to be the

self.contents.clear

segment, and I'm baffled as to why this might be happening. I'd greatly appreciate any help.

Share this post


Link to post
Share on other sites
  • 0

Hmm, interesting I would never have thought of attempting to create a menu with half scripts and half events.

 

Personally, I think this approach is a bad idea...and will probably be a lot more painful than necessary

 

BUT, Before I lecture you about why this *may* be a bad idea impractical (I believe in letting people make their own decisions), I will first tell you what the issue is:

 

So, firstly, Google isn't going to give you much information on RGSS specific errors. Ruby errors you'll find plenty of documentation; but RGSS documentation is not widespread...however, for your benefit I will redirect you to RPG Maker XP's help manual. It can be a little iffy on the wording at times, but if you look, it has a COMPLETE Ruby + RGSS reference manual and will give you MUCH more information on RGSS (that I know of) than any other source...

 

With that said, I'll explain this error:

As you probably know, Window#dispose will free all resources being used by the receiver (instance of window).

However, what is important to keep in mind, is that when Window#dispose is invoked, the receiver is still considered a instance of a window -- only it is a disposed window -- and more importantly, any method invocations on a disposed window will raise an RGSSError. Which is what happened in this case.

 

So, let's take a look see at why this error was raised:

1. $window = Window_NewMenu.new

-> Window is instantiated and stored in `$window`

2. Event loop

3. if $window.is_a?(Window_NewMenu)

-> true?

4. $window.update; $window.check_input

5. wait a frame (here is your source of input lag btw)

-> false?

6. break event loop

7. end if

8. end loop

 

Well, firstly, we know the game reaches 4 (as you are able to at least try to select an option, which is our next clue).

So, we know selecting a menu option crashes the game... so let's see what happens when an option is selected:

def check_input
 if Input.trigger?(Input::C)
   $window.dispose
   if self.index == 0
     $scene = Scene_Item.new
   elsif self.index == 1
     $scene = Scene_Equip.new
   elsif self.index == 2
     $scene = Scene_Save.new
   elsif self.index == 3
     $scene = Scene_End.new
   end
   refresh
 end
end

So, when the player presses the `C` key,

-$window is disposed

-$scene is set to a new scene object

-refresh method is called

 

self.contents.clear

happens to be the first line of the refresh method...

 

The issue here, is that, in this context (i.e. $window.check_input), self in the refresh method refers to $window. Invoking ANY method on $window after it has been disposed will throw that error.

 

So, don't dispose $window before calling it's refresh method.

 

A couple of tips:

-Avoid global variables like the plague. They can be a very useful tool, but should ONLY be used when absolutely necessary--they are much more error prone (as in this case, referring to a global object of class X from within class X). Sometimes, static members within a class/module are a better design pattern...but then again this is just my opinion...

 

class Klass
 @@static_field = 0 # @@ signifies class variables
 # class variables are shared by all instances of 
 # the class in question
 def self.static_field # self.method_name defines a static method
   return @@static_field
 end
end
puts Klass.static_field # this will work
# displays: 0

 

 

-I would rename check_input to update, and make the first statement within that method a call to super. considering that check_input will probably ALWAYS be called immediately after update, you can just take advantage of the inherited update (if you like to save time typing...)

 

def update
 super
 if Input.trigger?(Input::C)
   if self.index == 0
     $scene = Scene_Item.new
   elsif self.index == 1
     $scene = Scene_Equip.new
   elsif self.index == 2
     $scene = Scene_Save.new
   elsif self.index == 3
     $scene = Scene_End.new
   end
 end
end

 

 

- As a general rule of thumb, the update method should be called once per frame... However, the refresh method (in this case) SHOULD not. refresh (in this case) simply draws contents into the window's bitmap (contents). If you need to change the content within the window, then you would need to clear and redraw the entire bitmap...however, since this window ALWAYS displays the same information, you should only call refresh ONCE (when the window is created). (calling it each frame isn't necessarily a HUGE issue...but, it IS technically a waste of resources, and graphics processing is QUITE expensive)

 

Mind you, this is MY opinion, and you are welcome to listen or ignore...and the same is true for the following lecture.

 

LECTURE ALERT

 

 

I don't think using events and scripts (together) to make a custom menu is a very good idea for a couple of reasons.

1. It will get VERY confusing if you need to make more than just what you have now. and you will probably end up constantly switching between event editor and window editor.

2. Event commands require quite a bit of processing to execute (they are completely implemented in Ruby + RGSS, look at the Interpreter scripts if you wanna see how they work, and yes, you can define your own. That's the REAL purpose of "call script") and there is a single frame delay between each event command call

 

AND, because what you are trying to do here could be replaced with this:

 

In script editor:

class Menu
 def initialize
   $window = Window_NewMenu.new
   until(window.disposed?)
     Graphics.update 
     Input.update
     $window.update
     $window.check_input
   end
   $window = nil
 end
end

 

In call script in event editor:

Menu.new

 

*NOTE: this should work with your CURRENT version of Window_NewMenu. The Graphics.update; Input.update is necessary only because the script, in this context, pauses the normal update loop in which graphics.update/input.update would be called.

 

 

 

And............ that's my 2 cents. Hope it helps.

Share this post


Link to post
Share on other sites
  • 0

Phenomenal. Had to add a $ on a global variable, but it's amazing how powerful such a tiny script can be. What you coded works better, more fluently, and has no input delay as opposed to what I was trying. (Oh, and when I removed the 1 frame wait time, I was getting no input reaction whatsoever, the cursor_rect was just sitting at the first option.)

 

Thanks a lot for the theorycrafting session as well, helped my frame of mind quite a bit--also thanks for directing me towards the RMXP help file, I had no idea it even existed.

 

Now, I'm not going to create a menu that uses events...this is simply my very first project working with RGSS, and I don't know enough to tamper around in input controls to change the menu key to do something else entirely. Eventually I hope to...but this is just a start. :)

 

Lastly, your tips are more than welcome, and I appreciate them. Thank you.

Share this post


Link to post
Share on other sites
  • 0

No problem at all. I'm glad I could help :)

And, I do suggest keeping the help menu open at all times (especially when learning to script). Most people don't know about it, and even a lot of those that DO, don't realize it's FULL of ruby / rgss scripting references.

When I was first learning Ruby/rgss I had it open so often, that I just created a shortcut on my taskbar to the actual help file (there should be a .chm for it somewhere in the RMXP install directory)

 

Now, I'm not going to create a menu that uses events...this is simply my very first project working with RGSS, and I don't know enough to tamper around in input controls to change the menu key to do something else entirely. Eventually I hope to...but this is just a start. :)

 

To be honest, I had a feeling this was why you were doing this. But, I think you'd be surprised at how much easier it would be to work with the actual scripts and what not. As you can see, there are a lot of weird things that happen when trying to use too much scripting with events (I tried this same approach when I started as well), and I figure I'd help you prevent a lot of headaches which would probably slow the learning process :(

 

Anyways, once again, glad I could help. If you have any more questions/issues don't hesitate to ask :)

 

P.S. If you want to get started on messing with what happens when you press the menu key--

When the menu key is pressed, essentially the call is:

$scene = Scene_Menu.new

So, if you head over to the script editor and check out the Scene_Menu script, any modifications to that class will modify the menu called by the menu key press. That should be a good starting point for you :)

Share this post


Link to post
Share on other sites
  • 0

Hey mrrow~! Quick question, but the answer might not be so simple. I've been working on this menu system for a long time today, and I was wondering if you have a solution to this issue. It's a bit tricky to explain, so you may need to plug some code into an RMXP window.

 

Updated Scene Menu:

 

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     menu_index : command cursor's initial position
 #--------------------------------------------------------------------------
 def initialize(menu_index = 0)
   @menu_index = menu_index
 end
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make command window
   s1 = $data_system.words.item
   s2 = $data_system.words.skill
   s3 = $data_system.words.equip
   s4 = "Status"
   s5 = "Save"
   s6 = "End Game"
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
   @command_window.index = @menu_index
   # If number of party members is 0
   if $game_party.actors.size == 0
     # Disable items, skills, equipment, and status
     @command_window.disable_item(0)
     @command_window.disable_item(1)
     @command_window.disable_item(2)
     @command_window.disable_item(3)
   end
   # If save is forbidden
   if $game_system.save_disabled
     # Disable save
     @command_window.disable_item(4)
   end
   # Make gold window
   @gold_window = Window_Gold.new
   @gold_window.x = 0
   @gold_window.y = 416
   # Make status window
   @status_window = Window_MenuStatus.new
   @status_window.x = 160 #window positions
   @status_window.y = 0
   # Make the first actor window
   @actor_windowi = Window_ActorI.new
   @actor_windowi.x
   @actor_windowi.y
   # Make the second actor window
   @actor_windowii = Window_ActorII.new
   @actor_windowii.x
   @actor_windowii.y
   # Make the third actor window
   @actor_windowiii = Window_ActorIII.new
   @actor_windowiii.x
   @actor_windowiii.y
   # Make the fourth actor window
   @actor_windowiv = Window_ActorIV.new
   @actor_windowiv.x
   @actor_windowiv.y
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @command_window.dispose
   @gold_window.dispose
   @status_window.dispose
   @actor_windowi.dispose
   @actor_windowii.dispose
   @actor_windowiii.dispose
   @actor_windowiv.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @command_window.update
   @gold_window.update
   @status_window.update
   @actor_windowi.update
   @actor_windowii.update
   @actor_windowiii.update
   @actor_windowiv.update
   # If command window is active: call update_command
   if @command_window.active
     update_command
     return
   end
   # If status window is active: call update_status
   if @status_window.active
     update_status
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when command window is active)
 #--------------------------------------------------------------------------
 def update_command
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to map screen
     $scene = Scene_Map.new
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # If command other than save or end game, and party members = 0
     if $game_party.actors.size == 0 and @command_window.index < 4
       # Play buzzer SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # Branch by command window cursor position
     case @command_window.index
     when 0  # item
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to item screen
       $scene = Scene_Item.new
     when 1  # skill
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Make status window active
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 2  # equipment
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Make status window active
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 3  # status
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Make status window active
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 4  # save
       # If saving is forbidden
       if $game_system.save_disabled
         # Play buzzer SE
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to save screen
       $scene = Scene_Save.new
     when 5  # end game
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to end game screen
       $scene = Scene_End.new
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when status window is active)
 #--------------------------------------------------------------------------
 def update_status
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Make command window active
     @command_window.active = true
     @status_window.active = false
     @status_window.index = -1
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by command window cursor position
     case @command_window.index
     when 1  # skill
       # If this actor's action limit is 2 or more
       if $game_party.actors[@status_window.index].restriction >= 2
         # Play buzzer SE
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to skill screen
       $scene = Scene_Skill.new(@status_window.index)
     when 2  # equipment
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to equipment screen
       $scene = Scene_Equip.new(@status_window.index)
     when 3  # status
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to status screen
       $scene = Scene_Status.new(@status_window.index)
     end
     return
   end
 end
end

 

 

Updated Window_MenuStatus:

 

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 480, 480) #0, 0, 480, 480
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
   self.active = false
   self.index = -1
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
   self.back_opacity = 0
 end
 #--------------------------------------------------------------------------
 # * Cursor Rectangle Update
 #--------------------------------------------------------------------------
 def update_cursor_rect
   #Breaking the column limitation on input
   @column_max = 2

   #Assigning an index value to return a value for party size
   ind = 0
   for i in 0...$game_party.actors.size
     ind = ind + 1
   end

   #Checking to see if the party size is less than 1 member
   if @index < 0
     self.cursor_rect.empty

   #Checking the input on the first party member position  
   elsif @index == 0
     self.cursor_rect.set(0, 50, 60, 55)
     if (ind > 1 and Input.press?(Input::RIGHT))
       @index = 1
     elsif (ind > 2 and Input.press?(Input::DOWN))
       @index = 2
     elsif Input.press?(Input::UP)
     elsif Input.press?(Input::LEFT)
     end

   elsif @index == 1
     self.cursor_rect.set(240, 50, 60, 55)
     if (ind > 0 and Input.press?(Input::LEFT))
       @index = 0
     elsif (ind > 3 and Input.press?(Input::DOWN))
       @index = 3
     elsif Input.press?(Input::RIGHT)
     elsif Input.press?(Input::UP)
     end

   elsif @index == 2
     self.cursor_rect.set(0, 290, 60, 55)
     if (ind > 3 and Input.press?(Input::RIGHT))
       @index = 3
     elsif (ind > 0 and Input.press?(Input::UP))
       @index = 0
     elsif Input.press?(Input::LEFT)
     elsif Input.press?(Input::DOWN)
     end

   elsif @index == 3
     self.cursor_rect.set(240, 290, 60, 55)
     if (ind > 2 and Input.press?(Input::LEFT))
       @index = 2
     elsif (ind > 1 and Input.press?(Input::UP))
       @index = 1
     elsif Input.press?(Input::DOWN)
     elsif Input.press?(Input::RIGHT)
     end
   end
 end
end

 

 

New window Window_Actors, I placed this as a new window after the last window which is Window_DebugRight

 


#==============================================================================
# ** Window_Actors
#------------------------------------------------------------------------------
#  This window displays actors and their information in the menu screen.
#==============================================================================

#==============================================================================
#  This class creates the first actor window in the menu screen
#==============================================================================

class Window_ActorI < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super (160, 0, 240, 240)
   self.contents = Bitmap.new (width - 32, height - 32)
   refresh
 end

 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   actor = $game_party.actors[0]
   self.contents.clear
   draw_actor_name(actor, 0, 0)
   draw_actor_level(actor, 120, 0)
   draw_actor_state(actor, 0, 20)
   draw_actor_graphic(actor, 30, 100)
   draw_actor_class(actor, 67, 40)
   draw_actor_hp(actor, 67, 60)
   draw_actor_sp(actor, 67, 80)
   draw_actor_exp(actor, 0, 100)
 end
end  

#==============================================================================
#  This class creates the second actor window in the menu screen
#==============================================================================

class Window_ActorII < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super (400, 0, 240, 240)
   self.contents = Bitmap.new (width - 32, height - 32)
   refresh
 end

 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   actor = $game_party.actors[1]
   self.contents.clear
   draw_actor_name(actor, 0, 0)
   draw_actor_level(actor, 120, 0)
   draw_actor_state(actor, 0, 20)
   draw_actor_graphic(actor, 30, 100)
   draw_actor_class(actor, 67, 40)
   draw_actor_hp(actor, 67, 60)
   draw_actor_sp(actor, 67, 80)
   draw_actor_exp(actor, 0, 100)
 end
end  

#==============================================================================
#  This class creates the third actor window in the menu screen
#==============================================================================

class Window_ActorIII < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super (160, 240, 240, 240)
   self.contents = Bitmap.new (width - 32, height - 32)
   refresh
 end

 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   actor = $game_party.actors[2]
   self.contents.clear
   draw_actor_name(actor, 0, 0)
   draw_actor_level(actor, 120, 0)
   draw_actor_state(actor, 0, 20)
   draw_actor_graphic(actor, 30, 100)
   draw_actor_class(actor, 67, 40)
   draw_actor_hp(actor, 67, 60)
   draw_actor_sp(actor, 67, 80)
   draw_actor_exp(actor, 0, 100)
 end
end  

#==============================================================================
#  This class creates the fourth actor window in the menu screen
#==============================================================================

class Window_ActorIV < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super (400, 240, 240, 240)
   self.contents = Bitmap.new (width - 32, height - 32)
   refresh
 end

 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   actor = $game_party.actors[3]
   if actor != nil
     self.contents.clear
     draw_actor_name(actor, 0, 0)
     draw_actor_level(actor, 120, 0)
     draw_actor_state(actor, 0, 20)
     draw_actor_graphic(actor, 30, 100)
     draw_actor_class(actor, 67, 40)
     draw_actor_hp(actor, 67, 60)
     draw_actor_sp(actor, 67, 80)
     draw_actor_exp(actor, 0, 100)
   elsif
     self.contents.clear
   end
 end
end  

 

 

This code might make you cringe BTW, I know it's likely not done efficiently...but it works! Mostly...

 

Now, there's 4 character windows. Top left, top right, bottom left, and bottom right. If you select Equip, Status, or Skill it will allow the actor selection...but then if you're on the top right window and push right, the cursor_rect moves down one character. Vice versa for the bottom left--if you push left it moves up one. Everything else is perfect (and damn am I proud of it, btw.) If you know of a way for me to fix that one little (little might be an understatement) bug, please fill me in. Thanks. :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...