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.

[Resolved] Editing Window_Selectable?

Hi there I'm using the default window_selectable class and was curious how to change something... I'm creating a quest log so the window I use is scrollable.
The problem is that if you are at the very first quest and press up, you get to the bottom quest. If you are at the very bottom quest and press down, you get to the top quest.  I want to change it so that you cannot skip to the bottom/top of the list and I'm not sure how.
Thanks for any help.
 

poccil

Sponsor

Edit line 142 of Window_Selectable:
Code:
            @index = (@index + @column_max) % @item_max
Change it to this:
Code:
          # Prevent wrapping
          if (@index + @column_max) < @item_max
            @index = (@index + @column_max) % @item_max
          end
Also, edit line 153 of Window_Selectable:
Code:
            @index = (@index - @column_max + @item_max) % @item_max
Change it to this:
Code:
          # Prevent wrapping
          if @index - @column_max >= 0
            @index = (@index - @column_max + @item_max) % @item_max
          end
I hope this helps.
 

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