Call menu during messages

● ARCHIVED · READ-ONLY
Started by Krimer 20 posts View original ↗
  1. CallMenu.js
    ver. 1.5
    by Krimer

    Introduction

    Call menu during messages\choices on map by pressing one of the standard menu keys ESC, X, Insert, NUM 0.

    Script
    MV version - pastebin

    MZ version
    JavaScript:
    /*=============================================================================
     *  CallMenuMZ.js
     *=============================================================================*/
     
    var Imported = Imported || {};
    Imported.CallMenuMZ = true;
     
    /*:=============================================================================
    * @plugindesc v1.0 Call menu during messages\choices on map by pressing one of the standard menu keys ESC, X, Insert, NUM 0. For MZ
    * @author Krimer
    * @help
    * If you want call menu during choices just disallow cancel in choice command.
    * Place this plugin below non-standard message systems or choice windows in
    * plugin manager for better compatibility.
     
    * =============================================================================*/
     
    /*=============================================================================*/
    /* Alias */
    var _Game_Temp_initialize_Alias = Game_Temp.prototype.initialize;
    Game_Temp.prototype.initialize = function() {
        _Game_Temp_initialize_Alias.call(this)
        this._lastSelectedChoice = null;
    };
    
    /* NEW */
    Game_Temp.prototype.setLastSelectedChoice = function(f) {
        this._lastSelectedChoice = f
    };
    /* NEW */
    Game_Temp.prototype.getLastSelectedChoice = function() {
        return this._lastSelectedChoice
    };
    /* Alias*/
    var _Window_ChoiceList_callOkHandler = Window_ChoiceList.prototype.callOkHandler
    Window_ChoiceList.prototype.callOkHandler = function() {
        $gameTemp.setLastSelectedChoice(null)
        _Window_ChoiceList_callOkHandler.call(this);
    };
    /* Alias */
    var _Window_ChoiceList_callCancelHandler = Window_ChoiceList.prototype.callCancelHandler
    Window_ChoiceList.prototype.callCancelHandler = function() {
        $gameTemp.setLastSelectedChoice(null)
        _Window_ChoiceList_callCancelHandler.call(this);
    };
    /* Alias */
    var _Window_ChoiceList_selectDefault = Window_ChoiceList.prototype.selectDefault
    Window_ChoiceList.prototype.selectDefault = function() {
        if ($gameTemp.getLastSelectedChoice() !== null){
            this.select($gameTemp.getLastSelectedChoice());
        } else {
            _Window_ChoiceList_selectDefault.call(this);
        }
    };
    /* Alias*/
    var _Window_ChoiceList_update = Window_ChoiceList.prototype.update
    Window_ChoiceList.prototype.update = function() {
        _Window_ChoiceList_update.call(this);
         if ((Input.isTriggered('escape') || Input.isTriggered('menu') || TouchInput.isCancelled()) && $gameMessage.isBusy() && $gameSystem.isMenuEnabled()) {
            $gameTemp.setLastSelectedChoice(this._index)
        }
     
    };
     
    /* Alias */
    var _DataManager_makeSaveContents_Alias = DataManager.makeSaveContents;
    DataManager.makeSaveContents = function () {
        var contents = _DataManager_makeSaveContents_Alias.call(this);
        contents.message = $gameMessage;
    
        return contents;
    };
    
    /* Alias */
    var _DataManager_extractSaveContents_Alias = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function (contents) {
        _DataManager_extractSaveContents_Alias.call(this, contents);
        $gameMessage = contents.message;
        if ($gameMessage._choices.length !== 0) {
         
            $gameMessage.setChoiceCallback(n => {
                $gameMap._interpreter._branch[$gameMap._interpreter._indent] = n;
            });
        }
    
    };
    /* Alias */
    var _Scene_Map_update_Alias = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function () {
        _Scene_Map_update_Alias.call(this);
        if ((Input.isTriggered('escape') || Input.isTriggered('menu') || TouchInput.isCancelled()) && $gameMessage.isBusy() && $gameSystem.isMenuEnabled()) {
            this.callMenu();
        }
    };
    /* OVERWRITE */
    Window_Message.prototype.isTriggered = function () {
        return (Input.isRepeated('ok') || TouchInput.isRepeated());
    };
     
    /* End of File */
    /*=============================================================================*/
    [/SPOILER]

    Author's Notes
    I created this plugin some time ago, but it did not have own topic, so i decided to create one :)
    I tried to fix most compatibility problems. But tell me if you find something.

    Feel free to use it as you wish
  2. Update to version 1.4.3
    - Some minor bug and compatibility fixes
  3. could you give a use-case example?
  4. Yitzi Litt said:
    could you give a use-case example?
    Any game without direct control on the player. Like VNs or some mini-games when game playing yourself most of the time.
    Something like this - link
    Or just for player sake, when your game has ton of texts, and to give them save-load any time. Or if you have something important to check in menu like status or reputation, etc. But most of the time its for save-load purpose.
    And yea, for using this you need to build your project with a thought - "Player can open menu any time", and block menu sometimes or build events specifically if needed.
    Sorry my English not that good so i'm bad on explaining :)
  5. Hey Krimer. I've been using this plugin for a text adventure game I am building, and it's been great. However, I'm having a small issue with items and spells that have message common events tied to them. Say I have a potion that heals HP. I call the menu during a message to access inventory and use the potion. The potion will heal HP and then the game goes back to the original message I called the menu on, but if I also have a message event tied with the potion (example: "You have drank the potion and restored some health"), then there is a delay in that message appearing. You know how when you call the menu during a message, then exit the menu, the message redisplays? Well, in this case, the potion message won't display until AFTER the old message redisplays after exiting the menu. And if I have Show Choices, then the message won't display until after I select a choice.

    I think part of the problem is that my original message event is a parallel event. I have most of my events as parallel events because, being a text adventure game with no player movement on a map, I don't know of any other way to trigger these events. It should be noted that the potion message works fine in common events with NO parallel trigger. But I don't want to build my entire game with just common events. The only conceit I can think of is to have Show Choices for item and spell access alongside the other choices the player has when navigating the game, but I would like to avoid this also.

    Thanks and have a great day.
  6. @C.W. Plainview Hi, it's happening because you showing that item message with a common event. It's added to queue and waiting until it's can be executed. So most of the time it's after all your current commands in event. This is how a common event works.
    So to fix it you need a different plugin(s). Something like a Yanfly Gab Window(separate message window) but with function to call it directly from an item, not from a common event. I will not provide this feature in this plugin, sorry. Because i don't want to mess with standart executing order for that, it will have influence to other people who don't need this feature and other possible problems.
    I can try to create some addons, but I can't promising it. So best choice will be to start searching solution by yourself.
  7. I understand. Thanks for your insight. I did find an alternative, though it means having to abandon this plugin: simply present an "open menu" choice that runs an event that opens the menu. Item messages and saving and everything works great this way.
  8. Hey @Krimer , I just wanted to tell you that I think this is a fantastic and almost essential plugin for making a decent visual novel in MV. Thank you very much for making, updating and sharing it (for free to boot!) :kaoluv:

    I hope to use this in a commercial game and I wanted to ask you if you have any preferences on how you'd like to be credited? If at all?
  9. @Parallax Panda No problem :) I'm glad it's usefull for you. As for the credits it's not necessary, so do as you wish :)
  10. @Krimer
    I'd credit you as "Krimer" then (since that's the only name I know you by).

    Also, I've noticed that whenever you access the menu while you're displaying a 「Show Choices menu」, upon exiting back from the main menu the cursor will always reset to the default choice. This can feel a little wonky if you've moved it. It's not game breaking or anything, but it's surely something that the player would notice in a choice heavy game. Is it possible to make this more seamless? Like, make the game remember what choice you're currently pointing at before opening the menu so nothing will have changed when you return?
  11. @Parallax Panda It's because how scene change in RPG maker works. It destroys old windows and creates new one when scene change is happpens. But ok, i can do it :) Check new version.


    Plugin updated to new version 1.4.5
    - added last selected choice function.
    Now player last selected choice will be restored after closing game menu. But it will not restore after player load the game.
  12. @Krimer
    Thanks! That's a small but great improvement! :kaoluv:
  13. Really a great plugin, but is it possible to not remove pictures upon entering the menu? It's awkward when character busts disappears. Or at least delete pic when save menu is called? Otherwise, an awesome plugin for the non-standard rpgm game.
  14. @kako05 Standard pictures stay as is when you call menu. Unless you are using other plugins to show some pictures with their own functions then its their problem and can be solved only there.
  15. Oh, you're right. Sorry. It's a misunderstanding.
  16. Previous versions worked fine (the ones in old thread), but this one crashes the game when trying to access the menu during choice dialog. The culprit is http://daimonioustails.weebly.com/game-time-mv.html
    Could you take a look if it's possible to fix easy? Maybe I could get a link to 1.4.3 to test that version?
  17. @kako05 site is unavailable in my country, but i managed to get the plugin with vpn :)
    Fixed the problem in new version, try it
  18. Thanks! Works great :)
  19. Hi, @Krimer. Thank you very much for sharing this plugin to us.

    Do you mind to add feature (plugin command, script call, or switch) to enable/disable menu access during message?
    E.g: In normal scene, opening menu during message is not allowed, but in cutscene/conversation scene, opening menu during message is allowed.

    I prefer to use switch, because I can easily make common event for VN game by activating every switch automatically
  20. RyanBram said:
    Hi, @Krimer. Thank you very much for sharing this plugin to us.

    Do you mind to add feature (plugin command, script call, or switch) to enable/disable menu access during message?
    E.g: In normal scene, opening menu during message is not allowed, but in cutscene/conversation scene, opening menu during message is allowed.

    I prefer to use switch, because I can easily make common event for VN game by activating every switch automatically
    Sure, will do when i have time