Hi everybody!
So my column-based custom menu worked fine, but then I thought "Well, it's perfect for when I have 5 party members (elements), but when I have less, there are some ugly empty spaces. Worse, you can actually select them. Maybe I could make the number of columns dependent on the number of party members I have?"
So I thought I'd just have to have my party members ids in an array, and then supply array.size to col_max and item_max and voila! But no. The game crashes, saying "no defined 'size' method for 'nil' class". So somehow my variable isn't defined properly. So I added a few print calls to see how this went, see below:
So my column-based custom menu worked fine, but then I thought "Well, it's perfect for when I have 5 party members (elements), but when I have less, there are some ugly empty spaces. Worse, you can actually select them. Maybe I could make the number of columns dependent on the number of party members I have?"
So I thought I'd just have to have my party members ids in an array, and then supply array.size to col_max and item_max and voila! But no. The game crashes, saying "no defined 'size' method for 'nil' class". So somehow my variable isn't defined properly. So I added a few print calls to see how this went, see below:
[\spoiler]
And it returns something like this:
item_max
col_max
col_max
item_max [1,2,3,4,5]
col_max [1,2,3,4,5]
col_max [1,2,3,4,5]
item_max [1,2,3,4,5]
item_max [1,2,3,4,5]
item_max [1,2,3,4,5]
item_max [1,2,3,4,5]
etc.
(I may not have written the exact number of times it was printed correctly)
So apparently, col_max and item_max are called a few times before the window is even initialized? Or it kinda happens at the same time? I don't know. Anybody has any ideas about this? Thanks a lot!
And it returns something like this:
item_max
col_max
col_max
item_max [1,2,3,4,5]
col_max [1,2,3,4,5]
col_max [1,2,3,4,5]
item_max [1,2,3,4,5]
item_max [1,2,3,4,5]
item_max [1,2,3,4,5]
item_max [1,2,3,4,5]
etc.
(I may not have written the exact number of times it was printed correctly)
So apparently, col_max and item_max are called a few times before the window is even initialized? Or it kinda happens at the same time? I don't know. Anybody has any ideas about this? Thanks a lot!
Code:
class Window_ShowParty < Window_Selectable def initialize(shown_party, height_adjust) super(40, 40 + fitting_height(height_adjust), window_width, fitting_height(visible_line_number)) @shown_party = shown_party refresh end # You'll notice I added a few print calls for debugging purposes def col_max print "col_max " print @shown_party print "\n" return 5 end def item_max print "item_max" print @shown_party print "\n" return 5 end