Simple script to block loop/cycling through choices.

Hi, everyone !

Is there a way to block the cycling on choices ?

Like, eg.: When on first choice, when i click "up" it goes to the last choice. The same happens otherwise, on last choice, when click "down" i goes to the first.

Can i lock on first don't go "up", and the last don't go "down" further ?

Thx in advance ! 😀
Try saving this as a .js file and importing it like a plugin~
Spoiler: Code
Code:
Window_ChoiceList.prototype.cursorDown = function(wrap) {
    var index = this.index();
    var maxItems = this.maxItems();
    var maxCols = this.maxCols();
    if (index < maxItems - maxCols) {
        this.select((index + maxCols) % maxItems);
    }
};

Window_ChoiceList.prototype.cursorUp = function(wrap) {
    var index = this.index();
    var maxItems = this.maxItems();
    var maxCols = this.maxCols();
    if (index >= maxCols) {
        this.select((index - maxCols + maxItems) % maxItems);
    }
};
Window_ChoiceList inherits from Window_Selectable. The above code overrides the inherited methods with versions that do not have a "wrap" check. For reference, you can find the code for Window_Selectable in your project's rpg_windows.js file. 🙂
Dude(tte :uwink:) , thank you VERY much ! Worked like a charm. I love you ! 😢

Original thread: https://forums.rpgmakerweb.com/threads/simple-script-to-block-loop-cycling-through-choices.107649/